fix(backend): Kleinere fouten opgelost.

This commit is contained in:
Gerald Schmittinger 2025-03-13 21:35:55 +01:00
parent 6e7a03f55b
commit f199ceb945
3 changed files with 4 additions and 5 deletions

View file

@ -1,7 +1,6 @@
import { Request, Response } from 'express'; import { Request, Response } from 'express';
import { createClass, getAllClasses, getClass, getClassStudents, getClassStudentsIds, getClassTeacherInvitations } from '../services/class.js'; import { createClass, getAllClasses, getClass, getClassStudents, getClassStudentsIds, getClassTeacherInvitations } from '../services/class.js';
import { ClassDTO, mapToClass } from '../interfaces/class.js'; import { ClassDTO } from '../interfaces/class.js';
import { getClassRepository, getStudentRepository, getTeacherRepository } from '../data/repositories.js';
export async function getAllClassesHandler(req: Request, res: Response): Promise<void> { export async function getAllClassesHandler(req: Request, res: Response): Promise<void> {
const full = req.query.full === 'true'; const full = req.query.full === 'true';
@ -38,7 +37,7 @@ export async function getClassHandler(req: Request, res: Response): Promise<void
const cls = await getClass(classId); const cls = await getClass(classId);
if (!cls) { if (!cls) {
res.status(404).json({ error: 'Student not found' }); res.status(404).json({ error: 'Class not found' });
return; return;
} }
cls.endpoints = { cls.endpoints = {

View file

@ -59,7 +59,7 @@ export async function createGroupHandler(req: Request, res: Response): Promise<v
} }
const groupData = req.body as GroupDTO; const groupData = req.body as GroupDTO;
const group = createGroup(groupData, classid, assignmentId); const group = await createGroup(groupData, classid, assignmentId);
if (!group) { if (!group) {
res.status(500).json({ error: 'Something went wrong while creating group' }); res.status(500).json({ error: 'Something went wrong while creating group' });

View file

@ -18,7 +18,7 @@ export class Submission {
@PrimaryKey({ type: 'numeric' }) @PrimaryKey({ type: 'numeric' })
learningObjectVersion: number = 1; learningObjectVersion: number = 1;
@PrimaryKey({ type: 'integer' }) @PrimaryKey({ type: 'integer', autoincrement: true })
submissionNumber!: number; submissionNumber!: number;
@ManyToOne({ @ManyToOne({