import { DwengoEntityRepository } from '../dwengo-entity-repository.js'; import { Class } from '../../entities/classes/class.entity.js'; import { Student } from '../../entities/users/student.entity.js'; import {Teacher} from "../../entities/users/teacher.entity"; export class ClassRepository extends DwengoEntityRepository { public findById(id: string): Promise { return this.findOne( { classId: id }, { populate: ["students", "teachers"] }, ); } public deleteById(id: string): Promise { return this.deleteWhere({ classId: id }); } public findByStudent(student: Student): Promise { return this.find( { students: student }, { populate: ["students", "teachers"] } // voegt student en teacher objecten toe ) } public findByTeacher(teacher: Teacher): Promise { return this.find( { teachers: teacher }, { populate: ["students", "teachers"] } ); } }