fixed entities
This commit is contained in:
@@ -84,7 +84,7 @@ export class Alumno {
|
||||
@Column({ name: 'generacion', type: 'int', width: 4, nullable: true })
|
||||
generacion: number | null;
|
||||
|
||||
@OneToMany(() => DetalleServicio, (detalle) => detalle.id_cuenta)
|
||||
@OneToMany(() => DetalleServicio, (detalle) => detalle.alum)
|
||||
detalles_servicio: DetalleServicio[];
|
||||
|
||||
@ManyToOne(() => Carrera, (carrera) => carrera.estudiantes, {
|
||||
|
||||
@@ -36,7 +36,7 @@ export class AlumnoService {
|
||||
return student.credito;
|
||||
}
|
||||
|
||||
async UpdateCredit(
|
||||
async collectCredit(
|
||||
id_cuenta: number,
|
||||
credit: number,
|
||||
manager: EntityManager,
|
||||
@@ -49,5 +49,19 @@ export class AlumnoService {
|
||||
.where({ id_cuenta })
|
||||
.execute();
|
||||
}
|
||||
|
||||
async addCredit(
|
||||
id_cuenta: number,
|
||||
credit: number,
|
||||
manager: EntityManager,
|
||||
) {
|
||||
const repo = manager.getRepository(Alumno);
|
||||
return await repo
|
||||
.createQueryBuilder()
|
||||
.update()
|
||||
.set({ credito: () => `credito + ${credit}` })
|
||||
.where({ id_cuenta })
|
||||
.execute();
|
||||
}
|
||||
}
|
||||
//IO
|
||||
Reference in New Issue
Block a user