no se2
This commit is contained in:
parent
e4c9bf2622
commit
03a886237f
@ -7,6 +7,6 @@ export class InstitucionController {
|
|||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
get() {
|
get() {
|
||||||
return this.institucionService.findAllInstitucion();
|
return this.institucionService.findAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Injectable } from '@nestjs/common';
|
import { Injectable, NotFoundException } from '@nestjs/common';
|
||||||
import { Repository } from 'typeorm';
|
import { Repository } from 'typeorm';
|
||||||
import { InjectRepository } from '@nestjs/typeorm';
|
import { InjectRepository } from '@nestjs/typeorm';
|
||||||
import { Institucion } from './institucion.entity';
|
import { Institucion } from './institucion.entity';
|
||||||
@ -9,7 +9,15 @@ export class InstitucionService {
|
|||||||
@InjectRepository(Institucion) private repository: Repository<Institucion>,
|
@InjectRepository(Institucion) private repository: Repository<Institucion>,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
findAllInstitucion() {
|
findAll() {
|
||||||
return this.repository.find();
|
return this.repository.find();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
findById(id_institucion: number) {
|
||||||
|
const institucion = this.repository.find({ where: { id_institucion } });
|
||||||
|
|
||||||
|
if (!institucion)
|
||||||
|
throw new NotFoundException('No existe esta institución.');
|
||||||
|
return institucion;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user