Skip to content

fix: Prisma schema 중복 모델 제거 및 빌드 에러 수정 - #76

Closed
evenif99 wants to merge 9 commits into
devfrom
fix/prisma-duplicate-model
Closed

evenif99 wants to merge 9 commits into
devfrom
fix/prisma-duplicate-model

Conversation

@evenif99

@evenif99 evenif99 commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • prisma/schema.prisma: merge 충돌로 인한 중복 UserTermsAgreement 모델 제거
  • page.module.scss: 존재하지 않는 text-body2 mixin → text-body-s로 수정
  • seed.ts: ConflictTypeGroup 생성 추가 및 groupId 연결
  • judge/route.ts, result/route.ts: resultConflictGroup include 추가
  • judgment.mapper.ts: resultConflictGroup 매핑 추가
  • types/judgment.ts: ConflictTypeGroupDto, cardImageUrl 필드 추가

Test plan

  • npx tsc --noEmit 타입 체크 통과
  • npm run build 빌드 통과
  • 로컬 실행 확인

🤖 Generated with Claude Code

Summary by CodeRabbit

릴리스 노트

  • New Features

    • 프로필 편집 기능 추가: 이메일, 닉네임, MBTI, 프로필 이미지 수정 가능
    • 토큰 기반 방 초대/참여 시스템 전환: 초대 링크 72시간 유효
  • Bug Fixes

    • 약관 동의 기록 추적 및 검증 개선

evenif99 and others added 9 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 conflict resolution left a duplicate UserTermsAgreement model
at line 679 with a missing closing brace, causing the model to merge
into the following enum and triggering a Prisma validation error.

Remove the duplicate block; the canonical declaration at line 68
already includes the @@unique constraint.

Co-Authored-By: Claude <noreply@anthropic.com>
- prisma/schema.prisma: 중복 UserTermsAgreement 모델 제거
- page.module.scss: 존재하지 않는 text-body2 mixin을 text-body-s로 수정
- seed.ts: ConflictTypeGroup 생성 추가 및 groupId 연결
- judge/route.ts, result/route.ts: resultConflictGroup include 추가
- judgment.mapper.ts: resultConflictGroup 매핑 추가
- types/judgment.ts: ConflictTypeGroupDto, cardImageUrl 필드 추가

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 Ready Ready Preview, Comment Jun 19, 2026 6:35am

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro Plus

Run ID: e2039a6d-a715-4a3c-b96f-00c98aa092f1

📥 Commits

Reviewing files that changed from the base of the PR and between c59c87d and c3e7857.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (21)
  • .env.example
  • docs/API_SPEC.md
  • package.json
  • prisma/seed.ts
  • scripts/backfill-user-terms-agreements.ts
  • src/app/(page)/mypage/edit/page.module.scss
  • src/app/(page)/mypage/edit/page.tsx
  • src/app/api/disputes/[id]/judge/route.ts
  • src/app/api/disputes/[id]/result/route.ts
  • src/app/api/user/me/route.ts
  • src/domains/auth/.gitkeep
  • src/domains/auth/constants.ts
  • src/domains/judgement/judgment.mapper.ts
  • src/domains/user/.gitkeep
  • src/domains/user/api.ts
  • src/domains/user/constants.ts
  • src/domains/user/hooks.ts
  • src/lib/auth/index.ts
  • src/lib/storage/index.ts
  • src/stores/profileEditStore.ts
  • src/types/judgment.ts

📝 Walkthrough

워크스루

Supabase Storage를 이용한 프로필 이미지 업로드를 포함한 마이페이지 편집 기능 전체 스택(API 라우트·훅·상태 저장소·UI)을 추가하고, 최초 로그인 시 약관 동의 레코드를 트랜잭션으로 생성하는 흐름을 도입했습니다. 분쟁 AI 판결 DTO에 resultConflictGroup을 포함하도록 확장하고, 씨드/백필 스크립트와 방 초대 토큰 기반 API 문서를 갱신했습니다.

변경 사항

마이페이지 프로필 편집 기능

Layer / File(s) 요약
Supabase Storage 클라이언트 및 환경변수 설정
src/lib/storage/index.ts, .env.example, package.json
supabaseAdmin 클라이언트와 PROFILE_IMAGES_BUCKET 상수를 신규 파일로 내보내고, 환경변수 키와 @supabase/supabase-js 의존성을 추가.
UserProfile / UpdateProfileParams 타입 및 클라이언트 API 함수
src/domains/user/api.ts, src/domains/user/constants.ts
UserProfile, UpdateProfileParams 인터페이스와 fetchUserMe, updateUserProfile 함수를 추가하고 MBTI_OPTIONS 상수를 정의.
/api/user/me GET/PATCH 서버 라우트 확장
src/app/api/user/me/route.ts
GET에 email/profileImageUrl 반환 추가, PATCH는 FormData 파싱·이메일·닉네임·MBTI·이미지 시그니처 검증·Supabase Storage 업로드(upsert)·Prisma 업데이트·중복 409 분기 처리를 포함한 전체 흐름으로 확장.
useUpdateProfile 훅 및 profileEditStore
src/domains/user/hooks.ts, src/stores/profileEditStore.ts
USER_ME_KEY 추가, useUserMe 외부 API 이관, useUpdateProfile 뮤테이션 훅(성공 시 캐시 무효화) 신규 추가, Zustand useProfileEditStore로 폼 필드/에러 상태 관리.
마이페이지 편집 페이지 UI 및 스타일
src/app/(page)/mypage/edit/page.tsx, src/app/(page)/mypage/edit/page.module.scss
ProfileEditPage 전체 구현: 로딩/에러/부재 분기, 이미지 프리뷰 blob URL 생성·해제, 폼 검증, 제출 핸들러(성공 시 router.back, 실패 시 필드별 에러 매핑), SCSS 레이아웃 추가.

약관 동의 레코드 처리

Layer / File(s) 요약
CURRENT_TERMS_VERSIONS 상수 정의
src/domains/auth/constants.ts
SERVICE/PRIVACY 약관의 type·version·isRequired를 고정값으로 정의하는 상수 추가.
최초 로그인 시 약관 동의 트랜잭션 저장
src/lib/auth/index.ts
saveFirstLoginFieldsprisma.$transaction으로 변경해 user 업데이트와 userTermsAgreement createMany(skipDuplicates)를 원자적으로 처리.
기존 사용자 약관 동의 백필 스크립트
scripts/backfill-user-terms-agreements.ts
termsAgreedAt은 있으나 termsAgreements가 없는 사용자를 조회해 SERVICE/PRIVACY 레코드를 일괄 삽입하는 일회성 스크립트 추가.

AI 판결 resultConflictGroup 포함 확장

Layer / File(s) 요약
ConflictTypeGroupDto 타입 및 매핑 확장
src/types/judgment.ts, src/domains/judgement/judgment.mapper.ts
ConflictTypeGroupDto 인터페이스 추가, AiJudgmentDtoresultConflictGroup 필드 추가, AiJudgmentWithRelations include 확장, characterAssetId로 매핑 소스 변경.
판결 API 라우트 include 확장
src/app/api/disputes/[id]/judge/route.ts, src/app/api/disputes/[id]/result/route.ts
judge/result 라우트의 aiJudgment 조회 include에 resultConflictGroup: true 추가.

시드 데이터 및 API 문서 갱신

Layer / File(s) 요약
conflictTypeGroup 시드 및 연결
prisma/seed.ts
conflictTypeGroup 4개를 먼저 생성하고 conflictTypeDetail 각각에 groupId를 연결.
방 참여 API 토큰 기반 명세 확정
docs/API_SPEC.md
방 참여 엔드포인트를 POST /api/rooms/{roomId}/join에서 GET/POST /api/rooms/join/{token}으로 전환하고, 72시간 만료 정책·에러 코드·라우트 트리를 문서에 반영.

시퀀스 다이어그램

sequenceDiagram
  participant Client as ProfileEditPage
  participant Route as PATCH /api/user/me
  participant Supabase as Supabase Storage
  participant DB as Prisma DB

  Client->>Route: FormData(email, nickname, mbti, profileImage)
  Route->>Route: 입력값 검증(이메일 정규식, 닉네임 길이, MBTI, 이미지 시그니처)
  alt 이미지 포함 시
    Route->>Route: 매직 넘버 재검증
    Route->>Supabase: storage.upload upsert(profileImage)
    Supabase-->>Route: 공개 URL + 타임스탬프 쿼리
  end
  Route->>DB: prisma.user.update(변경 필드)
  DB-->>Route: 업데이트된 사용자 레코드
  Route-->>Client: 200 { id, email, nickname, profileImageUrl, mbti }
Loading

예상 코드 리뷰 노력

🎯 4 (Complex) | ⏱️ ~60 minutes

관련 가능성이 있는 PR

  • I5-Project/TALKY-OWL#71: 동일한 /api/user/me 프로필 이미지 업로드, mypage/edit 페이지 UI/상태, src/lib/storage/index.ts 구성을 직접 다루는 PR.
  • I5-Project/TALKY-OWL#75: resultConflictGroup 참조를 제거한 PR으로, 이번 PR에서 동일 코드 경로에 반대 방향으로 재추가하는 변경과 직접 충돌.
  • I5-Project/TALKY-OWL#50: src/lib/auth/index.ts의 Kakao 온보딩 최초 로그인 필드 저장 흐름을 동일하게 수정한 PR.

제안된 리뷰어

  • lyla-bae
  • SG-Develope

시 🐇

🥕 토끼가 코드 밭을 깡충깡충—
프로필 사진도 클라우드에 쏙!
약관 동의는 트랜잭션으로 꼭,
토큰으로 방에 들어가는 오늘,
판결 그룹도 DTO에 탁!
버그 없이 머지되길 바라며
당근 한 입 🥕 ✨

✨ 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.

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