style: fix linting issues met Prettier
This commit is contained in:
		
							parent
							
								
									5b00066106
								
							
						
					
					
						commit
						323d66bbcb
					
				
					 12 changed files with 908 additions and 898 deletions
				
			
		|  | @ -39,9 +39,9 @@ export async function getAllAssignmentsHandler(req: Request, res: Response): Pro | |||
| 
 | ||||
| export async function createAssignmentHandler(req: Request, res: Response): Promise<void> { | ||||
|     const classid = req.params.classid; | ||||
|     const description = req.body.description || ""; | ||||
|     const description = req.body.description || ''; | ||||
|     const language = req.body.language || FALLBACK_LANG; | ||||
|     const learningPath = req.body.learningPath || ""; | ||||
|     const learningPath = req.body.learningPath || ''; | ||||
|     const title = req.body.title; | ||||
| 
 | ||||
|     requireFields({ title }); | ||||
|  |  | |||
|  | @ -20,7 +20,7 @@ export class AssignmentRepository extends DwengoEntityRepository<Assignment> { | |||
|                     }, | ||||
|                 }, | ||||
|             }, | ||||
|             populate: ['groups', 'groups.members'] | ||||
|             populate: ['groups', 'groups.members'], | ||||
|         }); | ||||
|     } | ||||
|     public async findAllAssignmentsInClass(within: Class): Promise<Assignment[]> { | ||||
|  |  | |||
|  | @ -31,7 +31,6 @@ router.get('/:username/students', preventImpersonation, getTeacherStudentHandler | |||
| 
 | ||||
| router.get(`/:username/assignments`, getTeacherAssignmentsHandler); | ||||
| 
 | ||||
| 
 | ||||
| router.get('/:username/joinRequests/:classId', onlyAllowTeacherOfClass, getStudentJoinRequestHandler); | ||||
| 
 | ||||
| router.put('/:username/joinRequests/:classId/:studentUsername', onlyAllowTeacherOfClass, updateStudentJoinRequestHandler); | ||||
|  |  | |||
|  | @ -103,20 +103,22 @@ export async function putAssignment(classid: string, id: number, assignmentData: | |||
|     if (assignmentData.groups) { | ||||
|         const hasDuplicates = (arr: string[]) => new Set(arr).size !== arr.length; | ||||
|         if (hasDuplicates(assignmentData.groups.flat() as string[])) { | ||||
|             throw new BadRequestException("Student can only be in one group"); | ||||
|             throw new BadRequestException('Student can only be in one group'); | ||||
|         } | ||||
| 
 | ||||
|         const studentLists = await Promise.all((assignmentData.groups as string[][]).map(async group => await fetchStudents(group))); | ||||
|         const studentLists = await Promise.all((assignmentData.groups as string[][]).map(async (group) => await fetchStudents(group))); | ||||
| 
 | ||||
|         const groupRepository = getGroupRepository(); | ||||
|         await groupRepository.deleteAllByAssignment(assignment); | ||||
|         await Promise.all(studentLists.map(async students => { | ||||
|             const newGroup = groupRepository.create({ | ||||
|                 assignment: assignment, | ||||
|                 members: students, | ||||
|             }); | ||||
|             await groupRepository.save(newGroup); | ||||
|         })); | ||||
|         await Promise.all( | ||||
|             studentLists.map(async (students) => { | ||||
|                 const newGroup = groupRepository.create({ | ||||
|                     assignment: assignment, | ||||
|                     members: students, | ||||
|                 }); | ||||
|                 await groupRepository.save(newGroup); | ||||
|             }) | ||||
|         ); | ||||
| 
 | ||||
|         delete assignmentData.groups; | ||||
|     } | ||||
|  |  | |||
|  | @ -1,9 +1,4 @@ | |||
| import { | ||||
|     getAssignmentRepository, | ||||
|     getClassJoinRequestRepository, | ||||
|     getClassRepository, | ||||
|     getTeacherRepository, | ||||
| } from '../data/repositories.js'; | ||||
| import { getAssignmentRepository, getClassJoinRequestRepository, getClassRepository, getTeacherRepository } from '../data/repositories.js'; | ||||
| import { mapToClassDTO } from '../interfaces/class.js'; | ||||
| import { mapToTeacher, mapToTeacherDTO } from '../interfaces/teacher.js'; | ||||
| import { Teacher } from '../entities/users/teacher.entity.js'; | ||||
|  |  | |||
		Reference in a new issue
	
	 Lint Action
						Lint Action