-
Notifications
You must be signed in to change notification settings - Fork 0
feat(store): 찜한 매장 목록 조회(myWishlistedStores)와 매장 프로필 이미지 #213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
prisma/migrations/20260826171140_add_store_profile_image_url/migration.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| -- AlterTable | ||
| ALTER TABLE `store` ADD COLUMN `profile_image_url` VARCHAR(2048) NULL; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| /** 찜한 매장 카드의 대표 이미지 수(figma liked 04 시안 기준 3장). */ | ||
| export const WISHLISTED_STORE_IMAGE_LIMIT = 3; | ||
|
|
||
| /** 찜한 매장 목록 기본 페이지 크기(SDL 기본값과 동일). */ | ||
| export const DEFAULT_WISHLISTED_STORES_LIMIT = 20; |
35 changes: 35 additions & 0 deletions
35
src/features/store/dto/inputs/my-wishlisted-stores.input.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import 'reflect-metadata'; | ||
|
|
||
| import { plainToInstance } from 'class-transformer'; | ||
| import { validate } from 'class-validator'; | ||
|
|
||
| import { MyWishlistedStoresInput } from '@/features/store/dto/inputs/my-wishlisted-stores.input'; | ||
|
|
||
| function build(plain: object): MyWishlistedStoresInput { | ||
| return plainToInstance(MyWishlistedStoresInput, plain); | ||
| } | ||
|
|
||
| describe('MyWishlistedStoresInput', () => { | ||
| it('빈 입력 통과 (모두 optional)', async () => { | ||
| expect(await validate(build({}))).toHaveLength(0); | ||
| }); | ||
|
|
||
| it('offset/limit 통과', async () => { | ||
| expect(await validate(build({ offset: 0, limit: 20 }))).toHaveLength(0); | ||
| }); | ||
|
|
||
| it('offset 음수 거절', async () => { | ||
| const errors = await validate(build({ offset: -1 })); | ||
| expect(errors[0].property).toBe('offset'); | ||
| }); | ||
|
|
||
| it('limit 하한(0)·상한(51) 거절', async () => { | ||
| expect((await validate(build({ limit: 0 })))[0].property).toBe('limit'); | ||
| expect((await validate(build({ limit: 51 })))[0].property).toBe('limit'); | ||
| }); | ||
|
|
||
| it('정수가 아닌 limit 거절', async () => { | ||
| const errors = await validate(build({ limit: 1.5 })); | ||
| expect(errors[0].property).toBe('limit'); | ||
| }); | ||
| }); |
14 changes: 14 additions & 0 deletions
14
src/features/store/dto/inputs/my-wishlisted-stores.input.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import { IsInt, IsOptional, Max, Min } from 'class-validator'; | ||
|
|
||
| export class MyWishlistedStoresInput { | ||
| @IsOptional() | ||
| @IsInt() | ||
| @Min(0) | ||
| offset?: number; | ||
|
|
||
| @IsOptional() | ||
| @IsInt() | ||
| @Min(1) | ||
| @Max(50) | ||
| limit?: number; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a user removes and later re-adds a store,
upsertStoreWishlistrestores the existing row by updatingupdated_atwhile leavingcreated_atunchanged. Ordering here bycreated_attherefore places the restored store at its original, potentially much older position and returns that stale value asaddedAt, contradicting the query's newest-first contract. Use the restoration timestamp for ordering/output, or resetcreated_atwhen restoring the row.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
반영: 복원(재찜) 시 created_at을 재찜 시점으로 갱신해 최신순 정렬과 addedAt 표기가 재찜을 반영하도록 수정. 회귀 테스트 추가.
상품 찜(upsertWishlistItem)도 동일 이슈 — 후속 PR(찜 목록 카드 확장)에서 같은 방식으로 맞출 예정.