feat: (BROKEN) kolossale bug in POST group aan het fixen

This commit is contained in:
Adriaan Jacquet 2025-03-13 16:39:59 +01:00
parent 1b66493821
commit 53c85eadb0
6 changed files with 36 additions and 13 deletions

View file

@ -1,4 +1,5 @@
import {
Collection,
Entity,
Enum,
ManyToOne,
@ -50,5 +51,5 @@ export class Assignment {
},
mappedBy: 'assignment',
})
groups!: Group[];
groups!: Collection<Group>;
}

View file

@ -1,4 +1,4 @@
import { Entity, ManyToMany, ManyToOne, PrimaryKey } from '@mikro-orm/core';
import { Collection, Entity, ManyToMany, ManyToOne, PrimaryKey } from '@mikro-orm/core';
import { Assignment } from './assignment.entity.js';
import { Student } from '../users/student.entity.js';
import { GroupRepository } from '../../data/assignments/group-repository.js';
@ -20,10 +20,8 @@ export class Group {
@PrimaryKey({ type: 'integer', autoincrement: true })
groupNumber?: number;
@ManyToMany({
entity: () => {
return Student;
},
@ManyToMany(() => {
return Student;
})
members!: Student[];
members!: Collection<Student>;
}

View file

@ -19,4 +19,12 @@ export class Student extends User {
return Group;
})
groups!: Collection<Group>;
constructor(
public username: string,
public firstName: string,
public lastName: string
) {
super();
}
}