feat(backend): Functionaliteit toegevoegd om alle submissions zichtbaar voor een bepaalde leerling of leerkracht op te vragen.

This commit is contained in:
Gerald Schmittinger 2025-04-07 19:23:46 +02:00
parent 03fa7c7b14
commit 9135b9c5b0
9 changed files with 338 additions and 156 deletions

View file

@ -6,6 +6,19 @@ export class AssignmentRepository extends DwengoEntityRepository<Assignment> {
public async findByClassAndId(within: Class, id: number): Promise<Assignment | null> {
return this.findOne({ within: within, id: id });
}
public async findAllByResponsibleTeacher(teacherUsername: string): Promise<Assignment[]> {
return this.findAll({
where: {
within: {
teachers: {
$some: {
username: teacherUsername
}
}
}
}
});
}
public async findAllAssignmentsInClass(within: Class): Promise<Assignment[]> {
return this.findAll({ where: { within: within } });
}