59 lines
1.6 KiB
TypeScript
59 lines
1.6 KiB
TypeScript
import {
|
|
Body,
|
|
Controller,
|
|
Get,
|
|
Post,
|
|
Put,
|
|
Query,
|
|
UseGuards,
|
|
} from '@nestjs/common';
|
|
import { AuthGuard } from '@nestjs/passport';
|
|
import { ApiTags } from '@nestjs/swagger';
|
|
import { UsuarioService } from './usuario.service';
|
|
import { UsuarioEscolaresDto } from './dto/usuario-escolares.dto';
|
|
import { UsuarioRegistrarDto } from './dto/usuario-registrar.dto';
|
|
import { UsuarioUpdateDto } from './dto/usuario-update.dto';
|
|
import { UsuarioUsuariosDto } from './dto/usuario-usuarios.dto';
|
|
import { UsuarioDto } from './dto/usuario.dto';
|
|
|
|
@Controller('usuario')
|
|
@ApiTags('usuario')
|
|
export class UsuarioController {
|
|
constructor(private usuarioService: UsuarioService) {}
|
|
|
|
/* Pendiente por conexión */
|
|
@Get('dgae-dgp')
|
|
dgaeDgp(@Query() query: UsuarioEscolaresDto) {
|
|
return this.usuarioService.dgaeDgp(query.usuario);
|
|
}
|
|
|
|
@Post('registrar')
|
|
registrar(@Body() body: UsuarioRegistrarDto) {
|
|
return this.usuarioService.registrar(body.id_usuario, body.telefono);
|
|
}
|
|
|
|
@Put()
|
|
@UseGuards(AuthGuard('jwt'))
|
|
update(@Body() body: UsuarioUpdateDto) {
|
|
return this.usuarioService.update(body);
|
|
}
|
|
|
|
@Put('update-password')
|
|
@UseGuards(AuthGuard('jwt'))
|
|
passwordResset(@Body() body: UsuarioUpdateDto) {
|
|
return this.usuarioService.passwordReset(body.id_usuario);
|
|
}
|
|
|
|
@Get('usuario')
|
|
@UseGuards(AuthGuard('jwt'))
|
|
usuario(@Query() query: UsuarioDto) {
|
|
return this.usuarioService.findById(parseInt(query.id_usuario));
|
|
}
|
|
|
|
@Get('usuarios')
|
|
@UseGuards(AuthGuard('jwt'))
|
|
usuarios(@Query() query: UsuarioUsuariosDto) {
|
|
return this.usuarioService.findAll(query);
|
|
}
|
|
}
|