fix(backend): Update MikroORM, Fix voor 'pks not iterable' problem in Groups

This commit is contained in:
Gerald Schmittinger 2025-04-15 11:03:41 +02:00
parent 451ac7546f
commit 9c638b11f6
5 changed files with 57 additions and 53 deletions

View file

@ -35,5 +35,5 @@ export class Assignment {
entity: () => Group,
mappedBy: 'assignment',
})
groups!: Collection<Group>;
groups: Collection<Group> = new Collection<Group>(this);
}

View file

@ -7,15 +7,19 @@ import { GroupRepository } from '../../data/assignments/group-repository.js';
repository: () => GroupRepository,
})
export class Group {
@ManyToOne({
entity: () => Assignment,
primary: true,
})
assignment!: Assignment;
/*
WARNING: Don't move the definition of groupNumber! If it does not come before the definition of assignment,
creating groups fails because of a MikroORM bug!
*/
@PrimaryKey({ type: 'integer', autoincrement: true })
groupNumber?: number;
@ManyToOne({
entity: () => Assignment,
primary: true
})
assignment!: Assignment;
@ManyToMany({
entity: () => Student,
owner: true,