-
-
Notifications
You must be signed in to change notification settings - Fork 265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add status field to Orders #1391
Conversation
@@ -0,0 +1,125 @@ | |||
'use strict'; | |||
import status from '../server/constants/order_status'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a note, we ave several style in this code base for naming files, would be great to pick one (order_status vs order-status vs orderStatus).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. I used this convention to match the expense_status.js
file. I'll create an issue to standardize this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After having looked at several repositories, looks like the current common practice is ... hyphen case! So that would be order-status
. Anyway, let's take care of that later.
server/graphql/mutations/orders.js
Outdated
if (!orderCreated.processedAt) { | ||
// TODO: Order should be updated with data JSON field to store the error to review later | ||
orderCreated.update({ status: status.ERROR }); | ||
} | ||
throw e; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need to throw the error as you're already inside the catch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it was thrown again to bubble it back up to the graphql response, otherwise the frontend never sees the error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it! LGTM then..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rock solid!
I agree with @znarf about having a standard to name files but it doesn't mean order_status.js
may go with the standard, so it's all good here!
e037a78
to
44078b7
Compare
80d15c1
to
7096fb4
Compare
7096fb4
to
b2a9f0c
Compare
To facilitate creating pledges for collectives (see opencollective/opencollective#1168), this PR adds a
status
field to Orders:The migration also includes code to update existing Orders.