institucion programa input output dto
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
import { Body, Controller, Get, Post, Put, Query } from '@nestjs/common';
|
||||
import { ApiBody, ApiOperation, ApiQuery, ApiTags } from '@nestjs/swagger';
|
||||
import { Serealize } from '../interceptors/serialize.interceptor';
|
||||
import { InstitucionProgramaService } from './institucion-programa.service';
|
||||
import { IdInstitucionDto } from 'src/dto/id-institucion.dto';
|
||||
import { ProgramaCreateDto } from '../institucion-programa/dto/programa-create.dto';
|
||||
import { ProgramaUpdateDto } from '../institucion-programa/dto/programa-update.dto';
|
||||
import { CreateProgramaDto } from './dto/input/create.dto';
|
||||
import { UpdateProgramaDto } from './dto/input/update.dto';
|
||||
import { InstitucionProgramaOutputDto } from './dto/output/institucion-programa.dto';
|
||||
import { InstitucionProgramaMinOutputDto } from './dto/output/institucion-programa-min.dto';
|
||||
import { ProgramaOutputDto } from './dto/output/programa.dto';
|
||||
|
||||
@Controller('institucion-programa')
|
||||
@ApiTags('institucion-programa')
|
||||
@@ -16,16 +20,18 @@ export class InstitucionProgramaController {
|
||||
description: 'Es obligatorio mandar la varible programa.',
|
||||
examples: { ejemplo: { value: { programa: '' } } },
|
||||
})
|
||||
create(@Body() body: ProgramaCreateDto) {
|
||||
create(@Body() body: CreateProgramaDto) {
|
||||
return this.institucionProgramaService.create(body.programa);
|
||||
}
|
||||
|
||||
@Serealize(ProgramaOutputDto)
|
||||
@Get()
|
||||
@ApiOperation({ description: 'Endpoint que retorna todos los programas.' })
|
||||
get() {
|
||||
return this.institucionProgramaService.findAllProgramas();
|
||||
}
|
||||
|
||||
@Serealize(InstitucionProgramaOutputDto)
|
||||
@Get('programas')
|
||||
@ApiOperation({
|
||||
description: 'Endpoint que retorna todos los programas de una institución.',
|
||||
@@ -41,6 +47,7 @@ export class InstitucionProgramaController {
|
||||
);
|
||||
}
|
||||
|
||||
@Serealize(InstitucionProgramaMinOutputDto)
|
||||
@Get('programas-mostrar')
|
||||
@ApiOperation({
|
||||
description:
|
||||
@@ -68,7 +75,7 @@ export class InstitucionProgramaController {
|
||||
ejemplo: { value: { id_institucion_programa: 130, mostrar: true } },
|
||||
},
|
||||
})
|
||||
update(@Body() body: ProgramaUpdateDto) {
|
||||
update(@Body() body: UpdateProgramaDto) {
|
||||
return this.institucionProgramaService.update(body);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user