Skip to content

fix: api/user/me PATCH 중복 프로필 이미지 업로드 로직 제거 - #108

Merged
evenif99 merged 12 commits into
devfrom
fix/remove-duplicate-profile-upload
Jun 22, 2026
Merged

fix: api/user/me PATCH 중복 프로필 이미지 업로드 로직 제거#108
evenif99 merged 12 commits into
devfrom
fix/remove-duplicate-profile-upload

Conversation

@evenif99

@evenif99 evenif99 commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

@

Summary

  • api/user/me/route.ts PATCH 핸들러에서 프로필 이미지 업로드 로직 제거
  • 이미 api/user/me/profile-image/route.ts로 분리되어 있어 중복 코드였음
  • supabaseAdmin import, 파일 검증 상수, 이미지 시그니처 체커, 업로드 로직 삭제 (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

릴리스 노트

  • Bug Fixes
    • 사용자 프로필 업데이트 API에서 프로필 이미지 업로드 기능이 제거되었습니다. 이제 이메일, 닉네임, MBTI 정보만 업데이트할 수 있습니다.

evenif99 and others added 11 commits June 19, 2026 10:09
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>
@
@vercel

vercel Bot commented Jun 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
talky-owl Ready Ready Preview, Comment Jun 22, 2026 9:17am

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

PATCH /api/user/me 라우트에서 프로필 이미지 업로드 관련 코드가 전부 제거되었습니다. Supabase 스토리지 import, 파일 크기/타입 검증 상수, 시그니처 검증 헬퍼, 업로드 블록이 삭제되었고, PATCH 흐름의 변경 감지 조건도 이미지 필드 없이 단순화되었습니다.

Changes

PATCH /api/user/me 이미지 업로드 로직 제거

Layer / File(s) Summary
Supabase import 및 이미지 상수/헬퍼 제거
src/app/api/user/me/route.ts
supabaseAdmin, PROFILE_IMAGES_BUCKET import와 MAX_FILE_SIZE, ALLOWED_TYPES, hasAllowedImageSignature 선언을 삭제하여 외부 스토리지 의존을 완전히 제거했다.
PATCH 유효성 검사 흐름 단순화 및 업로드 블록 제거
src/app/api/user/me/route.ts
fieldErrors 반환 및 NO_CHANGES 분기에서 profileImage 조건을 제거하고, 바이트 변환 → 시그니처 검증 → 스토리지 업로드 → 공개 URL 생성 블록을 삭제하여 prisma.user.update로 바로 진행하도록 변경했다.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐇 토끼가 코드를 살펴보니,
이미지 업로드가 스르륵 사라졌네.
Supabase도, 시그니처도 안녕~
PATCH 흐름이 날아갈 듯 가벼워졌어!
🌸 간결함이 최고의 아름다움이라네.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive PR 설명이 필수 템플릿의 대부분 섹션을 채우지 않았으나, Summary와 Test plan을 제공하여 변경사항의 목적과 검증 방법을 명확히 설명하고 있습니다. 작업 내용, 담당 영역, 관련 Issue, 변경 사항, 작업 범위 확인 등 필수 섹션을 템플릿에 맞춰 작성하면 더 명확한 PR 문서화가 가능합니다.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed 제목이 PR의 주요 변경사항을 명확하게 요약하고 있습니다. PATCH 핸들러에서 중복된 프로필 이미지 업로드 로직을 제거했다는 내용을 정확하게 전달합니다.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/remove-duplicate-profile-upload

Comment @coderabbitai help to get the list of available commands and usage tips.

merge: dev 브랜치 병합 및 conflict 해결

dev 브랜치의 auth 방식 변경(getRequestUserId)을 수용하면서
프로필 이미지 업로드 중복 제거 변경 유지.

Co-Authored-By: Claude <noreply@anthropic.com>
@

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

PATCH 입력 계약이 깨져 profileImage가 누락/무시됩니다.

Line 130의 NO_CHANGES 판단이 data(email/nickname/mbti)만 기준이라, 현재 클라이언트가 보내는 profileImage 입력과 계약이 어긋납니다.
src/domains/user/api.tssrc/app/(page)/mypage/edit/page.tsx는 아직 PATCH /api/user/meprofileImage를 보내므로, 이미지 단독 수정은 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

📥 Commits

Reviewing files that changed from the base of the PR and between 19916c2 and 9670696.

📒 Files selected for processing (1)
  • src/app/api/user/me/route.ts

@evenif99 evenif99 self-assigned this Jun 22, 2026
@evenif99
evenif99 merged commit 96b439c into dev Jun 22, 2026
3 checks passed
@evenif99
evenif99 deleted the fix/remove-duplicate-profile-upload branch June 22, 2026 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant