feat: name/nickname 표시 정책 적용 - #74
Conversation
- 로그인 시 user_terms_agreements 테이블에 service, privacy 약관 동의 레코드 자동 생성 - saveFirstLoginFields에서 $transaction으로 유저 업데이트와 약관 동의 레코드 생성을 원자적 처리 - 약관 버전 상수 정의 (날짜 기반: 2026-06-18) - 기존 유저 대상 backfill 스크립트 추가 (scripts/backfill-user-terms-agreements.ts) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- API 라우트 디렉토리 이동 (src/app/api/user/me → src/app/api/users/me) - domains/user/hooks.ts 내 API 호출 경로 일괄 수정 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add name field priority across the application: display name when available, fall back to nickname otherwise. Implement profile edit page with name, nickname, and MBTI fields. Remove hardcoded values from mypage main. - GET/PATCH /api/users/me: add name field to response and request - HomeGreeting: use name ?? nickname for greeting - MyPage main: replace hardcoded nickname/MBTI with useUserMe data - Profile edit page: full form with name, nickname, MBTI, avatar - API_SPEC.md: update GET/PATCH docs with name field Co-Authored-By: Claude <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughAPI 스펙에 사용자 Changesname 필드 추가 및 표시 우선순위 적용
감사 및 접근 로그 기록 제거
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25분 Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
- src/app/api/user/me/route.ts: dev 버전 유지 (프로필 이미지 업로드 포함) - src/app/api/users/me/route.ts: dev 버전 유지 - src/app/(page)/mypage/edit/page.tsx: dev 버전 유지 (profileEditStore 사용) - src/app/(page)/mypage/edit/page.module.scss: dev 버전 유지 - src/domains/user/hooks.ts: dev 버전 유지 (api 모듈 import 구조) - src/domains/user/constants.ts: dev 버전 유지 (없음 옵션 포함) - src/lib/auth/index.ts: 양쪽 변경사항 병합 (user.name 체크 + skipDuplicates) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Deployment failed with the following error: Learn More: https://vercel.com/lsgs-projects-34d31fd6?upgradeToPro=build-rate-limit |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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.
Inline comments:
In `@docs/API_SPEC.md`:
- Around line 336-337: The API specification document defines "name" and
"nickname" fields in the GET response contract (lines 336-337 and 358), but the
implementation in the route handler (src/app/api/users/me/route.ts at lines
8-41) does not retrieve or return these fields. Update the route handler to
query and include the "name" and "nickname" fields in the response object so
that the actual implementation matches the API specification contract.
- Around line 375-376: The PATCH request/response specification in the
API_SPEC.md file defines name as a 1-50 character optional field and nickname as
a 2-20 character optional field, but the PATCH handler in the user/me route does
not match these constraints. Update the PATCH handler in
src/app/api/user/me/route.ts to add validation for the name field (1-50
characters) and fix the nickname validation to enforce a 2-20 character range
instead of the current 2-100 character range to align the implementation with
the documented API specification.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: e3b59962-16a7-411d-b40c-d46fef9597df
📒 Files selected for processing (4)
docs/API_SPEC.mdsrc/app/(page)/mypage/page.tsxsrc/components/home/HomeGreeting.tsxsrc/lib/auth/index.ts
| "name": "string | null", | ||
| "nickname": "string | null", |
There was a problem hiding this comment.
GET 응답 명세와 실제 구현 DTO가 불일치합니다.
Line 336-337, Line 358에서 name을 응답 계약에 추가했지만, 제공된 구현 스니펫(src/app/api/users/me/route.ts:8-41)은 name을 조회/반환하지 않습니다. 현재 상태면 name 우선 표시 정책이 서버 응답에서 성립하지 않습니다.
예시 수정안 (서버 구현 동기화)
interface UserMeDto {
id: string
+ name: string | null
nickname: string | null
mbti: string | null
}
const user = await prisma.user.findUnique({
where: { id: userId },
- select: { id: true, nickname: true, mbti: true },
+ select: { id: true, name: true, nickname: true, mbti: true },
})
return NextResponse.json<ApiResponse<UserMeDto>>({
success: true,
- data: { id: user.id, nickname: user.nickname, mbti: user.mbti },
+ data: { id: user.id, name: user.name, nickname: user.nickname, mbti: user.mbti },
})Also applies to: 358-358
🤖 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 `@docs/API_SPEC.md` around lines 336 - 337, The API specification document
defines "name" and "nickname" fields in the GET response contract (lines 336-337
and 358), but the implementation in the route handler
(src/app/api/users/me/route.ts at lines 8-41) does not retrieve or return these
fields. Update the route handler to query and include the "name" and "nickname"
fields in the response object so that the actual implementation matches the API
specification contract.
| "name": "string (optional, 1~50자)", | ||
| "nickname": "string (optional, 2~20자)", |
There was a problem hiding this comment.
PATCH 요청/응답 명세가 현재 서버 검증 로직과 맞지 않습니다.
Line 375-376, Line 390-391 기준으로 name(1~50) 및 nickname(2~20) 계약을 명시했지만, 제공된 PATCH 스니펫(src/app/api/user/me/route.ts:103-141)은 name을 처리하지 않고 nickname을 2~100자로 검증합니다. 명세-구현 간 계약 불일치로 클라이언트/서버 통합 오류가 발생할 수 있습니다.
Also applies to: 390-391
🤖 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 `@docs/API_SPEC.md` around lines 375 - 376, The PATCH request/response
specification in the API_SPEC.md file defines name as a 1-50 character optional
field and nickname as a 2-20 character optional field, but the PATCH handler in
the user/me route does not match these constraints. Update the PATCH handler in
src/app/api/user/me/route.ts to add validation for the name field (1-50
characters) and fix the nickname validation to enforce a 2-20 character range
instead of the current 2-100 character range to align the implementation with
the documented API specification.
- UserMeDto, UserProfile 타입에 name 필드 추가 - GET/PATCH /api/user/me select 및 응답에 name 포함 - Prisma schema에 모델이 없는 prisma.auditLog, prisma.roomAccessLog 호출 제거 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Deployment failed with the following error: Learn More: https://vercel.com/lsgs-projects-34d31fd6?upgradeToPro=build-rate-limit |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/app/api/user/me/route.ts (2)
138-138:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winnickname 최대 길이 검증이 API 스펙과 불일치합니다.
API 스펙에서 nickname은 2~20자로 명세화되었으나, 현재 코드는 최대 100자까지 허용하고 있습니다. 이는 API 계약 위반이며 데이터 제약 조건과 맞지 않습니다.
🔧 최대 길이 수정 제안
- if (!trimmed || trimmed.length < 2 || trimmed.length > 100) { - fieldErrors.push({ field: 'nickname', code: 'INVALID_NICKNAME', message: '닉네임은 2~100자로 입력해주세요.' }) + if (!trimmed || trimmed.length < 2 || trimmed.length > 20) { + fieldErrors.push({ field: 'nickname', code: 'INVALID_NICKNAME', message: '닉네임은 2~20자로 입력해주세요.' })🤖 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/app/api/user/me/route.ts` at line 138, The nickname maximum length validation in the route handler is using 100 characters as the upper limit, but according to the API specification, nickname should be limited to a maximum of 20 characters. Update the length check condition in the validation statement where trimmed.length is compared against 100, changing it to 20 to align with the documented API specification of 2-20 character range for nickname.
125-155:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winPATCH 핸들러에서 name 필드 처리가 누락되었습니다.
API 스펙에서 PATCH /api/users/me 요청 바디에 name 필드(1~50자)를 명세화했지만, 현재 PATCH 핸들러는 formData에서 name 필드를 전혀 처리하지 않습니다. email, nickname, mbti, profileImage는 처리하지만 name이 빠져있어 사용자가 프로필 수정 폼에서 이름을 업데이트할 수 없습니다.
name 필드 처리 로직을 추가해야 합니다.
🔧 name 필드 처리 추가 제안
nickname 처리 블록 이후에 name 처리 로직을 추가하세요:
} } + const nameValue = formData.get('name') + if (nameValue !== null) { + const trimmed = String(nameValue).trim() + if (!trimmed || trimmed.length < 1 || trimmed.length > 50) { + fieldErrors.push({ field: 'name', code: 'INVALID_NAME', message: '이름은 1~50자로 입력해주세요.' }) + } else { + data.name = trimmed + } + } + const mbtiValue = formData.get('mbti') if (mbtiValue !== null) {🤖 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/app/api/user/me/route.ts` around lines 125 - 155, The PATCH handler in the user/me/route.ts is missing validation and processing for the name field, which is required by the API specification with a length constraint of 1-50 characters. Add name field handling logic after the nickname processing block by retrieving the 'name' value from formData, validating that it exists and meets the 1-50 character length requirement, then either pushing a field error with code 'INVALID_NAME' to fieldErrors if validation fails, or assigning the trimmed name to data.name if validation succeeds. Follow the same pattern used for nickname and email field processing.
🤖 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.
Outside diff comments:
In `@src/app/api/user/me/route.ts`:
- Line 138: The nickname maximum length validation in the route handler is using
100 characters as the upper limit, but according to the API specification,
nickname should be limited to a maximum of 20 characters. Update the length
check condition in the validation statement where trimmed.length is compared
against 100, changing it to 20 to align with the documented API specification of
2-20 character range for nickname.
- Around line 125-155: The PATCH handler in the user/me/route.ts is missing
validation and processing for the name field, which is required by the API
specification with a length constraint of 1-50 characters. Add name field
handling logic after the nickname processing block by retrieving the 'name'
value from formData, validating that it exists and meets the 1-50 character
length requirement, then either pushing a field error with code 'INVALID_NAME'
to fieldErrors if validation fails, or assigning the trimmed name to data.name
if validation succeeds. Follow the same pattern used for nickname and email
field processing.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: a8807f35-b496-4b8b-9bbf-6feb0ddad983
📒 Files selected for processing (4)
src/app/api/rooms/[id]/invite/route.tssrc/app/api/rooms/join/[token]/route.tssrc/app/api/user/me/route.tssrc/domains/user/api.ts
💤 Files with no reviewable changes (2)
- src/app/api/rooms/[id]/invite/route.ts
- src/app/api/rooms/join/[token]/route.ts
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
변경 파일
docs/API_SPEC.md— GET/PATCH 응답 스펙에 name 필드 추가src/app/(page)/mypage/edit/page.tsx— 프로필 수정 폼 (name, nickname, MBTI)src/app/(page)/mypage/edit/page.module.scss— 수정 페이지 스타일src/app/(page)/mypage/page.tsx— 하드코딩 제거, useUserMe 동적 표시src/components/home/HomeGreeting.tsx— name ?? nickname 우선순위 적용src/domains/user/constants.ts— MBTI 옵션 상수Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit
릴리스 노트
name(null 허용) 필드 추가name우선, 없으면nickname표시