carrera programa documentación
This commit is contained in:
@@ -1,38 +1,59 @@
|
||||
import { Body, Controller, Delete, Get, Param, Post } from '@nestjs/common';
|
||||
import { Body, Controller, Delete, Get, Post, Query } from '@nestjs/common';
|
||||
import { ApiBody, ApiOperation, ApiQuery, ApiTags } from '@nestjs/swagger';
|
||||
import { CarreraProgramaService } from './carrera-programa.service';
|
||||
import { CarreraProgramaCreateDto } from './dto/carrera-programa-create.dto';
|
||||
import { CarreraProgramaUpdateDto } from './dto/carrera-programa-update.dto';
|
||||
import {ApiOperation, ApiTags} from '@nestjs/swagger'
|
||||
import { CarreraProgramaDeleteDto } from './dto/carrera-programa-delete.dto';
|
||||
import { IdInstitucionDto } from '../dto/id-institucion.dto';
|
||||
|
||||
@Controller('carrera-programa')
|
||||
// @ApiTags('carrera-programa')
|
||||
@ApiTags('carrera-programa')
|
||||
export class CarreraProgramaController {
|
||||
constructor(private carreraProgramaService: CarreraProgramaService) {}
|
||||
|
||||
@Post()
|
||||
// @ApiOperation({
|
||||
// description: 'Creamos una carrera programa, pasandole los parametros id_carrera y id_programa'
|
||||
// })
|
||||
@ApiOperation({
|
||||
description:
|
||||
'Endpoint que crea una asociación entra una carrera y un programa.',
|
||||
})
|
||||
@ApiBody({
|
||||
description: 'Ambas variables son obligatorios.',
|
||||
examples: {
|
||||
ejemplo: { value: { id_institucion_carrera: 36, id_programa: 1 } },
|
||||
},
|
||||
})
|
||||
create(@Body() body: CarreraProgramaCreateDto) {
|
||||
return this.carreraProgramaService.create(
|
||||
body.id_carrera,
|
||||
body.id_institucion_carrera,
|
||||
body.id_programa,
|
||||
);
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
// @ApiOperation({
|
||||
// description: 'Borramos una carrera programa a partir del id (id_carrera_programa)'
|
||||
// })
|
||||
delete(@Param('id') id_carrera_programa: number) {
|
||||
return this.carreraProgramaService.delete(id_carrera_programa)
|
||||
@Delete()
|
||||
@ApiOperation({
|
||||
description:
|
||||
'Endpoint que borra la asociación entre una carrera y un programa.',
|
||||
})
|
||||
@ApiBody({
|
||||
description: '',
|
||||
examples: { ejemplo: { value: { id_carrera_programa: 1 } } },
|
||||
})
|
||||
delete(@Body() body: CarreraProgramaDeleteDto) {
|
||||
return this.carreraProgramaService.delete(body.id_carrera_programa);
|
||||
}
|
||||
|
||||
@Get()
|
||||
// @ApiOperation({
|
||||
// description: 'Nos trae todas las carrera-programa'
|
||||
// })
|
||||
get() {
|
||||
return this.carreraProgramaService.findAll();
|
||||
@ApiOperation({
|
||||
description:
|
||||
'Endpoint que retorna todos los programas reservados para una carrera de una institución.',
|
||||
})
|
||||
@ApiQuery({
|
||||
description: 'Id de la institución.',
|
||||
name: 'id_institucion',
|
||||
type: 'string',
|
||||
})
|
||||
get(@Query() query: IdInstitucionDto) {
|
||||
return this.carreraProgramaService.findByIdInstitucion(
|
||||
parseInt(query.id_institucion),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user