fix: fixed syntax & typescript errors

This commit is contained in:
Adriaan Jacquet 2025-04-22 16:56:03 +02:00
parent a4ccae6c0d
commit b4b9abcc48

View file

@ -1,7 +1,7 @@
import {authorize} from "./auth-checks";
import {AuthenticationInfo} from "../authentication-info";
import {AuthenticatedRequest} from "../authenticated-request";
import {getGroup} from "../../../services/groups";
import {fetchGroup, getGroup} from "../../../services/groups";
/**
* Only allows requests whose learning path personalization query parameters ('forGroup' / 'assignmentNo' / 'classId')
@ -13,9 +13,10 @@ import {getGroup} from "../../../services/groups";
export const onlyAllowPersonalizationForOwnGroup = authorize(
async (auth: AuthenticationInfo, req: AuthenticatedRequest) => {
const {forGroup, assignmentNo, classId} = req.params;
if (forGroup && assignmentNo && classId) {
const group = getGroup(forGroup, parseInt(assignmentNo), classId, false);
if (auth.accountType === "student" && forGroup && assignmentNo && classId) {
// TODO: groupNumber?
// const group = await fetchGroup(Number(classId), Number(assignmentNo), )
return false;
} else {
return true;
}