정산 내역 수정 기능 추가#61
Conversation
- 로더에서 인증, MANAGER 역할, 입금 요청 존재 여부 순차 검증 - payment.exists(), getGroupDetail()은 Promise.all로 병렬 호출
- MANAGER 역할일 때만 헤더에 관리 드롭다운 표시 - 정산 내역 수정 전 입금 요청 존재 여부 확인 후 분기
📝 WalkthroughWalkthrough정산 수정 기능을 위한 라우팅, 액세스 제어, 다단계 UI 페이지, 그리고 지출 상세 페이지의 관리 메뉴 드롭다운을 추가합니다. 승인 역할만 접근 가능하며, 진행 중인 정산이 있으면 차단됩니다. Changes정산 내역 수정 및 관리 메뉴 기능
Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
📝 관련 이슈 |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
🧹 Nitpick comments (3)
src/pages/editExpenses/loader.ts (2)
37-37: ⚡ Quick win리다이렉트 경로에 ROUTE 상수 사용 권장.
정산 상세 페이지로 리다이렉트하는 경로가 여러 곳에서 하드코딩되어 있습니다.
ROUTE.expenseDetail을 사용하면 라우트 경로 변경 시 유지보수가 용이합니다.♻️ 제안하는 수정
if (myProfile.role !== 'MANAGER') { - return redirect(`/expense-detail/${groupToken}`); + return redirect(ROUTE.expenseDetail.replace(':groupToken', groupToken)); } // ... if (exists) { - return redirect(`/expense-detail/${groupToken}`); + return redirect(ROUTE.expenseDetail.replace(':groupToken', groupToken)); }Also applies to: 47-47
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/pages/editExpenses/loader.ts` at line 37, The redirect call in loader.ts is hardcoding the expense detail path; replace the literal string in both occurrences (the redirect(`/expense-detail/${groupToken}`) calls) with the ROUTE constant (use ROUTE.expenseDetail and inject groupToken appropriately) so route changes are centralized; update both occurrences (lines referencing redirect with groupToken) to construct the URL via ROUTE.expenseDetail instead of the hardcoded string.
22-25: ⚡ Quick win
returnUrl생성 시 ROUTE 상수 사용 권장.현재 경로를 직접 하드코딩하고 있습니다.
ROUTE.editExpenses를 활용하면 라우트 경로 변경 시 일관성을 유지할 수 있습니다.♻️ 제안하는 수정
if (!auth?.authenticated) { const returnUrl = encodeURIComponent( - `/expense-detail/${groupToken}/edit-expenses` + ROUTE.editExpenses.replace(':groupToken', groupToken) ); return redirect(`/login?returnUrl=${returnUrl}`);🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/pages/editExpenses/loader.ts` around lines 22 - 25, Use the ROUTE constant instead of hardcoding the path when building returnUrl: replace the literal string `/expense-detail/${groupToken}/edit-expenses` with a template based on ROUTE.editExpenses (or appropriate ROUTE key) and interpolate groupToken into that route before calling encodeURIComponent and redirect; update the expression that assigns returnUrl (and its use in redirect(`/login?returnUrl=${returnUrl}`)) to reference ROUTE.editExpenses to keep routes consistent.src/entities/payment/api/payment.ts (1)
24-27: 💤 Low value파라미터 이름 일관성 고려.
기존
create메서드(line 21)는code파라미터를 사용하지만, 새로 추가된exists메서드는groupCode를 사용합니다. 더 명확한groupCode로 통일하거나, 기존 컨벤션을 따르는 것이 일관성 측면에서 좋습니다.♻️ 일관성을 위한 제안
기존
create메서드도 함께 리팩토링하는 경우:- create: (code: string): Promise<PaymentActionResult> => - axiosInstance.post(`/groups/${code}/payments`).then((res) => res.data), + create: (groupCode: string): Promise<PaymentActionResult> => + axiosInstance.post(`/groups/${groupCode}/payments`).then((res) => res.data),또는 기존 컨벤션을 따르는 경우:
- exists: (groupCode: string): Promise<{ exists: boolean }> => + exists: (code: string): Promise<{ exists: boolean }> => axiosInstance - .get(`/groups/${groupCode}/payments/exists`) + .get(`/groups/${code}/payments/exists`) .then((res) => res.data),🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/entities/payment/api/payment.ts` around lines 24 - 27, Unify the parameter name between the payment API methods: rename the parameter in exists to match the existing create method (or update both to use groupCode) so they’re consistent; locate the exists function and the create function in src/entities/payment/api/payment.ts and change their parameter identifier (and any internal references) to the chosen name (e.g., groupCode or code) and update the axios path/template argument accordingly so both methods use the same parameter name.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@src/entities/payment/api/payment.ts`:
- Around line 24-27: Unify the parameter name between the payment API methods:
rename the parameter in exists to match the existing create method (or update
both to use groupCode) so they’re consistent; locate the exists function and the
create function in src/entities/payment/api/payment.ts and change their
parameter identifier (and any internal references) to the chosen name (e.g.,
groupCode or code) and update the axios path/template argument accordingly so
both methods use the same parameter name.
In `@src/pages/editExpenses/loader.ts`:
- Line 37: The redirect call in loader.ts is hardcoding the expense detail path;
replace the literal string in both occurrences (the
redirect(`/expense-detail/${groupToken}`) calls) with the ROUTE constant (use
ROUTE.expenseDetail and inject groupToken appropriately) so route changes are
centralized; update both occurrences (lines referencing redirect with
groupToken) to construct the URL via ROUTE.expenseDetail instead of the
hardcoded string.
- Around line 22-25: Use the ROUTE constant instead of hardcoding the path when
building returnUrl: replace the literal string
`/expense-detail/${groupToken}/edit-expenses` with a template based on
ROUTE.editExpenses (or appropriate ROUTE key) and interpolate groupToken into
that route before calling encodeURIComponent and redirect; update the expression
that assigns returnUrl (and its use in
redirect(`/login?returnUrl=${returnUrl}`)) to reference ROUTE.editExpenses to
keep routes consistent.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 7d53237a-5584-426c-8716-b6678db27a2a
📒 Files selected for processing (10)
src/app/Router.tsxsrc/entities/payment/api/payment.tssrc/pages/editExpenses/EditExpensesPage.tsxsrc/pages/editExpenses/index.tssrc/pages/editExpenses/loader.tssrc/pages/expenseDetail/ExpenseDetailPage.styles.tssrc/pages/expenseDetail/ExpenseDetailPage.tsxsrc/pages/expenseDetail/ui/ManageMenu/index.styles.tssrc/pages/expenseDetail/ui/ManageMenu/index.tsxsrc/shared/config/route.ts
ongheong
left a comment
There was a problem hiding this comment.
정연님 코드 및 동작 확인했습니다!
매니저/참여자 역할에 따른 관리 버튼 노출 여부와, GET payments/exists 응답에 따라 정산 수정 페이지 진입을 나누고 편집 후 정산 상세 페이지로 돌아오는 흐름까지 확인했습니다.
프론트 로직은 문제 없어 보이고, 백엔드 응답만 한 번 확인이 필요할 것 같습니다.
현재 정산 완료된 참여자가 있어도 exists: false로 내려오는 경우가 있어서,payments/exists가 입금 확인 요청뿐만 아니라 정산 완료된 참여자까지 포함해서 체크하는지 확인하면 좋을 것 같습니다!
|
@ongheong 확인감사합니다!!!!! 백엔드 응답 관련해서는 좀있다가 지윤님께 여쭤보면 될 것 같아요 😢 우선 이 PR은 머지하겠습니다!!! |
💻 작업 내용
총무가 정산 상세 페이지에서 정산 내역을 수정할 수 있는 기능을 추가했습니다.
헤더 관리 드롭다운 (ManageMenu)
payment.exists()호출정산 내역 수정 페이지 (editExpenses)
useFunnel로 confirm / add / edit 스텝 구성 (기존 CreateExpensePage 컴포넌트 재사용)✅ 테스트 리스트
📸 스크린샷
👻 리뷰 요구사항
정산 생성 단계에서 사용하던 페이지들을 모두 재사용해서 정산 확인/추가/수정 로직은 그대로입니다!!
정산 수정 로직이 의도한대로 잘 동작하는지 동작 위주로 리뷰해주시면 감사하겠습니다...
그리고 여은님이 작업하시는 부분인 "계좌 수정" 기능으로 진입하는 부분도 만들어둬서 그 부분도 확인 부탁드립니다!! (src/pages/expenseDetail/ui/ManageMenu/index.tsx 의 TODO 주석)
Summary by CodeRabbit
릴리스 노트