Skip to content

Commit 30f71b1

Browse files
committed
feat: separate tags
1 parent 461c264 commit 30f71b1

3 files changed

Lines changed: 26 additions & 7 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
const INSTRUCTION_USER = 'deadbeef-cafe-babe-face-c0ffeecafeee';

src/user/dto.ts

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -492,13 +492,24 @@ export class MypageResponse {
492492
profileImage: string;
493493

494494
@ApiProperty({
495-
description: '태그 목록',
496-
enum: [Tag],
495+
description: '스타일 태그 목록',
496+
isArray: true,
497+
enum: Tag,
497498
})
498499
@IsArray()
499500
@IsOptional()
500-
@ValidateNested({ each: true })
501-
tags: Tag[];
501+
@IsEnum(Tag, { each: true })
502+
styleTags: Tag[];
503+
504+
@ApiProperty({
505+
description: '음식 태그 목록',
506+
isArray: true,
507+
enum: Tag,
508+
})
509+
@IsArray()
510+
@IsOptional()
511+
@IsEnum(Tag, { each: true })
512+
foodTags: Tag[];
502513

503514
@ApiProperty({
504515
description: 'MBTI',
@@ -524,9 +535,11 @@ export class MypageResponse {
524535

525536
@ApiProperty({
526537
description: '가장 큰 트리',
527-
type: MypageTreeResponse,
538+
type: [MypageTreeResponse],
528539
})
529-
@IsNotEmpty()
540+
@IsArray()
541+
@ValidateNested({ each: true })
542+
@Type(() => MypageTreeResponse)
530543
biggestTrees: MypageTreeResponse[];
531544

532545
@ApiProperty({

src/user/service.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { UserParam } from './params/user';
1212
import { TreeRepository } from '@/tree/repository';
1313
import { GetFollowerCountUsecase } from './usecases/getFollowerCount';
1414
import { GetFollowingCountUsecase } from './usecases/getFollowingCount';
15+
import { FOOD_TAGS, STYLE_TAGS } from '@/tree/constants';
1516
import { UserRepository } from './repositories/user';
1617
import { getBiggestTrees, getRecapDescription } from './tree.util';
1718
import { CheckFollowingStatusUseCase } from './usecases/checkFollowingStatus';
@@ -63,13 +64,17 @@ export class UserService {
6364
);
6465
}
6566

67+
const styleTags = user.tag.filter((tag) => STYLE_TAGS.includes(tag as any));
68+
const foodTags = user.tag.filter((tag) => FOOD_TAGS.includes(tag as any));
69+
6670
return {
6771
userId: user.id,
6872
username: user.username,
6973
nickname: user.nickname,
7074
description: user.description,
7175
profileImage: user.profileImageUrl,
72-
tags: user.tag,
76+
styleTags,
77+
foodTags,
7378
mbti: user.mbti,
7479
followerCount,
7580
followingCount,

0 commit comments

Comments
 (0)