se agrego endpoint a institucion
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
import { IsNumber, IsOptional, IsInt } from 'class-validator';
|
||||
import { IsNumber, IsOptional, IsInt, IsBoolean } from 'class-validator';
|
||||
|
||||
export class InstitucionUpdateDto {
|
||||
@IsInt()
|
||||
id_institucion: number;
|
||||
|
||||
@IsBoolean()
|
||||
@IsOptional()
|
||||
activo: boolean;
|
||||
|
||||
@IsNumber()
|
||||
@IsOptional()
|
||||
dias_multa_retraso?: number;
|
||||
|
||||
@@ -2,8 +2,7 @@ import { Body, Controller, Get, Put, Query } from '@nestjs/common';
|
||||
import { InstitucionService } from './institucion.service';
|
||||
import { IdInstitucionDto } from '../dto/id-institucion.dto';
|
||||
import { InstitucionUpdateDto } from './dto/institucion-update.dto';
|
||||
import {ApiTags} from '@nestjs/swagger'
|
||||
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
|
||||
@Controller('institucion')
|
||||
@ApiTags('institucion')
|
||||
@@ -20,6 +19,11 @@ export class InstitucionController {
|
||||
return this.institucionService.findById(parseInt(query.id_institucion));
|
||||
}
|
||||
|
||||
@Get('instituciones-activo')
|
||||
institucionesActivo() {
|
||||
return this.institucionService.findByAllActivo();
|
||||
}
|
||||
|
||||
@Put()
|
||||
update(@Body() body: InstitucionUpdateDto) {
|
||||
return this.institucionService.update(body);
|
||||
|
||||
@@ -13,6 +13,10 @@ export class InstitucionService {
|
||||
return this.repository.find();
|
||||
}
|
||||
|
||||
findByAllActivo() {
|
||||
return this.repository.find({ activo: true });
|
||||
}
|
||||
|
||||
findById(id_institucion: number) {
|
||||
return this.repository.findOne({ id_institucion }).then((institucion) => {
|
||||
if (!institucion)
|
||||
|
||||
Reference in New Issue
Block a user