carrera-programa
This commit is contained in:
@@ -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)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user