fix: return types enz gefixt services/assignments.ts
This commit is contained in:
		
							parent
							
								
									c52bcde3ae
								
							
						
					
					
						commit
						e562fad385
					
				
					 1 changed files with 5 additions and 8 deletions
				
			
		|  | @ -44,13 +44,12 @@ export async function createAssignment(classid: string, assignmentData: Assignme | |||
|     const cls = await fetchClass(classid); | ||||
| 
 | ||||
|     const assignment = mapToAssignment(assignmentData, cls); | ||||
|     const assignmentRepository = getAssignmentRepository(); | ||||
|      | ||||
|     const assignmentRepository = getAssignmentRepository(); | ||||
|     const newAssignment = assignmentRepository.create(assignment); | ||||
|     await assignmentRepository.save(newAssignment, {preventOverwrite: true}); | ||||
| 
 | ||||
|     return mapToAssignmentDTO(newAssignment); | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| export async function getAssignment(classid: string, id: number): Promise<AssignmentDTO> { | ||||
|  | @ -68,12 +67,10 @@ export async function getAssignmentsSubmissions( | |||
|     const groupRepository = getGroupRepository(); | ||||
|     const groups = await groupRepository.findAllGroupsForAssignment(assignment); | ||||
| 
 | ||||
|     if (groups.length === 0){ | ||||
|         throw new NotFoundException('No groups for assignment found'); | ||||
|     } | ||||
| 
 | ||||
|     const submissionRepository = getSubmissionRepository(); | ||||
|     const submissions = (await Promise.all(groups.map(async (group) => submissionRepository.findAllSubmissionsForGroup(group)))).flat(); | ||||
|     const submissions = (await Promise.all( | ||||
|         groups.map(async (group) => submissionRepository.findAllSubmissionsForGroup(group)) | ||||
|     )).flat(); | ||||
| 
 | ||||
|     if (full) { | ||||
|         return submissions.map(mapToSubmissionDTO); | ||||
|  | @ -96,5 +93,5 @@ export async function getAssignmentsQuestions( | |||
|         return questions.map(mapToQuestionDTO); | ||||
|     } | ||||
| 
 | ||||
|     return questions.map(mapToQuestionDTO); // mapToQuestionId should be updated
 | ||||
|     return questions.map(mapToQuestionDTO); | ||||
| } | ||||
		Reference in a new issue
	
	 Adriaan Jacquet
						Adriaan Jacquet