2022-04-16 18:05:27 +00:00
|
|
|
import { Body, Controller, Get, Post, Put, Query } from '@nestjs/common';
|
2022-04-05 01:02:54 +00:00
|
|
|
import { ModuloService } from './modulo.service';
|
2022-04-06 20:27:23 +00:00
|
|
|
import { IdInstitucionDto } from '../dto/id-institucion.dto';
|
2022-04-18 21:55:19 +00:00
|
|
|
import { ModuloCreateDto } from './dto/modulo-create.dto';
|
2022-04-16 18:05:27 +00:00
|
|
|
import { ModuloUpdateDto } from './dto/modulo-update.dto';
|
2022-05-01 02:18:19 +00:00
|
|
|
import {ApiTags} from '@nestjs/swagger'
|
2022-04-18 03:01:41 +00:00
|
|
|
// import { Serealize } from '../interceptors/serialize.interceptor';
|
2022-05-01 02:18:19 +00:00
|
|
|
|
2022-03-30 04:03:19 +00:00
|
|
|
@Controller('modulo')
|
2022-05-01 02:18:19 +00:00
|
|
|
@ApiTags('modulo')
|
2022-04-05 01:02:54 +00:00
|
|
|
export class ModuloController {
|
|
|
|
constructor(private moduloService: ModuloService) {}
|
|
|
|
|
2022-04-16 19:37:17 +00:00
|
|
|
@Post()
|
2022-04-18 21:55:19 +00:00
|
|
|
create(@Body() body: ModuloCreateDto) {
|
2022-04-16 19:37:17 +00:00
|
|
|
return this.moduloService.create(body.id_institucion, body.modulo);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Get()
|
2022-04-16 18:46:44 +00:00
|
|
|
get() {
|
|
|
|
return this.moduloService.findAll();
|
|
|
|
}
|
|
|
|
|
2022-04-16 16:21:52 +00:00
|
|
|
@Get('modulos')
|
2022-04-16 19:37:17 +00:00
|
|
|
modulos(@Query() query: IdInstitucionDto) {
|
2022-04-16 16:21:52 +00:00
|
|
|
return this.moduloService.findAllByIdInstitucion(
|
|
|
|
Number(query.id_institucion),
|
|
|
|
);
|
2022-04-06 20:27:23 +00:00
|
|
|
}
|
|
|
|
|
2022-04-16 18:05:27 +00:00
|
|
|
@Put()
|
|
|
|
update(@Body() body: ModuloUpdateDto) {
|
|
|
|
return this.moduloService.update(body);
|
|
|
|
}
|
2022-04-05 01:02:54 +00:00
|
|
|
}
|