Skip to content

Commit 97be60a

Browse files
committed
add: 결제 완료된 주문의 옵션 수정 API 및 hook 추가
1 parent f0c7738 commit 97be60a

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

package/pyconkr-shop/apis/index.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,20 @@ namespace ShopAPIRoute {
168168
*/
169169
export const refundAllItemsInOrder = (data: { order_id: string }) =>
170170
shopAPIClient.delete<void>(`v1/orders/${data.order_id}/`);
171+
172+
/**
173+
* 결제 완료된 주문의 사용자 정의 응답용 상품 옵션을 수정합니다.
174+
* @param data.order_id - 수정할 주문 내역의 UUID
175+
* @param data.order_product_relation_id - 수정할 주문 내역 내 상품의 UUID
176+
* @param data.options - 수정할 상품 옵션 정보
177+
* @param data.options[].order_product_option_relation - 수정할 상품 옵션의 UUID
178+
* @param data.options[].custom_response - 수정할 상품 옵션에 대한 사용자 정의 응답
179+
*/
180+
export const patchOrderOptions = async (data: ShopAPISchema.OrderOptionsPatchRequest) =>
181+
shopAPIClient.patch<ShopAPISchema.Order, ShopAPISchema.OrderOptionsPatchRequest['options']>(
182+
`v1/orders/${data.order_id}/products/${data.order_product_relation_id}/options/`,
183+
data.options
184+
);
171185
}
172186

173187
export default ShopAPIRoute;

package/pyconkr-shop/hooks/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,13 @@ namespace ShopAPIHook {
140140
mutationFn: ShopAPIRoute.refundAllItemsInOrder,
141141
meta: { invalidates: [QUERY_KEYS.ORDER_LIST] },
142142
});
143+
144+
export const useOptionsOfOneItemInOrderPatchMutation = () =>
145+
useMutation({
146+
mutationKey: MUTATION_KEYS.CART_ITEM_APPEND,
147+
mutationFn: ShopAPIRoute.patchOrderOptions,
148+
meta: { invalidates: [QUERY_KEYS.ORDER_LIST] },
149+
});
143150
}
144151

145152
export default ShopAPIHook;

0 commit comments

Comments
 (0)