Skip to content

fix: Prisma schema 중복 UserTermsAgreement 모델 제거 - #77

Merged
evenif99 merged 8 commits into
devfrom
fix/prisma-duplicate-model
Jun 19, 2026
Merged

fix: Prisma schema 중복 UserTermsAgreement 모델 제거#77
evenif99 merged 8 commits into
devfrom
fix/prisma-duplicate-model

Conversation

@evenif99

@evenif99 evenif99 commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

Test plan

  • UserTermsAgreement 선언이 1개만 존재하는지 확인

🤖 Generated with Claude Code

Summary by CodeRabbit

릴리스 노트

  • New Features

    • 프로필 편집 기능 추가: 이메일, 닉네임, MBTI, 프로필 사진 수정 가능
    • 프로필 사진 업로드 기능 지원
    • 방 초대 시스템을 토큰 기반으로 개선
  • Documentation

    • API 명세에 프로필 업데이트 엔드포인트 추가
    • 방 초대 토큰 기반 참여 흐름 문서화

evenif99 and others added 8 commits June 19, 2026 13:01
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>
@
nickname 컬럼이 VarChar(100)이므로 검증 상한을 20자에서 100자로
수정. 서버 검증(route.ts)과 클라이언트 검증(edit page) 모두 반영.

Co-Authored-By: Claude <noreply@anthropic.com>
- Stylelint declaration-empty-line-before 규칙 위반 해소
- 프로필 이미지 업로드 시 매직 바이트 검증 추가
- 스토리지 업로드 후 DB 실패 시 보상 삭제 처리
- PATCH 요청 JSON 파싱 실패 시 400 응답 분기
- PATCH 사용자 미존재 시 404 응답 추가
- 약관 동의 createMany에 skipDuplicates 적용
- UserTermsAgreement 모델에 unique 제약 추가

Co-Authored-By: Claude <noreply@anthropic.com>
- src/stores/profileEditStore.ts 신규 생성
- page.tsx에서 useState 5개를 Zustand store로 이관
- setFieldError/clearFieldError 액션으로 에러 처리 단순화

Co-Authored-By: Claude <noreply@anthropic.com>
- isError와 !user 에러 메시지 분리
- 프로필 이미지 accept에 SVG 추가 (프론트/백엔드 동시 적용)
- errors.general 인라인 스타일을 SCSS Module 클래스로 이관

Co-Authored-By: Claude <noreply@anthropic.com>
- PATCH를 multipart/form-data 기반으로 변경
- 텍스트 필드(email, nickname, mbti) + 이미지 파일을 한 번에 처리
- Supabase Storage 업로드 로직을 PATCH에 통합
- 별도 profile-image 엔드포인트 삭제
- 프론트 hooks에서 useUploadProfileImage 제거, 단일 호출로 단순화

Co-Authored-By: Claude <noreply@anthropic.com>
merge 충돌 해결 과정에서 UserTermsAgreement 모델이 중복 삽입되고
닫는 괄호가 누락되어 Prisma validation 에러 발생.
675~691행의 중복 블록을 제거하고 68행의 정상 선언만 유지.

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

vercel Bot commented Jun 19, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
talky-owl Error Error Jun 19, 2026 6:38am

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

사용자 프로필 편집 기능(이메일/닉네임/MBTI/이미지 업로드)을 추가하고, Supabase Storage 클라이언트를 초기화합니다. 최초 로그인 시 약관 동의 레코드를 트랜잭션으로 생성하도록 변경하며 백필 스크립트도 추가합니다. 방 초대 참여 API 명세를 토큰 기반으로 전환합니다.

Changes

프로필 편집 기능

Layer / File(s) Summary
Supabase 스토리지 초기화 및 사용자 도메인 타입/상수
src/lib/storage/index.ts, .env.example, package.json, src/domains/user/api.ts, src/domains/user/constants.ts
supabaseAdmin 클라이언트와 PROFILE_IMAGES_BUCKET 상수를 초기화하고, UserProfile·UpdateProfileParams 인터페이스와 MBTI_OPTIONS 상수를 추가합니다.
사용자 API 함수 및 React Query 훅
src/domains/user/api.ts, src/domains/user/hooks.ts
fetchUserMe, updateUserProfile API 함수를 추가하고 useUserMe를 외부 모듈로 분리합니다. useUpdateProfile mutation 훅을 신규 추가하며, 성공 시 USER_ME_KEY 캐시를 무효화합니다.
프로필 편집 Zustand 스토어
src/stores/profileEditStore.ts
ProfileEditState 타입과 useProfileEditStore를 구현합니다. 필드 setter, 에러 병합 로직, reset 액션을 포함합니다.
/api/user/me GET 확장 및 PATCH 신규 구현
src/app/api/user/me/route.ts
GET 응답에 email·profileImageUrl을 추가합니다. PATCH를 새로 구현해 multipart 파싱, 필드 검증, 바이트 시그니처 기반 이미지 업로드, Prisma 부분 업데이트, 중복 에러 매핑을 처리합니다.
프로필 편집 페이지 UI 및 로직
src/app/(page)/mypage/edit/page.tsx, src/app/(page)/mypage/edit/page.module.scss
이미지 미리보기 blob 생성/해제, 클라이언트 검증, 제출 핸들러, 로딩/에러 분기 렌더링, 아바타·폼·푸터 UI를 구현합니다.

약관 동의 레코드 생성

Layer / File(s) Summary
약관 상수 및 최초 로그인 트랜잭션 변경
src/domains/auth/constants.ts, src/lib/auth/index.ts
CURRENT_TERMS_VERSIONS 상수를 추가하고, saveFirstLoginFields에서 사용자 업데이트와 userTermsAgreement.createMany를 단일 Prisma 트랜잭션으로 실행합니다.
약관 동의 백필 스크립트
scripts/backfill-user-terms-agreements.ts
termsAgreedAt이 있으나 약관 동의 레코드가 없는 사용자에게 SERVICE/PRIVACY 레코드를 일괄 생성합니다.

방 초대 API 문서 갱신

Layer / File(s) Summary
방 초대 토큰 기반 API 명세 전환
docs/API_SPEC.md
방 초대 참여 API를 POST /api/rooms/{roomId}/join에서 GET/POST /api/rooms/join/{token}으로 전환하고, 72시간 만료 정책·에러 코드·처리 정책·디렉터리 구조를 문서화합니다.

Sequence Diagram(s)

sequenceDiagram
  participant User as 사용자 (브라우저)
  participant ProfileEditPage as ProfileEditPage
  participant PATCH_API as PATCH /api/user/me
  participant SupabaseStorage as Supabase Storage
  participant Prisma as Prisma (DB)

  rect rgba(99, 179, 237, 0.5)
    Note over User,ProfileEditPage: 폼 입력 & 클라이언트 검증
    User->>ProfileEditPage: 폼 제출 (이메일/닉네임/MBTI/이미지)
    ProfileEditPage->>ProfileEditPage: 클라이언트 검증 (이메일 정규식, 닉네임 길이)
  end

  rect rgba(154, 230, 180, 0.5)
    Note over ProfileEditPage,Prisma: 서버 처리
    ProfileEditPage->>PATCH_API: multipart/form-data PATCH
    PATCH_API->>PATCH_API: formData 파싱 & 필드 검증
    alt profileImage 존재
      PATCH_API->>PATCH_API: 바이트 시그니처 검사
      PATCH_API->>SupabaseStorage: 이미지 업서트
      SupabaseStorage-->>PATCH_API: 공개 URL 반환
    end
    PATCH_API->>Prisma: user.update(변경된 필드)
    Prisma-->>PATCH_API: 업데이트된 UserProfile
    PATCH_API-->>ProfileEditPage: UserProfile 응답
  end

  rect rgba(251, 211, 141, 0.5)
    Note over ProfileEditPage,User: 캐시 갱신 & 네비게이션
    ProfileEditPage->>ProfileEditPage: invalidateQueries(USER_ME_KEY)
    ProfileEditPage->>User: router.back()
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • I5-Project/TALKY-OWL#50: src/lib/auth/index.ts의 최초 로그인 흐름(kakaoId/nickname/termsAgreedAt 저장 및 P2002 재시도 로직)이 이번 PR의 약관 동의 트랜잭션 변경과 직접 겹칩니다.
  • I5-Project/TALKY-OWL#68: /api/user/me 엔드포인트와 useUserMe 훅의 쿼리 키/소스 변경이 이 PR의 변경 내용과 동일한 데이터 흐름에 연결됩니다.
  • I5-Project/TALKY-OWL#71: SUPABASE_STORAGE_BUCKET_PROFILE_IMAGES, /api/user/me GET/PATCH 필드, 프론트엔드 페이지/훅/스토어 등 이번 PR과 동일한 파일들에서 동일한 마이페이지 편집 기능을 구현합니다.

Suggested reviewers

  • lyla-bae

Poem

🐇 토끼가 프로필을 바꿨어요!
이미지 올리고, 닉네임 수정하고,
Supabase 버킷에 쏙 저장되지요.
약관 동의도 트랜잭션 한 방에,
토큰 초대도 72시간 빵빵하게~ 🎉
수정 완료, router.back() 슝~! 🚀

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning PR 제목이 실제 변경사항과 크게 불일치합니다. 제목은 Prisma 스키마 중복 모델 제거를 언급하지만, 실제 PR은 프로필 편집, 사용자 정보 조회/수정, 약관 동의, Supabase 스토리지 등 광범위한 기능 구현을 포함하고 있습니다. PR 제목을 실제 주요 변경사항을 반영하도록 수정하세요. 예: '사용자 프로필 편집 기능 구현 및 약관 동의 백필 스크립트 추가' 또는 더 구체적인 요약으로 변경해주세요.
Description check ⚠️ Warning PR 설명이 제공된 템플릿의 필수 섹션을 대부분 누락하고 있습니다. '작업 내용', '담당 작업 영역', '관련 Issue', '변경사항' 등 핵심 섹션이 비어있거나 미완성 상태입니다. PR 설명 템플릿의 모든 필수 섹션을 작성하세요. 특히 '작업 내용', '담당 작업 영역' 체크박스 선택, '변경사항' 상세 설명, '테스트 결과' 및 '작업 범위 확인' 항목을 완성해주세요.
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.
✅ Passed checks (2 passed)
Check name Status Explanation
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/prisma-duplicate-model

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

@evenif99
evenif99 merged commit 00924a7 into dev Jun 19, 2026
1 of 3 checks passed
@evenif99
evenif99 deleted the fix/prisma-duplicate-model branch June 19, 2026 06:45
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