feat: submission endpoint geimplementeerd (ongetest)

This commit is contained in:
Adriaan Jacquet 2025-03-11 18:04:27 +01:00
parent b3299949b0
commit 7c453467df
5 changed files with 85 additions and 10 deletions

View file

@ -0,0 +1,22 @@
import { getSubmissionRepository } from "../data/repositories";
import { Language } from "../entities/content/language";
import { LearningObjectIdentifier } from "../entities/content/learning-object-identifier";
import { mapToSubmissionDTO, SubmissionDTO } from "../interfaces/submission";
export async function getSubmission(
learningObjectHruid: string,
language: Language,
version: string,
submissionNumber: number,
): Promise<SubmissionDTO | null> {
const loId = new LearningObjectIdentifier(learningObjectHruid, language, version);
const submissionRepository = getSubmissionRepository();
const submission = await submissionRepository.findSubmissionByLearningObjectAndSubmissionNumber(loId, submissionNumber);
if (!submission) {
return null;
}
return mapToSubmissionDTO(submission);
}