Conversation
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 통과
feat: 마이페이지 검증용 시드 데이터 인프라 추가
FE 개발자가 시드(yarn prisma:seed) accountId로 OIDC 흐름을 거치지 않고
GraphQL Playground에서 곧장 마이페이지 API를 시험할 수 있도록 dev 전용 헬퍼 추가.
## 변경 사항
- AuthService.issueDevAccessToken(accountId)
- findAccountForJwt로 활성 USER 검증 (NotFound / Forbidden 분기)
- 기존 signAccessToken을 재사용하여 access token 생성
- AuthController.devIssueToken (POST /auth/dev/issue-token)
- NODE_ENV=production이면 ForbiddenException으로 즉시 차단
- body.accountId 누락/형식 오류 시 BadRequestException
- 응답: { accessToken, tokenType: 'Bearer', expiresInSeconds }
## 회귀 테스트
- auth.service.spec.ts: 정상 발급 / NotFound / Forbidden 3건
- auth.controller.spec.ts: production 차단 / 누락 / 형식오류 / 정상 4건
전체 875 tests 통과 (+7).
feat(auth): dev 전용 access token 발급 endpoint 추가
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (18)
📝 WalkthroughWalkthrough이 PR은 개발 환경을 위한 데이터베이스 시딩 인프라와 관리용 JWT 토큰 발급 기능을 추가합니다. MySQL 인증 플러그인 설정, Prisma 시드 스크립트(사용자, 스토어, 주문, 리뷰 등), 그리고 인증 서비스에 개발용 토큰 발급 엔드포인트를 도입합니다. Changes데이터베이스 및 시딩 인프라
개발용 인증 토큰 발급 기능
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60분 Possibly related PRs
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Trivy (0.69.3)Failed to read Trivy output file: ENOENT: no such file or directory, open '/inmem/1278/nsjail-bbd846d9-59b3-4f98-ab22-8db1c509a99f/merged/.trivy-output.json' 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. Comment |
Coverage report
Test suite run success875 tests passing in 77 suites. Report generated by 🧪jest coverage report action from 12239a9 |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 12239a91cc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| where: { product_id: { in: productIds } }, | ||
| }); | ||
|
|
||
| await prisma.product.deleteMany({ where: { id: { in: productIds } } }); |
There was a problem hiding this comment.
Delete all FK dependents before removing seeded products
resetSeedScope removes cart/wishlist/recent-view references for seeded products but does not clear other required dependents (for example OrderItem and Review rows from non-seed accounts that referenced those products/stores). In any shared dev DB where someone orders or reviews a [SEED] product, this product.deleteMany call will fail on FK constraints and the script stops being idempotent after one run.
Useful? React with 👍 / 👎.
| @Body() body: DevIssueTokenBody, | ||
| @Res() res: Response, | ||
| ): Promise<void> { | ||
| if (process.env.NODE_ENV === 'production') { |
There was a problem hiding this comment.
Block dev token issuance outside explicit local/dev envs
This endpoint is unauthenticated and currently disabled only when NODE_ENV is exactly 'production', so it remains enabled in other deployed modes (e.g., staging, qa, or unset). In those environments, anyone who can reach the API can mint access tokens for arbitrary account IDs and impersonate users; a dev helper like this should be gated by an explicit allowlist/feature flag, not just a production inequality check.
Useful? React with 👍 / 👎.
Summary
마이페이지 FE 온보딩 작업 플랜의 백엔드 산출물 2건을 main에 반영한다.
가이드 문서(노션) 갱신은 코드 PR 외 별도로 이미 적용 완료.
포함된 PR
주요 변경
시드 인프라 (#86)
Dev 토큰 헬퍼 (#87)
부수 변경 (#86)
정량 결과
Breaking 여부
Test plan
Summary by CodeRabbit
릴리스 노트
새 기능
기타