Skip to content

Commit

Permalink
� docs: 로그인 API 명세 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
jinddings committed Nov 6, 2024
1 parent 8b121d1 commit 9887ea6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
5 changes: 4 additions & 1 deletion BE/src/auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,26 @@ import {
import { AuthGuard } from '@nestjs/passport';
import { AuthService } from './auth.service';
import { AuthCredentialsDto } from './dto/authCredentials.dto';
import { ApiOperation } from '@nestjs/swagger';

@Controller('auth')
export class AuthController {
constructor(private authService: AuthService) {}

@ApiOperation({ summary: '회원 가입 API' })
@Post('/signup')
signUp(@Body(ValidationPipe) authCredentialsDto: AuthCredentialsDto) {
return this.authService.signUp(authCredentialsDto);
}

@ApiOperation({ summary: '로그인 API' })
@Get('/login')
loginWithCredentials(
@Body(ValidationPipe) authCredentialsDto: AuthCredentialsDto,
) {
return this.authService.loginUser(authCredentialsDto);
}

@ApiOperation({ summary: 'Token 인증 테스트 API' })
@Get('/test')
@UseGuards(AuthGuard())
test(@Req() req: Request) {
Expand Down
13 changes: 13 additions & 0 deletions BE/src/auth/dto/authCredentials.dto.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
import { IsString, Matches, MaxLength, MinLength } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';

export class AuthCredentialsDto {
@ApiProperty({
description: '유저 이메일',
minLength: 4,
maxLength: 20,
type: 'string',
})
@IsString()
@MinLength(4)
@MaxLength(20)
email: string;

@ApiProperty({
description: '유저 비밀번호',
minLength: 4,
maxLength: 20,
type: 'string',
})
@IsString()
@MinLength(4)
@MaxLength(20)
Expand Down

0 comments on commit 9887ea6

Please sign in to comment.