diff --git a/backend/src/data/assignments/assignment-repository.ts b/backend/src/data/assignments/assignment-repository.ts index 1c8bb504..9d04d6e2 100644 --- a/backend/src/data/assignments/assignment-repository.ts +++ b/backend/src/data/assignments/assignment-repository.ts @@ -7,7 +7,7 @@ export class AssignmentRepository extends DwengoEntityRepository { return this.findOne({ within: within, id: id }, { populate: ['groups', 'groups.members'] }); } public async findByClassIdAndAssignmentId(withinClass: string, id: number): Promise { - return this.findOne({ within: { classId: withinClass }, id: id }); + return this.findOne({ within: { classId: withinClass }, id: id }, { populate: ['groups', 'groups.members'] }); } public async findAllByResponsibleTeacher(teacherUsername: string): Promise { return this.findAll({ @@ -20,6 +20,7 @@ export class AssignmentRepository extends DwengoEntityRepository { }, }, }, + populate: ['groups', 'groups.members'] }); } public async findAllAssignmentsInClass(within: Class): Promise { diff --git a/backend/src/services/assignments.ts b/backend/src/services/assignments.ts index 2379ecfb..728904d3 100644 --- a/backend/src/services/assignments.ts +++ b/backend/src/services/assignments.ts @@ -43,6 +43,8 @@ export async function getAllAssignments(classid: string, full: boolean): Promise const assignmentRepository = getAssignmentRepository(); const assignments = await assignmentRepository.findAllAssignmentsInClass(cls); + console.log(assignments); + if (full) { return assignments.map(mapToAssignmentDTO); }