merge: merge fix/183-post-assignment into dev

This commit is contained in:
Adriaan Jacquet 2025-04-17 18:51:17 +02:00
commit 5a593cb88f
67 changed files with 2205 additions and 2129 deletions

View file

@ -6,6 +6,22 @@ export class AssignmentRepository extends DwengoEntityRepository<Assignment> {
public async findByClassAndId(within: Class, id: number): Promise<Assignment | null> {
return this.findOne({ within: within, id: id }, { populate: [ "groups", "groups.members" ]});
}
public async findByClassIdAndAssignmentId(withinClass: string, id: number): Promise<Assignment | null> {
return this.findOne({ within: { classId: withinClass }, 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 }, populate: [ "groups", "groups.members" ] });
}