feat(store): 매장 찜 토글 + 인기 매장 isWishlisted (옵셔널 JWT 가드)#146
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
🧹 knip — dead-code 리포트전체 리포트
|
🩺 NestJS Doctor — 88/100 (Good)진단 254건 (error 0).
architecture / security 상위 항목
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 54344367d5
ℹ️ 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".
| constructor(private readonly storeListingService: StoreListingService) {} | ||
|
|
||
| @Query('popularStores') | ||
| @UseGuards(OptionalJwtAuthGuard) |
There was a problem hiding this comment.
Register the optional auth guard
When popularStores is queried with a bearer token, this guard is the only code path that authenticates the request and populates req.user, but OptionalJwtAuthGuard is not registered in the Nest provider graph (checked AuthGlobalModule and the new StoreModule providers). Route-scoped guards supplied as classes are resolved from providers, so this guard is skipped/absent and @CurrentUser() stays undefined, causing isWishlisted to remain false for logged-in users until the guard is added to providers/exports (or this module's providers).
Useful? React with 👍 / 👎.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Coverage report
Test suite run success1319 tests passing in 156 suites. Report generated by 🧪jest coverage report action from fd387f6 |
|
Codex P2 반영 (f80aaa5): OptionalJwtAuthGuard를 AuthGlobalModule providers/exports에 등록 — JwtAuthGuard와 동일 패턴. 미등록 시 가드 미주입으로 로그인 사용자의 isWishlisted가 false로 남는 문제 해소. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f80aaa598f
ℹ️ 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".
| await this.wishlistRepo.upsertStoreWishlist({ | ||
| accountId, | ||
| storeId, | ||
| now: new Date(), | ||
| }); |
There was a problem hiding this comment.
Restrict store wishlists to user accounts
When an authenticated SELLER or ADMIN calls addStoreToWishlist, JwtAuthGuard only verifies that the account is active and the resolver passes only the account id, so this service writes a store_wishlist_item for non-buyer accounts. Those rows are later included by aggregateWishlistCounts in the public popularity ranking, letting seller/admin accounts affect store rankings; the existing product wishlist path avoids this by calling requireActiveUser, so add an equivalent account-type/profile check before writing store wishlist rows.
Useful? React with 👍 / 👎.
|
Codex 리뷰 반영: (1) 가드 등록은 f80aaa5에서 이미 AuthGlobalModule providers/exports에 추가됨(JwtAuthGuard와 동일 패턴, resolver 미변경이라 코멘트가 라인 재매핑된 것). (2) USER 제한은 fd387f6 반영 — isActiveUserAccount로 SELLER/ADMIN 찜을 Forbidden 처리해 랭킹 무결성 보호. |
|
Caution Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted. Error details |
Summary
인기 매장 리스트의 매장 찜(하트) 기능인 PR3입니다(화면 01의 찜 토글). 매장 찜 추가/해제 mutation과, 인기 매장 리스트에 로그인 사용자의 찜 여부(
isWishlisted)를 채우는 옵셔널 인증을 구현했습니다.StoreWishlistItem모델은 존재했으나 기능이 전혀 없었고, 상품 찜(WishlistItem)의 멱등 토글 패턴을 그대로 따랐습니다.Scope
addStoreToWishlist(storeId)/removeStoreFromWishlist(storeId)isWishlisted: 옵셔널 인증으로 로그인 시 페이지 매장의 찜 여부를 단일 IN 쿼리로 매핑(N+1 회피), 비로그인은 모두 false진행 상황
전체 4개 PR 중 3번째:
Impact
StoreWishlistItem활용).PopularStore.isWishlisted필드 추가(GraphQL 비파괴적 확장).OptionalJwtAuthGuard신설(글로벌, 다른 public+개인화 쿼리에서 재사용 가능).Test plan
yarn validate전체 통과 — 156 suites / 1318 tests / 커버리지 임계 충족isWishlisted(로그인 true/false·비로그인 false)후속