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

@ -3,6 +3,7 @@ import { Group } from '../../entities/assignments/group.entity.js';
import { Submission } from '../../entities/assignments/submission.entity.js';
import { LearningObjectIdentifier } from '../../entities/content/learning-object-identifier.js';
import { Student } from '../../entities/users/student.entity.js';
import {Assignment} from "../../entities/assignments/assignment.entity";
export class SubmissionRepository extends DwengoEntityRepository<Submission> {
public async findSubmissionByLearningObjectAndSubmissionNumber(
@ -50,6 +51,30 @@ export class SubmissionRepository extends DwengoEntityRepository<Submission> {
);
}
public async findAllSubmissionsForAllGroupsOfStudent(studentUsername: string): Promise<Submission[]> {
return this.findAll({
where: {
onBehalfOf: {
members: {
$some: {
username: studentUsername
}
},
}
}
});
}
public async findAllSubmissionsForAssignment(assignment: Assignment): Promise<Submission[]> {
return this.findAll({
where: {
onBehalfOf: {
assignment
}
}
});
}
public async findAllSubmissionsForStudent(student: Student): Promise<Submission[]> {
return this.find(
{ submitter: student },