Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
설정 화면에 기본 설정(가계부 이름/목표 문구/회계기준일) 섹션을 추가하고, 현재 값을 로드(GET) 및 저장(PATCH)할 수 있도록 UI와 API 연동을 구현한 PR입니다. 이와 함께 회계기준일(1~28) 프론트 검증 및 저장 성공 스낵바 노출을 포함합니다.
Changes:
- 설정 탭에 기본 설정(BASIC) 섹션 및 입력 폼 UI 추가
GET /api/ledgers/:ledgerId로 기본 설정 로드 +PATCH /api/ledgers/:ledgerId로 저장 연동- 회계기준일 1~28 범위 검증 및 저장 성공 스낵바 노출, task 상태 업데이트
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| memories/task.md | [4-6] 작업 상태를 완료로 갱신하고 진행 메모/체크리스트 반영 |
| apps/web/src/routes/settings.tsx | 기본 설정 섹션 UI 추가, ledger 상세 로드/저장(PATCH) 및 검증/성공 스낵바 연동 |
Comment on lines
+407
to
+414
| const response = await apiFetch(`/api/ledgers/${ledgerId}`, { | ||
| method: 'PATCH', | ||
| headers: { 'Content-Type': 'application/json' }, | ||
| body: JSON.stringify({ | ||
| bookName, | ||
| goal: basicGoal.trim(), | ||
| fiscalStartDay, | ||
| }), |
There was a problem hiding this comment.
(P2) 저장 요청 바디에 goal을 항상 basicGoal.trim()으로 포함시키고 있어, 서버에 goal이 null인 상태에서 사용자가 목표 문구를 수정하지 않고 저장만 눌러도 goal이 빈 문자열("")로 덮어써집니다. goal의 null/"" 의미를 구분하거나(예: null=미설정), 불필요한 필드 변경을 피하려면 값이 비어 있을 때는 goal 필드를 전송에서 제외(예: undefined로 두어 JSON 직렬화 시 생략)하거나, '비움'을 지원해야 한다면 API가 goal: null을 허용하도록 맞춰서 명시적으로 null을 보내는 방식으로 정리하는 편이 안전합니다.
Suggested change
| const response = await apiFetch(`/api/ledgers/${ledgerId}`, { | |
| method: 'PATCH', | |
| headers: { 'Content-Type': 'application/json' }, | |
| body: JSON.stringify({ | |
| bookName, | |
| goal: basicGoal.trim(), | |
| fiscalStartDay, | |
| }), | |
| const goal = basicGoal.trim() | |
| const payload: { bookName: string; fiscalStartDay: number; goal?: string } = { | |
| bookName, | |
| fiscalStartDay, | |
| } | |
| if (goal !== '') { | |
| payload.goal = goal | |
| } | |
| const response = await apiFetch(`/api/ledgers/${ledgerId}`, { | |
| method: 'PATCH', | |
| headers: { 'Content-Type': 'application/json' }, | |
| body: JSON.stringify(payload), |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
작업 내용
기본 설정섹션 추가GET /api/ledgers/:ledgerId로 현재 기본 설정 로드PATCH /api/ledgers/:ledgerId저장 연결md이상)에서는 뒤로가기 헤더 미노출memories/task.md의 [4-6], [4-7] 상태를 완료로 업데이트검증
vite/tsc실행은 불가하여 런타임 검증은 미실시Closes #60
Closes #61