-
Notifications
You must be signed in to change notification settings - Fork 10
feat: dont rely on sellerName when creating a request #195
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -136,7 +136,7 @@ type ReturnRequestItem { | |
| imageUrl: String! | ||
| unitMultiplier: Float! | ||
| sellerId: String! | ||
| sellerName: String! | ||
| sellerName: String | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we are resolving it before sending the response, we can keep it as non-nullable. It's important to note that when you change something on GraphQL (also routes on node), depending on the changes we get a warning in the terminal like the below one. If we proceed with these change, we would have to release a new major. |
||
| productId: String! | ||
| refId: String! | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -116,7 +116,7 @@ | |
| "imageUrl": { "type": "string" }, | ||
| "unitMultiplier": { "type": "number" }, | ||
| "sellerId": { "type": "string" }, | ||
| "sellerName": { "type": "string" }, | ||
| "sellerName": { "type": ["string", "null"] }, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't need to make it |
||
| "productId": { "type": "string" }, | ||
| "refId": { "type": "string" }, | ||
| "returnReason": { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -131,19 +131,28 @@ export const ReturnRequestResponse = { | |
| return refundData | ||
| }, | ||
| items: async (root: ReturnRequest, _args: unknown, ctx: Context) => { | ||
| const { id, items } = root | ||
|
|
||
| if (items) return items | ||
| const { id } = root | ||
|
|
||
| const { | ||
| clients: { returnRequest: returnRequestClient }, | ||
| clients: { returnRequest: returnRequestClient, oms }, | ||
| } = ctx | ||
|
|
||
| const { items: itemsList } = await returnRequestClient.get(id as string, [ | ||
| 'items', | ||
| ]) | ||
| const { orderId, items: itemsList } = await returnRequestClient.get( | ||
| id as string, | ||
| ['orderId', 'items'] | ||
| ) | ||
|
Comment on lines
+140
to
+143
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't need to make another request to get the request. It is passed into this function as |
||
|
|
||
| const { sellers } = await oms.order(orderId, 'AUTH_TOKEN') | ||
|
|
||
| const itemsWithSellerName = itemsList.map((item) => { | ||
| const sellerName = | ||
| sellers.find((sellerInfo) => sellerInfo.id === item.sellerId)?.name ?? | ||
| '' | ||
|
|
||
| return { ...item, sellerName } | ||
| }) | ||
|
|
||
| return itemsList | ||
| return itemsWithSellerName | ||
| }, | ||
| refundData: async (root: ReturnRequest, _args: unknown, ctx: Context) => { | ||
| const { id, refundData } = root | ||
|
|
||

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.
Please rebase and make sure changelog is right. The changes listed above are already released.