revisar update y falta delete
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { ConflictException, Injectable } from '@nestjs/common';
|
||||
import { ConflictException, Injectable, NotFoundException } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { Repository } from 'typeorm';
|
||||
import { Programa } from './entity/programa.entity';
|
||||
@@ -23,4 +23,11 @@ export class ProgramaService {
|
||||
findAll() {
|
||||
return this.repository.find();
|
||||
}
|
||||
|
||||
findById(id_programa: number) {
|
||||
return this.repository.findOne({ id_programa }).then((programa) => {
|
||||
if(!programa) throw new NotFoundException('No existe este programa')
|
||||
return programa
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user