2022-04-24 21:25:15 -05:00
|
|
|
import { Body, Controller, Delete, Get, Param, Post } from '@nestjs/common';
|
2022-04-04 20:53:32 -05:00
|
|
|
import { CarreraProgramaService } from './carrera-programa.service';
|
2022-04-22 13:36:18 -05:00
|
|
|
import { CarreraProgramaCreateDto } from './dto/carrera-programa-create.dto';
|
|
|
|
|
import { CarreraProgramaUpdateDto } from './dto/carrera-programa-update.dto';
|
2022-05-04 09:38:48 -05:00
|
|
|
import {ApiOperation, ApiTags} from '@nestjs/swagger'
|
2022-03-31 14:33:11 -06:00
|
|
|
|
|
|
|
|
@Controller('carrera-programa')
|
2022-04-30 21:18:19 -05:00
|
|
|
@ApiTags('carrera-programa')
|
2022-04-04 20:53:32 -05:00
|
|
|
export class CarreraProgramaController {
|
|
|
|
|
constructor(private carreraProgramaService: CarreraProgramaService) {}
|
2022-04-17 20:47:35 -05:00
|
|
|
|
2022-04-17 20:56:02 -05:00
|
|
|
@Post()
|
2022-05-04 09:38:48 -05:00
|
|
|
@ApiOperation({
|
|
|
|
|
description: 'Creamos una carrera programa, pasandole los parametros id_carrera y id_programa'
|
|
|
|
|
})
|
2022-04-20 23:22:34 -05:00
|
|
|
create(@Body() body: CarreraProgramaCreateDto) {
|
2022-04-22 13:36:18 -05:00
|
|
|
return this.carreraProgramaService.create(
|
|
|
|
|
body.id_carrera,
|
|
|
|
|
body.id_programa,
|
|
|
|
|
);
|
2022-04-20 23:22:34 -05:00
|
|
|
}
|
2022-04-17 20:56:02 -05:00
|
|
|
|
2022-04-24 19:09:22 -05:00
|
|
|
@Delete(':id')
|
2022-05-04 09:38:48 -05:00
|
|
|
@ApiOperation({
|
|
|
|
|
description: 'Borramos una carrera programa a partir del id (id_carrera_programa)'
|
|
|
|
|
})
|
2022-04-24 19:09:22 -05:00
|
|
|
delete(@Param('id') id_carrera_programa: number) {
|
|
|
|
|
return this.carreraProgramaService.delete(id_carrera_programa)
|
|
|
|
|
}
|
2022-04-17 20:56:02 -05:00
|
|
|
|
|
|
|
|
@Get()
|
2022-05-04 09:38:48 -05:00
|
|
|
@ApiOperation({
|
|
|
|
|
description: 'Nos trae todas las carrera-programa'
|
|
|
|
|
})
|
2022-04-20 23:22:34 -05:00
|
|
|
get() {
|
2022-04-22 13:36:18 -05:00
|
|
|
return this.carreraProgramaService.findAll();
|
2022-04-20 23:22:34 -05:00
|
|
|
}
|
2022-04-04 20:53:32 -05:00
|
|
|
}
|