fix: cascade bij group entity

This commit is contained in:
Joyelle Ndagijimana 2025-04-23 11:00:12 +02:00
parent bb3a242bf9
commit 7823c45851

View file

@ -1,4 +1,4 @@
import { Collection, Entity, ManyToMany, ManyToOne, PrimaryKey } from '@mikro-orm/core'; import {Cascade, Collection, Entity, ManyToMany, ManyToOne, PrimaryKey} from '@mikro-orm/core';
import { Assignment } from './assignment.entity.js'; import { Assignment } from './assignment.entity.js';
import { Student } from '../users/student.entity.js'; import { Student } from '../users/student.entity.js';
import { GroupRepository } from '../../data/assignments/group-repository.js'; import { GroupRepository } from '../../data/assignments/group-repository.js';
@ -24,6 +24,7 @@ export class Group {
entity: () => Student, entity: () => Student,
owner: true, owner: true,
inversedBy: 'groups', inversedBy: 'groups',
cascade: [Cascade.ALL],
}) })
members: Collection<Student> = new Collection<Student>(this); members: Collection<Student> = new Collection<Student>(this);
} }