feat: endpoints voor /, /:id en /:id/students in routes/class.ts zijn geimplementeerd

This commit is contained in:
Adriaan Jacquet 2025-03-05 16:31:27 +01:00
parent 123fdf0fa1
commit 241fe0103f
7 changed files with 95 additions and 34 deletions

View file

@ -4,7 +4,10 @@ import { Student } from '../../entities/users/student.entity.js';
export class ClassRepository extends DwengoEntityRepository<Class> {
public findById(id: string): Promise<Class | null> {
return this.findOne({ classId: id });
return this.findOne(
{ classId: id },
{ populate: ["students", "teachers"] },
);
}
public deleteById(id: string): Promise<void> {
return this.deleteWhere({ classId: id });