fix: api/user/me PATCH 중복 프로필 이미지 업로드 로직 제거 - #108
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
feat(user): 마이페이지 프로필 편집 및 이미지 업로드 구현 - 마이페이지 편집 페이지 UI 및 프로필 수정 로직 구현 - 프로필 이미지 업로드 API (Supabase Storage 연동) - user/me API에 PATCH 메서드 추가 (닉네임, MBTI 수정) - user 도메인 API client, hooks, constants 구성 - auth constants 및 lib/storage 유틸 추가 - API 명세서 업데이트 - dev 최신 반영 (사건기록, 홈 화면 개선) Co-Authored-By: Claude <noreply@anthropic.com> @
# Conflicts: # src/app/(page)/mypage/edit/page.module.scss # src/app/(page)/mypage/edit/page.tsx # src/app/api/user/me/route.ts # src/domains/user/api.ts # src/domains/user/hooks.ts # src/lib/auth/index.ts
동일 카카오 계정으로 user 레코드가 중복 생성된 경우, 기존 유저의 kakao_id를 null로 정리 후 현재 유저에 저장하도록 수정 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix(api): Remove duplicate profile image upload logic from user/me PATCH Profile image upload was handled in both api/user/me PATCH and the dedicated api/user/me/profile-image POST endpoint. Remove the duplicate code from PATCH including supabaseAdmin import, file validation constants, image signature checker, and upload logic. Co-Authored-By: Claude <noreply@anthropic.com> @
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthrough
ChangesPATCH /api/user/me 이미지 업로드 로직 제거
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ 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 |
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 (1)
src/app/api/user/me/route.ts (1)
130-134:⚠️ Potential issue | 🟠 Major | ⚡ Quick winPATCH 입력 계약이 깨져
profileImage가 누락/무시됩니다.Line 130의
NO_CHANGES판단이data(email/nickname/mbti)만 기준이라, 현재 클라이언트가 보내는profileImage입력과 계약이 어긋납니다.
src/domains/user/api.ts와src/app/(page)/mypage/edit/page.tsx는 아직PATCH /api/user/me에profileImage를 보내므로, 이미지 단독 수정은 400(NO_CHANGES), 다른 필드와 동시 수정은 200이지만 이미지 반영이 누락되는 침묵 실패가 발생합니다.
PATCH에서profileImage를 명시적으로 거절(전용 엔드포인트 안내)하거나, 클라이언트를POST /api/user/me/profile-image로 동시에 전환해 API 계약을 맞춰야 합니다.제안 패치 (침묵 실패 방지 가드)
export async function PATCH(request: NextRequest) { @@ const data: Record<string, string | null> = {} const fieldErrors: { field: string; code: string; message: string }[] = [] + const profileImageValue = formData.get('profileImage') + + if (profileImageValue !== null) { + return NextResponse.json<ApiResponse>( + { + success: false, + error: { + code: 'PROFILE_IMAGE_ENDPOINT_CHANGED', + message: '프로필 이미지는 /api/user/me/profile-image 엔드포인트를 사용해주세요.', + }, + }, + { status: 400 }, + ) + } @@ if (Object.keys(data).length === 0) {🤖 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 130 - 134, The NO_CHANGES validation at line 130 only checks if data (email/nickname/mbti) is empty but doesn't account for the profileImage field that clients are still sending, causing silent failures when profileImage changes are ignored or returning NO_CHANGES when only profileImage is provided. You need to either explicitly reject the profileImage field in the PATCH handler with guidance to use a dedicated endpoint, or include profileImage in the data validation logic to ensure proper handling aligned with the client's current expectations.
🤖 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`:
- Around line 130-134: The NO_CHANGES validation at line 130 only checks if data
(email/nickname/mbti) is empty but doesn't account for the profileImage field
that clients are still sending, causing silent failures when profileImage
changes are ignored or returning NO_CHANGES when only profileImage is provided.
You need to either explicitly reject the profileImage field in the PATCH handler
with guidance to use a dedicated endpoint, or include profileImage in the data
validation logic to ensure proper handling aligned with the client's current
expectations.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: CHILL
Plan: Pro Plus
Run ID: f15b6b66-a038-47ab-984c-ab997d97207f
📒 Files selected for processing (1)
src/app/api/user/me/route.ts
@
Summary
api/user/me/route.tsPATCH 핸들러에서 프로필 이미지 업로드 로직 제거api/user/me/profile-image/route.ts로 분리되어 있어 중복 코드였음supabaseAdminimport, 파일 검증 상수, 이미지 시그니처 체커, 업로드 로직 삭제 (78줄 제거)Test plan
GET /api/user/me정상 동작 확인PATCH /api/user/me닉네임/이메일/MBTI 수정 정상 동작 확인POST /api/user/me/profile-image프로필 이미지 업로드 정상 동작 확인🤖 Generated with Claude Code
@
Summary by CodeRabbit
릴리스 노트