-
Notifications
You must be signed in to change notification settings - Fork 0
[Feat/#107] 사장님 승격 및 결제 완료 처리 API 연동 #109
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
...stomer/src/shared/queries/mutation/admin-settlement/useCompleteAdminSettlementMutation.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| "use client"; | ||
|
|
||
| import { useMutation, useQueryClient } from "@tanstack/react-query"; | ||
| import { adminSettlementModule } from "@/shared/api/api"; | ||
|
|
||
| export const useCompleteAdminSettlementMutation = () => { | ||
| const queryClient = useQueryClient(); | ||
|
|
||
| return useMutation({ | ||
| ...adminSettlementModule.mutations.completeSettlement(queryClient), | ||
| }); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
apps/owner/src/shared/queries/mutation/auth/useUpgradeToStoreManagerMutation.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| "use client"; | ||
|
|
||
| import { useMutation, useQueryClient } from "@tanstack/react-query"; | ||
| import { ownerModule } from "@/shared/api/api"; | ||
|
|
||
| export const useUpgradeToStoreManagerMutation = () => { | ||
| const queryClient = useQueryClient(); | ||
|
|
||
| return useMutation({ | ||
| ...ownerModule.mutations.upgradeToStoreManager(queryClient), | ||
| }); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| // packages/api/src/domains/admin-settlement.ts | ||
|
|
||
| import type { QueryClient } from "@tanstack/react-query"; | ||
|
|
||
| import { createMutationWithCache } from "../core/mutation"; | ||
| import type { CompasserApi } from "../core/types"; | ||
| import type { | ||
| AdminSettlementCompleteReqDTO, | ||
| AdminSettlementCompleteResponse, | ||
| } from "../models/admin-settlement"; | ||
|
|
||
| export interface CompleteAdminSettlementParams { | ||
| storeId: number; | ||
| body: AdminSettlementCompleteReqDTO; | ||
| } | ||
|
|
||
| export const createAdminSettlementModule = (api: CompasserApi) => { | ||
| const keys = { | ||
| all: ["admin-settlement"] as const, | ||
| complete: (storeId: number) => [...keys.all, "complete", storeId] as const, | ||
| }; | ||
|
|
||
| const requests = { | ||
| completeSettlement: async ({ | ||
| storeId, | ||
| body, | ||
| }: CompleteAdminSettlementParams) => { | ||
| const { data } = | ||
| await api.privateClient.post<AdminSettlementCompleteResponse>( | ||
| `/admin/settlements/${storeId}/complete`, | ||
| body, | ||
| ); | ||
|
|
||
| return data; | ||
| }, | ||
| }; | ||
|
|
||
| const mutations = { | ||
| completeSettlement: (queryClient: QueryClient) => | ||
| createMutationWithCache({ | ||
| queryClient, | ||
| mutationKey: [...keys.all, "complete"], | ||
| mutationFn: requests.completeSettlement, | ||
| getActions: (response, variables) => [ | ||
| { | ||
| type: "set", | ||
| queryKey: keys.complete(variables.storeId), | ||
| value: response, | ||
| }, | ||
| { | ||
| type: "invalidate", | ||
| queryKey: keys.all, | ||
| }, | ||
| ], | ||
| }), | ||
| }; | ||
|
|
||
| return { keys, requests, mutations }; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import type { ApiResponse } from "../core/types"; | ||
|
|
||
| export interface AdminSettlementCompleteReqDTO { | ||
| reservationIds: number[]; | ||
| } | ||
|
|
||
| export interface AdminSettlementCompleteRespDTO { | ||
| storeId: number; | ||
| storeName: string; | ||
| count: number; | ||
| totalAmount: number; | ||
| message: string; | ||
| } | ||
|
|
||
| export type AdminSettlementCompleteResponse = | ||
| ApiResponse<AdminSettlementCompleteRespDTO>; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
🧩 Analysis chain
🏁 Script executed:
Repository: CUK-Compasser/FE
Length of output: 519
🏁 Script executed:
Repository: CUK-Compasser/FE
Length of output: 3646
🏁 Script executed:
Repository: CUK-Compasser/FE
Length of output: 357
🏁 Script executed:
Repository: CUK-Compasser/FE
Length of output: 331
세션 데이터 파싱과 필드 접근이 무가드라 런타임 크래시 위험이 있습니다.
Line 46에서
JSON.parse(savedPayment)가 try-catch 없이 호출되고 있어, sessionStorage 데이터가 손상된 경우 SyntaxError로 결제 성공 플로우가 깨질 수 있습니다. 또한 Line 59의parsedPayment.store.storeId중첩 접근도 파싱된 객체의 구조를 검증하지 않아 TypeScript 타입 정보가 런타임에 제거되면 런타임 에러가 발생할 수 있습니다.🔧 제안 수정안
🤖 Prompt for AI Agents