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 { getAllGroups, getGroup } from '../services/groups.js';
// typescript is annoywith with parameter forwarding from class.ts
// Typescript is annoywith with parameter forwarding from class.ts
interface GroupParams {
classid: string;
assignmentid: string;
@ -10,21 +10,21 @@ interface GroupParams {
export async function getGroupHandler(
req: Request<GroupParams>,
res: Response,
res: Response
): Promise<void> {
const classId = req.params.classid;
const full = req.query.full === "true";
const full = req.query.full === 'true';
const assignmentId = +req.params.assignmentid;
if (isNaN(assignmentId)) {
res.status(400).json({ error: "Assignment id must be a number" });
res.status(400).json({ error: 'Assignment id must be a number' });
return;
}
const groupId = +req.params.groupid!; // can't be undefined
const groupId = +req.params.groupid!; // Can't be undefined
if (isNaN(groupId)) {
res.status(400).json({ error: "Group id must be a number" });
res.status(400).json({ error: 'Group id must be a number' });
return;
}
@ -35,15 +35,15 @@ export async function getGroupHandler(
export async function getAllGroupsHandler(
req: Request,
res: Response,
res: Response
): Promise<void> {
const classId = req.params.classid;
const full = req.query.full === "true";
const full = req.query.full === 'true';
const assignmentId = +req.params.assignmentid;
if (isNaN(assignmentId)) {
res.status(400).json({ error: "Assignment id must be a number" });
res.status(400).json({ error: 'Assignment id must be a number' });
return;
}