diff --git a/backend/src/controllers/assignments.ts b/backend/src/controllers/assignments.ts index 3db0e3f1..03332469 100644 --- a/backend/src/controllers/assignments.ts +++ b/backend/src/controllers/assignments.ts @@ -1,7 +1,6 @@ import { Request, Response } from 'express'; import { createAssignment, getAllAssignments, getAssignment, getAssignmentsSubmissions } from '../services/assignments.js'; -import { AssignmentDTO, mapToAssignment, mapToAssignmentDTO } from '../interfaces/assignment.js'; -import { getAssignmentRepository, getClassRepository } from '../data/repositories.js'; +import { AssignmentDTO } from '../interfaces/assignment.js'; // Typescript is annoy with with parameter forwarding from class.ts interface AssignmentParams { @@ -31,7 +30,7 @@ export async function createAssignmentHandler(req: Request, re return; } - const assignment = createAssignment(classid, assignmentData); + const assignment = await createAssignment(classid, assignmentData); if (!assignment) { res.status(500).json({ error: 'Could not create assignment ' }); diff --git a/backend/src/services/class.ts b/backend/src/services/class.ts index 46530327..390c6a32 100644 --- a/backend/src/services/class.ts +++ b/backend/src/services/class.ts @@ -3,6 +3,9 @@ import { Class } from '../entities/classes/class.entity.js'; import { ClassDTO, mapToClassDTO } from '../interfaces/class.js'; import { mapToStudentDTO, StudentDTO } from '../interfaces/student.js'; import { mapToTeacherInvitationDTO, mapToTeacherInvitationDTOIds, TeacherInvitationDTO } from '../interfaces/teacher-invitation.js'; +import {getLogger} from "../logging/initalize"; + +const logger = getLogger(); export async function getAllClasses(full: boolean): Promise { const classRepository = getClassRepository(); @@ -41,6 +44,7 @@ export async function createClass(classData: ClassDTO): Promise { return newClass; } catch (e) { + logger.error(e); return null; } }