fixed entities

This commit is contained in:
2025-09-19 18:30:44 -06:00
parent 0a27caf7ed
commit 429678dc3b
15 changed files with 113 additions and 79 deletions
+1 -1
View File
@@ -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, {
+15 -1
View File
@@ -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