carrera-programa

This commit is contained in:
Andres2908
2022-04-24 19:09:22 -05:00
parent 0bf224d1d2
commit 2a6d0c6219
2 changed files with 12 additions and 24 deletions
@@ -47,25 +47,16 @@ export class CarreraProgramaService {
.findOne({ id_carrera_programa })
.then((carreraPrograma) => {
if (!carreraPrograma)
throw new NotFoundException('No existe esta carrera programa');
throw new NotFoundException('No existe esta carrera-programa');
return carreraPrograma;
});
}
// Eliminar update, no tiene sentido tenerlo, me equivoque xd
async update(attrs: Partial<CarreraPrograma>) {
const carreraPrograma = await this.findById(attrs.id_carrera_programa);
return this.repository
.findOne({ id_carrera_programa: attrs.id_carrera_programa })
.then((existeCarreraPrograma) => {
if (existeCarreraPrograma)
throw new ConflictException('Ya existe esta carrera programa');
Object.assign(carreraPrograma, attrs);
return this.repository.save(carreraPrograma);
})
.then(() => ({
message: 'Se actualizo correctamente la carrera programa',
}));
//No estoy seguro de que esto este bien :)
delete(id_carrera_programa: number) {
this.findById(id_carrera_programa)
.then(() => {
return this.repository.delete(id_carrera_programa)
})
}
}