Skip to content

Commit

Permalink
프리미엄 여부 조회
Browse files Browse the repository at this point in the history
  • Loading branch information
gidskql6671 committed Dec 18, 2023
1 parent c57d110 commit f1ae464
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/users/dto/users.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ApiProperty } from '@nestjs/swagger';
import { User } from '../../entities/user';

export class UsersDto {
static fromEntity({ id, email, rateLimit }: User) {
static fromEntity({ id, email, rateLimit, isPremium }: User) {
const userDto = new UsersDto();

userDto.id = id;
Expand Down Expand Up @@ -39,4 +39,11 @@ export class UsersDto {
description: '현재 사용한 채팅 횟수',
})
public currentUsedCount: number;

@ApiProperty({
required: true,
example: true,
description: '프리미엄 유무',
})
public isPremium: boolean;
}
1 change: 1 addition & 0 deletions src/users/users.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export class UsersController {

const userDto = UsersDto.fromEntity(user);

userDto.isPremium = await this.usersService.existsPremium(userId);
userDto.currentUsedCount = usedChatCount;

return userDto;
Expand Down

0 comments on commit f1ae464

Please sign in to comment.