Skip to content

feat: 마이페이지 검증용 시드 데이터 인프라 추가#86

Merged
chanwoo7 merged 2 commits intodevelopfrom
feat/fe-onboarding-seed
May 5, 2026
Merged

feat: 마이페이지 검증용 시드 데이터 인프라 추가#86
chanwoo7 merged 2 commits intodevelopfrom
feat/fe-onboarding-seed

Conversation

@chanwoo7
Copy link
Copy Markdown
Member

@chanwoo7 chanwoo7 commented May 5, 2026

Summary

FE 개발자가 로컬에서 마이페이지 API 전반을 시각적으로 검증할 수 있도록
yarn prisma:seed 한 번에 채울 수 있는 테스트 데이터 인프라를 도입한다.

본 PR은 마이페이지 FE 온보딩 작업 플랜의 Stage B (B-1 시드 인프라 + B-2 시나리오) 묶음.
README 갱신은 다른 가이드와의 톤·언어 일관성을 위해 별도 작업으로 미룸.

구현

  • package.json: scripts.prisma:seed + prisma.seed entry (ts-node + tsconfig-paths)
  • prisma/seed.ts: entry point (production 환경 자동 차단)
  • prisma/seed/idempotent.ts: 시드 영역(seed-user-* 이메일 / [SEED] * 매장명) 정리 헬퍼
  • prisma/seed/{users,stores,orders,reviews,wishlist,recent-views,notifications,custom-drafts,search-history}.ts

시드 시나리오

마이페이지 API 거의 모든 분기를 한 번에 검증 가능하도록 구성:

  • 유저 2명 (온보딩 완료 / 미완료 → me.needsProfile 검증)
  • 매장 2개 + 상품 5개 (sale_price 있음/없음, 비활성 1)
  • 주문 6건 (각 status별 + PICKED_UP에 리뷰 작성 1 / 미작성 1)
    • o2에 selectedOptions / customTexts / customFreeEdits + Attachment 포함
  • 리뷰 1건 (IMAGE + VIDEO 미디어)
  • 찜 3건 (visible 2 + invisible 1로 visibleWishlistWhere 검증)
  • 최근 본 상품 4건
  • 알림 3건 (unread 2 / read 1 → unreadNotificationCount=2)
  • 커스텀 드래프트 2건 (IN_PROGRESS / READY_FOR_ORDER → customDraftCount=2)
  • 검색 히스토리 3건

부수 변경 (MySQL 인증 plugin 호환 fix)

prisma client 6.x가 일부 환경에서 caching_sha2_password를 sha256_password로
잘못 인식하는 호환 이슈가 있어 mysql_native_password로 통일:

  • docker-compose.yml: --default-authentication-plugin=mysql_native_password 옵션
  • docker/mysql/init/01-grant-shadow-db.sql: ALTER USER 한 줄 추가 (이중 안전망)

기존 컨테이너에는 영향 없음 (새 셋업 시 자동 적용). 기존 컨테이너에서 시드 돌리려면
docker exec caquick-mysql mysql -uroot -proot -e "ALTER USER 'caquick'@'%' IDENTIFIED WITH mysql_native_password BY 'caquick'; FLUSH PRIVILEGES;" 한 번 실행.

검증

  • 첫 실행 / 두 번째 실행 / 세 번째 실행 모두 성공 (idempotent)
  • NODE_ENV=production 시 명시적 차단 동작 확인
  • npx tsc --noEmit 통과 (타입 에러 0)
  • CI check 통과
  • CI coverage-report 통과 (시드는 src/ 에 영향 없음)
  • CodeQL 통과

FE 개발자가 로컬에서 마이페이지 API 전반을 시각적으로 검증할 수 있도록
prisma db seed 명령으로 한 번에 채울 수 있는 테스트 데이터 인프라를 도입한다.

## 구현

- package.json
  - scripts.prisma:seed
  - prisma.seed: ts-node + tsconfig-paths 기반 entry
- prisma/seed.ts: entry point (production 가드 포함)
- prisma/seed/idempotent.ts: 시드 영역(seed-user-* / [SEED] *) 정리 헬퍼
- prisma/seed/{users,stores,orders,reviews,wishlist,recent-views,
  notifications,custom-drafts,search-history}.ts

## 시드 시나리오

마이페이지 API 거의 모든 분기를 한 번에 검증할 수 있도록 구성:
- 유저 2명 (온보딩 완료 / 미완료)
- 매장 2개 + 상품 5개 (sale_price 있음/없음, 비활성 1)
- 주문 6건 (각 status + PICKED_UP에 리뷰 작성/미작성 둘 다)
  - o2에 selectedOptions/customTexts/customFreeEdits 포함
- 리뷰 1건 (IMAGE+VIDEO 미디어 포함)
- 찜 3건 (visible 2 + invisible 1로 visibleWishlistWhere 검증)
- 최근 본 상품 4건
- 알림 3건 (unread 2 / read 1)
- 커스텀 드래프트 2건 (IN_PROGRESS / READY_FOR_ORDER)
- 검색 히스토리 3건

## 부수 변경

docker-compose.yml과 docker/mysql/init/01-grant-shadow-db.sql:
- prisma client 6.x가 일부 환경에서 caching_sha2_password를
  sha256_password로 잘못 인식하는 호환 이슈 회피.
- mysql_native_password로 통일 (default-authentication-plugin
  옵션 + ALTER USER 이중 안전망).

README.md: 테스트 데이터 시드 사용법 섹션 추가.

## 검증

- 첫 실행 / 두 번째 실행 모두 성공 (idempotent)
- NODE_ENV=production 차단 동작 확인
- npx tsc --noEmit 통과
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 5, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 86492582-d5f9-4067-84d2-3fa254a81362

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/fe-onboarding-seed

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 96.69% 2894/2993
🟢 Branches 86.5% 1647/1904
🟢 Functions 93.32% 615/659
🟢 Lines 97.02% 2638/2719

Test suite run success

868 tests passing in 77 suites.

Report generated by 🧪jest coverage report action from 1e1d317

@codecov
Copy link
Copy Markdown

codecov Bot commented May 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@chanwoo7 chanwoo7 merged commit 64385f3 into develop May 5, 2026
9 checks passed
@chanwoo7 chanwoo7 deleted the feat/fe-onboarding-seed branch May 5, 2026 19:28
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