fix(backend): Aangemaakt assignment werd niet teruggegeven.
Hier ontbreekte gewoon een await.
This commit is contained in:
		
							parent
							
								
									bec69863b4
								
							
						
					
					
						commit
						6e7a03f55b
					
				
					 2 changed files with 6 additions and 3 deletions
				
			
		|  | @ -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<AssignmentParams>, re | |||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     const assignment = createAssignment(classid, assignmentData); | ||||
|     const assignment = await createAssignment(classid, assignmentData); | ||||
| 
 | ||||
|     if (!assignment) { | ||||
|         res.status(500).json({ error: 'Could not create assignment ' }); | ||||
|  |  | |||
|  | @ -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<ClassDTO[] | string[]> { | ||||
|     const classRepository = getClassRepository(); | ||||
|  | @ -41,6 +44,7 @@ export async function createClass(classData: ClassDTO): Promise<Class | null> { | |||
| 
 | ||||
|         return newClass; | ||||
|     } catch (e) { | ||||
|         logger.error(e); | ||||
|         return null; | ||||
|     } | ||||
| } | ||||
|  |  | |||
		Reference in a new issue
	
	 Gerald Schmittinger
						Gerald Schmittinger