Skip to content

Commit

Permalink
Merge branch 'dev' into feature/#11
Browse files Browse the repository at this point in the history
  • Loading branch information
shine-jung committed Oct 20, 2023
2 parents 9918d86 + 04ca592 commit ddeb22e
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsNotEmpty, MaxLength, MinLength } from 'class-validator';

export class UpdateNameDto {
export class UpdateUserNameDto {
@ApiProperty({
description: '새로운 이름',
required: true,
Expand Down
31 changes: 31 additions & 0 deletions src/user/dto/user-response.dto.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { ApiProperty } from '@nestjs/swagger';

export class UserResponseDto {
@ApiProperty({ description: '유저 ID', example: 1 })
id: number;

@ApiProperty({ description: '소셜 로그인 제공업체', example: 'kakao' })
provider: string;

@ApiProperty({ description: '유저 타입', example: 'GENERAL' })
userType: string;

@ApiProperty({ description: '이름', example: '골목대장' })
name: string;

@ApiProperty({
description: '프로필 이미지 URL',
example: null,
nullable: true,
})
profileImage: string | null;

@ApiProperty({ description: '이메일', example: '[email protected]' })
email: string;

@ApiProperty({ description: '생성일', example: '2023-10-19T15:45:07.676Z' })
createdAt: string;

@ApiProperty({ description: '수정일', example: '2023-10-20T12:39:00.540Z' })
updateAt: string;
}
7 changes: 4 additions & 3 deletions src/user/user.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ import {
ApiOperation,
ApiTags,
} from '@nestjs/swagger';
import { UpdateNameDto } from './dto/update-name.dto';
import { GetUser } from 'src/decorators/user.decorator';
import { CommonResponseDto } from 'src/common/dto/common-response.dto';
import { createResponse } from 'src/common/utils/response.helper';
import { UpdateUserNameDto } from './dto/update-user-name.dto';
import { UserResponseDto } from './dto/user-response.dto';

@UseGuards(AuthGuard('jwt'))
@Controller('user')
Expand All @@ -38,7 +39,7 @@ export class UserController {
})
@ApiOkResponse({
description: '내 정보 조회 성공',
type: User,
type: UserResponseDto,
})
async getMyInfo(@GetUser() user: User): Promise<User> {
return this.userService.getUserById(user.id);
Expand All @@ -55,7 +56,7 @@ export class UserController {
type: CommonResponseDto,
})
async updateName(
@Body(new ValidationPipe()) updateNameDto: UpdateNameDto,
@Body(new ValidationPipe()) updateNameDto: UpdateUserNameDto,
@GetUser() user: User,
): Promise<CommonResponseDto> {
await this.userService.updateName(user.id, updateNameDto.name);
Expand Down

0 comments on commit ddeb22e

Please sign in to comment.