2022-04-16 13:05:27 -05:00
|
|
|
import { Body, Controller, Get, Post, Put, Query } from '@nestjs/common';
|
2022-04-04 20:02:54 -05:00
|
|
|
import { ModuloService } from './modulo.service';
|
2022-04-16 11:21:52 -05:00
|
|
|
// import { Serealize } from '../interceptors/serialize.interceptor';
|
2022-04-06 15:27:23 -05:00
|
|
|
import { IdInstitucionDto } from '../dto/id-institucion.dto';
|
2022-04-16 13:05:27 -05:00
|
|
|
import { ModuloCrearDto } from './dto/modulo-crear.dto';
|
|
|
|
|
import { ModuloUpdateDto } from './dto/modulo-update.dto';
|
2022-03-29 22:03:19 -06:00
|
|
|
@Controller('modulo')
|
2022-04-04 20:02:54 -05:00
|
|
|
export class ModuloController {
|
|
|
|
|
constructor(private moduloService: ModuloService) {}
|
|
|
|
|
|
2022-04-16 11:21:52 -05:00
|
|
|
@Get('modulos')
|
2022-04-06 15:27:23 -05:00
|
|
|
get(@Query() query: IdInstitucionDto) {
|
2022-04-16 11:21:52 -05:00
|
|
|
return this.moduloService.findAllByIdInstitucion(
|
|
|
|
|
Number(query.id_institucion),
|
|
|
|
|
);
|
2022-04-06 15:27:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Post()
|
2022-04-16 13:05:27 -05:00
|
|
|
create(@Body() body: ModuloCrearDto) {
|
2022-04-16 11:21:52 -05:00
|
|
|
return this.moduloService.create(body.id_institucion, body.modulo);
|
2022-04-06 15:27:23 -05:00
|
|
|
}
|
2022-04-16 13:05:27 -05:00
|
|
|
|
|
|
|
|
@Put()
|
|
|
|
|
update(@Body() body: ModuloUpdateDto) {
|
|
|
|
|
return this.moduloService.update(body);
|
|
|
|
|
}
|
2022-04-04 20:02:54 -05:00
|
|
|
}
|