fix: integratie user + errors gefixt zodat het runt + format

This commit is contained in:
Gabriellvl 2025-03-09 23:59:31 +01:00
parent 6c4ea0eefb
commit 1b096b411b
55 changed files with 858 additions and 594 deletions

View file

@ -1,7 +1,7 @@
import { Request, Response } from 'express'
import { Request, Response } from 'express';
import { getAllAssignments, getAssignment } from '../services/assignments.js';
// typescript is annoy with with parameter forwarding from class.ts
// Typescript is annoy with with parameter forwarding from class.ts
interface AssignmentParams {
classid: string;
id: string;
@ -9,7 +9,7 @@ interface AssignmentParams {
export async function getAllAssignmentsHandler(
req: Request<AssignmentParams>,
res: Response,
res: Response
): Promise<void> {
const classid = req.params.classid;
const full = req.query.full === 'true';
@ -23,20 +23,20 @@ export async function getAllAssignmentsHandler(
export async function getAssignmentHandler(
req: Request<AssignmentParams>,
res: Response,
res: Response
): Promise<void> {
const id = +req.params.id;
const classid = req.params.classid;
if (isNaN(id)) {
res.status(400).json({ error: "Assignment id must be a number" });
res.status(400).json({ error: 'Assignment id must be a number' });
return;
}
const assignment = await getAssignment(classid, id);
if (!assignment) {
res.status(404).json({ error: "Assignment not found" });
res.status(404).json({ error: 'Assignment not found' });
return;
}