operador input output dto
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { IsInt, IsString } from 'class-validator';
|
||||
|
||||
export class OperadorCreateDto {
|
||||
export class CreateOperadorDto {
|
||||
@IsInt()
|
||||
id_institucion: number;
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import { IsNumberString, IsOptional, IsString } from 'class-validator';
|
||||
|
||||
export class OperadorOperadoresDto {
|
||||
export class OperadoresDto {
|
||||
@IsNumberString()
|
||||
pagina: string;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { IsBoolean, IsInt, IsOptional, IsString } from 'class-validator';
|
||||
|
||||
export class OperadorUpdateDto {
|
||||
export class UpdateOperadorDto {
|
||||
@IsInt()
|
||||
id_operador: number;
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import { Expose, Type } from 'class-transformer';
|
||||
import { InstitucionMinOutputDto } from '../../../institucion/dto/output/institucion-min.dto';
|
||||
import { TipoUsuarioOutputDto } from '../../../tipo-usuario/dto/output/tipo-usuario.dto';
|
||||
|
||||
export class OperadorOutputDto {
|
||||
@Expose()
|
||||
activo;
|
||||
|
||||
@Expose()
|
||||
id_operador;
|
||||
|
||||
@Expose()
|
||||
operador;
|
||||
|
||||
@Expose()
|
||||
@Type(() => InstitucionMinOutputDto)
|
||||
institucion;
|
||||
|
||||
@Expose()
|
||||
@Type(() => TipoUsuarioOutputDto)
|
||||
tipoUsuario;
|
||||
}
|
||||
@@ -9,11 +9,13 @@ import {
|
||||
} from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { ApiBody, ApiOperation, ApiQuery, ApiTags } from '@nestjs/swagger';
|
||||
import { Serealize } from '../interceptors/serialize.interceptor';
|
||||
import { OperadorService } from './operador.service';
|
||||
import { OperadorCreateDto } from './dto/operador-create.dto';
|
||||
import { OperadorOperadoresDto } from './dto/operador-operadores.dto';
|
||||
import { OperadorUpdateDto } from './dto/operador-update.dto';
|
||||
import { OperadorDto } from './dto/operador.dto';
|
||||
import { CreateOperadorDto } from './dto/input/create.dto';
|
||||
import { OperadoresDto } from './dto/input/operadores.dto';
|
||||
import { UpdateOperadorDto } from './dto/input/update.dto';
|
||||
import { OperadorDto } from './dto/input/operador.dto';
|
||||
import { OperadorOutputDto } from './dto/output/operador.dto';
|
||||
|
||||
@Controller('operador')
|
||||
@ApiTags('operador')
|
||||
@@ -36,7 +38,7 @@ export class OperadorController {
|
||||
},
|
||||
},
|
||||
})
|
||||
create(@Body() body: OperadorCreateDto) {
|
||||
create(@Body() body: CreateOperadorDto) {
|
||||
return this.operadorService.create(
|
||||
body.id_institucion,
|
||||
body.id_tipo_usuario,
|
||||
@@ -45,6 +47,7 @@ export class OperadorController {
|
||||
);
|
||||
}
|
||||
|
||||
@Serealize(OperadorOutputDto)
|
||||
@Get('operador')
|
||||
// @UseGuards(AuthGuard('jwt'))
|
||||
@ApiOperation({
|
||||
@@ -59,6 +62,7 @@ export class OperadorController {
|
||||
return this.operadorService.findById(parseInt(query.id_operador));
|
||||
}
|
||||
|
||||
@Serealize(OperadorOutputDto)
|
||||
@Get('operadores')
|
||||
// @UseGuards(AuthGuard('jwt'))
|
||||
@ApiOperation({
|
||||
@@ -88,7 +92,7 @@ export class OperadorController {
|
||||
type: 'string',
|
||||
required: false,
|
||||
})
|
||||
operadores(@Query() query: OperadorOperadoresDto) {
|
||||
operadores(@Query() query: OperadoresDto) {
|
||||
return this.operadorService.findAll(query);
|
||||
}
|
||||
|
||||
@@ -108,7 +112,7 @@ export class OperadorController {
|
||||
ejemplo: { value: { id_operador: 3, activo: true, password: '' } },
|
||||
},
|
||||
})
|
||||
update(@Body() body: OperadorUpdateDto) {
|
||||
update(@Body() body: UpdateOperadorDto) {
|
||||
return this.operadorService.update(body);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user