feat: submission endpoint geimplementeerd (ongetest)
This commit is contained in:
parent
b3299949b0
commit
7c453467df
5 changed files with 85 additions and 10 deletions
25
backend/src/controllers/submissions.ts
Normal file
25
backend/src/controllers/submissions.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import { Request, Response } from "express";
|
||||
import { getSubmission } from "../services/submissions";
|
||||
import { Language } from "../entities/content/language";
|
||||
|
||||
interface SubmissionParams {
|
||||
lohruid: string,
|
||||
submissionNumber: number;
|
||||
}
|
||||
|
||||
export async function getSubmissionHandler(
|
||||
req: Request<SubmissionParams>,
|
||||
res: Response,
|
||||
): Promise<void> {
|
||||
const lohruid = req.params.lohruid;
|
||||
const submissionNumber = req.params.submissionNumber;
|
||||
|
||||
const submission = getSubmission(lohruid, Language.Dutch, '1', submissionNumber);
|
||||
|
||||
if (!submission) {
|
||||
res.status(404).json({ error: 'Submission not found' });
|
||||
return;
|
||||
}
|
||||
|
||||
res.json(submission);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue