Se agregaron los campos de los que se deben de mandar a origen de usuario

This commit is contained in:
evenegas
2025-06-18 07:33:21 -06:00
parent 8703a292e3
commit 4984c47029
12 changed files with 598 additions and 229 deletions
+7 -4
View File
@@ -8,19 +8,22 @@ import { ApiBearerAuth } from '@nestjs/swagger';
@Controller()
export class AuthController {
constructor(private readonly authService: AuthService) {}
constructor(private readonly authService: AuthService) { }
@Post('login')
@AuthDocumentation.login()
async login(@Body() dto: LoginDto) {
const user = await this.authService.validateUser(dto.email, dto.password);
if (!user) {
throw new Error('Invalid credentials');
}
return this.authService.login(user);
}
@UseGuards(AuthGuard('jwt'))
@UseGuards(AuthGuard('jwt'))
@ApiBearerAuth('bearer')
@UseGuards(AuthGuard('jwt'))
@UseGuards(AuthGuard('jwt'))
@Get('profile')
@AuthDocumentation.bearerAuth()
getProfile(@Request() req) {
@@ -34,7 +37,7 @@ export class AuthController {
@Post('register')
@Post('register')
@AuthDocumentation.register() // ver siguiente sección
async register(@Body() dto: RegisterDto) {
return this.authService.register(dto);