db corregida
This commit is contained in:
@@ -7,6 +7,7 @@ import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { Repository } from 'typeorm';
|
||||
import { CarreraPrograma } from './entity/carrera-programa.entity';
|
||||
import { CarreraService } from '../carrera/carrera.service';
|
||||
import { InstitucionCarreraService } from '../institucion-carrera/institucion-carrera.service';
|
||||
import { ProgramaService } from '../programa/programa.service';
|
||||
|
||||
@Injectable()
|
||||
@@ -15,11 +16,14 @@ export class CarreraProgramaService {
|
||||
@InjectRepository(CarreraPrograma)
|
||||
private repository: Repository<CarreraPrograma>,
|
||||
private carreraService: CarreraService,
|
||||
private institucionCarreraService: InstitucionCarreraService,
|
||||
private programaService: ProgramaService,
|
||||
) {}
|
||||
|
||||
async create(id_carrera: number, id_programa: number) {
|
||||
const carrera = await this.carreraService.findById(id_carrera);
|
||||
async create(id_institucion_carrera: number, id_programa: number) {
|
||||
const carrera = await this.institucionCarreraService.findById(
|
||||
id_institucion_carrera,
|
||||
);
|
||||
const programa = await this.programaService.findById(id_programa);
|
||||
const nuevoCarreraPrograma = this.repository.create({
|
||||
carrera,
|
||||
@@ -54,9 +58,8 @@ export class CarreraProgramaService {
|
||||
|
||||
//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)
|
||||
})
|
||||
this.findById(id_carrera_programa).then(() => {
|
||||
return this.repository.delete(id_carrera_programa);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user