29 lines
891 B
TypeScript
29 lines
891 B
TypeScript
import { Body, Controller, Get, Patch, Post, UseGuards } from '@nestjs/common';
|
|
import { AuthService } from './auth.service';
|
|
import { CreateUsuarioDto } from 'src/usuarios/dto/create-usuario.dto';
|
|
import { LoginDto } from './dto/login.dto';
|
|
import { AuthGuard } from '@nestjs/passport';
|
|
import { UpdateUsuarioDto } from 'src/usuarios/dto/update-usuario.dto';
|
|
|
|
@Controller('auth')
|
|
export class AuthController {
|
|
constructor(private readonly authService: AuthService) {}
|
|
|
|
@UseGuards(AuthGuard('jwt'))
|
|
@Post('registro')
|
|
registro(@Body() registroDto: CreateUsuarioDto) {
|
|
return this.authService.registro(registroDto);
|
|
}
|
|
|
|
@UseGuards(AuthGuard('jwt'))
|
|
@Patch('update')
|
|
update(@Body() registroDto: UpdateUsuarioDto) {
|
|
return this.authService.update(registroDto);
|
|
}
|
|
|
|
@Post('login')
|
|
login(@Body() loginDto: LoginDto) {
|
|
return this.authService.login(loginDto);
|
|
}
|
|
}
|