2025-08-22 12:48:25 -06:00
|
|
|
import { Body, Controller, Param, Post } from '@nestjs/common';
|
2023-02-22 16:28:12 -06:00
|
|
|
import { AuthService } from './auth.service';
|
2023-03-17 13:38:37 -06:00
|
|
|
import { LoginMiembroDto } from './dto/loginMiembro.dto';
|
2023-03-08 15:28:54 -06:00
|
|
|
import { RegistrarMiembroDto } from './dto/registrarMiembro.dto';
|
2025-05-13 19:42:36 -06:00
|
|
|
import { ApiTags } from '@nestjs/swagger';
|
|
|
|
|
import { ApiPostRegistro } from './auth.docs';
|
2025-08-22 12:48:25 -06:00
|
|
|
import { jwtStrategy } from './jwt.strategy';
|
2023-02-22 16:28:12 -06:00
|
|
|
|
|
|
|
|
@Controller('auth')
|
2025-05-13 19:42:36 -06:00
|
|
|
@ApiTags('auth')
|
2023-02-22 16:28:12 -06:00
|
|
|
export class AuthController {
|
|
|
|
|
constructor(
|
|
|
|
|
private authService: AuthService,
|
2025-08-22 12:48:25 -06:00
|
|
|
private authValidar: jwtStrategy,
|
2023-02-22 16:28:12 -06:00
|
|
|
) /* @InjectRepository(Usuario) private usuarioRepository: Repository<Usuario> */ {}
|
|
|
|
|
|
|
|
|
|
@Post('registro')
|
2025-05-13 19:42:36 -06:00
|
|
|
@ApiPostRegistro()
|
2023-03-08 15:28:54 -06:00
|
|
|
registrarUsuario(@Body() registrarMiembro: RegistrarMiembroDto) {
|
|
|
|
|
return this.authService.registrar(registrarMiembro);
|
2023-02-22 16:28:12 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Post('login')
|
2023-03-17 13:38:37 -06:00
|
|
|
login(@Body() LoginUsuario: LoginMiembroDto) {
|
2023-02-22 16:28:12 -06:00
|
|
|
return this.authService.login(LoginUsuario);
|
|
|
|
|
}
|
2025-08-22 12:48:25 -06:00
|
|
|
|
|
|
|
|
@Post('validate')
|
|
|
|
|
validar(@Param() token: any) {
|
|
|
|
|
return this.authValidar.validate
|
|
|
|
|
}
|
2023-02-22 16:28:12 -06:00
|
|
|
}
|