diff --git a/src/auth/auth.controller.ts b/src/auth/auth.controller.ts index 7460d99..9feee0d 100644 --- a/src/auth/auth.controller.ts +++ b/src/auth/auth.controller.ts @@ -1,7 +1,7 @@ import { Body, Controller, Get, Post } from '@nestjs/common' import { AuthService } from './auth.service' import { CreateUserDto } from 'src/users/dto/create-user.dto' -import { ApiTags } from '@nestjs/swagger' +import { ApiTags, ApiBearerAuth } from '@nestjs/swagger' import { LoginInputDto } from './dto/login-input.dto' import { UserEntity } from 'src/users/entities/user.entity' import { User } from 'src/common/decorators/user.decorator' @@ -24,6 +24,7 @@ export class AuthController { return this.authService.login(user.email, user.password) } + @ApiBearerAuth() @Get('api/profile') async getUserInfo(@User() user: UserEntity) { return user diff --git a/src/main.ts b/src/main.ts index 0d212e0..80a79c3 100644 --- a/src/main.ts +++ b/src/main.ts @@ -21,6 +21,7 @@ async function bootstrap() { // Swagger Api const options = new DocumentBuilder() + .addBearerAuth() .setTitle('Nest Project') .setDescription('The Nest-Project API description') .setVersion('1.0')