revisar update y falta delete

This commit is contained in:
Andres2908
2022-04-20 23:22:34 -05:00
parent 8f480f1317
commit b386bd61e8
7 changed files with 106 additions and 8 deletions
+8 -1
View File
@@ -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
})
}
}