-
-
Notifications
You must be signed in to change notification settings - Fork 288
feat(Orders): Add createdBy argument and createdByUsers resolver to OrdersCollectionQuery
#11287
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
Conversation
| nodes: { | ||
| type: new GraphQLList(GraphQLOrder), | ||
| }, | ||
| createdByUsers: { |
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.
Not sure about the naming, alternative suggestions:
creators?createdBy?
| const orderWhereClause = sequelize.queryInterface.queryGenerator | ||
| .getWhereConditions(baseWhere, 'o', models.Order) | ||
| .replace(/"Order"\./g, 'o.'); |
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 can't find this getWhereConditions in the docs nor in current sequelize's source code. Any link to check what it does and how it's implemented?
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.
It's a private function in Sequelize v6 (the version we're using): https://github.com/sequelize/sequelize/blob/v6/src/dialects/abstract/query-generator.js#L2846
But you're right, can't find it in v7. Will refactor 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.
@Betree I've pushed a refactor to use the Sequelize query builder instead of raw sql here, required some tweaks in how to filter is applied compared to the main collection query. The filters are now manually added to createdByUsers resolver, and it is only target those that are relevant to produce the different dashboard tools for now.
053bf59 to
2acd200
Compare
0c7c2b3 to
88dd6c1
Compare
e61f654 to
f97e341
Compare
Betree
left a comment
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.
The code looks good to me. Can we add some tests to test/server/graphql/v2/collection/OrdersCollectionQuery.test.ts to cover this new behavior?
|
@Betree added some tests for the |
Co-authored-by: Benjamin Piouffle <benjamin@opencollective.com>
Co-authored-by: Benjamin Piouffle <benjamin@opencollective.com>
Co-authored-by: Benjamin Piouffle <benjamin@opencollective.com>
5669a92 to
60e9c6d
Compare
For opencollective/opencollective#8449
Description
createdByargument to the OrdersCollectionQuery, allowing filtering on who created the ordercreatedByUsersresolver to the OrdersCollectionQuery, to return a list of who created the orders for the current filters