style: fix linting issues met Prettier
This commit is contained in:
		
							parent
							
								
									13e29d7d5f
								
							
						
					
					
						commit
						0862cb5c6b
					
				
					 4 changed files with 10 additions and 11 deletions
				
			
		|  | @ -14,14 +14,14 @@ import { mapToSubmissionDTO, mapToSubmissionDTOId } from '../interfaces/submissi | ||||||
| import { fetchClass } from './classes.js'; | import { fetchClass } from './classes.js'; | ||||||
| import { QuestionDTO, QuestionId } from '@dwengo-1/common/interfaces/question'; | import { QuestionDTO, QuestionId } from '@dwengo-1/common/interfaces/question'; | ||||||
| import { SubmissionDTO, SubmissionDTOId } from '@dwengo-1/common/interfaces/submission'; | import { SubmissionDTO, SubmissionDTOId } from '@dwengo-1/common/interfaces/submission'; | ||||||
| import {EntityDTO, ForeignKeyConstraintViolationException} from '@mikro-orm/core'; | import { EntityDTO, ForeignKeyConstraintViolationException } from '@mikro-orm/core'; | ||||||
| import { putObject } from './service-helper.js'; | import { putObject } from './service-helper.js'; | ||||||
| import { fetchStudents } from './students.js'; | import { fetchStudents } from './students.js'; | ||||||
| import { ServerErrorException } from '../exceptions/server-error-exception.js'; | import { ServerErrorException } from '../exceptions/server-error-exception.js'; | ||||||
| import { BadRequestException } from '../exceptions/bad-request-exception.js'; | import { BadRequestException } from '../exceptions/bad-request-exception.js'; | ||||||
| import {getQuestionsAboutLearningObjectInAssignment} from "./questions"; | import { getQuestionsAboutLearningObjectInAssignment } from './questions'; | ||||||
| import {LearningObjectIdentifier} from "../entities/content/learning-object-identifier"; | import { LearningObjectIdentifier } from '../entities/content/learning-object-identifier'; | ||||||
| import {ConflictException} from "../exceptions/conflict-exception"; | import { ConflictException } from '../exceptions/conflict-exception'; | ||||||
| 
 | 
 | ||||||
| export async function fetchAssignment(classid: string, assignmentNumber: number): Promise<Assignment> { | export async function fetchAssignment(classid: string, assignmentNumber: number): Promise<Assignment> { | ||||||
|     const classRepository = getClassRepository(); |     const classRepository = getClassRepository(); | ||||||
|  | @ -140,10 +140,9 @@ export async function deleteAssignment(classid: string, id: number): Promise<Ass | ||||||
|     try { |     try { | ||||||
|         await assignmentRepository.deleteByClassAndId(cls, id); |         await assignmentRepository.deleteByClassAndId(cls, id); | ||||||
|     } catch (e: ForeignKeyConstraintViolationException) { |     } catch (e: ForeignKeyConstraintViolationException) { | ||||||
|         throw new ConflictException("Cannot delete assigment with questions or submissions") |         throw new ConflictException('Cannot delete assigment with questions or submissions'); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
|     return mapToAssignmentDTO(assignment); |     return mapToAssignmentDTO(assignment); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -26,7 +26,7 @@ import { ClassJoinRequestDTO } from '@dwengo-1/common/interfaces/class-join-requ | ||||||
| import { ConflictException } from '../exceptions/conflict-exception.js'; | import { ConflictException } from '../exceptions/conflict-exception.js'; | ||||||
| import { Submission } from '../entities/assignments/submission.entity.js'; | import { Submission } from '../entities/assignments/submission.entity.js'; | ||||||
| import { mapToUsername } from '../interfaces/user.js'; | import { mapToUsername } from '../interfaces/user.js'; | ||||||
| import {mapToAssignmentDTO, mapToAssignmentDTOId} from "../interfaces/assignment"; | import { mapToAssignmentDTO, mapToAssignmentDTOId } from '../interfaces/assignment'; | ||||||
| 
 | 
 | ||||||
| export async function getAllStudents(full: boolean): Promise<StudentDTO[] | string[]> { | export async function getAllStudents(full: boolean): Promise<StudentDTO[] | string[]> { | ||||||
|     const studentRepository = getStudentRepository(); |     const studentRepository = getStudentRepository(); | ||||||
|  | @ -105,7 +105,7 @@ export async function getStudentAssignments(username: string, full: boolean): Pr | ||||||
| 
 | 
 | ||||||
|     const groupRepository = getGroupRepository(); |     const groupRepository = getGroupRepository(); | ||||||
|     const groups = await groupRepository.findAllGroupsWithStudent(student); |     const groups = await groupRepository.findAllGroupsWithStudent(student); | ||||||
|     const assignments = await Promise.all(groups.map( async group => await fetchAssignment(group.assignment.within.classId, group.assignment.id))); |     const assignments = await Promise.all(groups.map(async (group) => await fetchAssignment(group.assignment.within.classId, group.assignment.id))); | ||||||
| 
 | 
 | ||||||
|     if (full) { |     if (full) { | ||||||
|         return assignments.map(mapToAssignmentDTO); |         return assignments.map(mapToAssignmentDTO); | ||||||
|  |  | ||||||
|  | @ -13,7 +13,8 @@ import { | ||||||
|     createStudentRequestHandler, |     createStudentRequestHandler, | ||||||
|     getStudentRequestsHandler, |     getStudentRequestsHandler, | ||||||
|     deleteClassJoinRequestHandler, |     deleteClassJoinRequestHandler, | ||||||
|     getStudentRequestHandler, getStudentAssignmentsHandler, |     getStudentRequestHandler, | ||||||
|  |     getStudentAssignmentsHandler, | ||||||
| } from '../../src/controllers/students.js'; | } from '../../src/controllers/students.js'; | ||||||
| import { getDireStraits, getNoordkaap, getTheDoors, TEST_STUDENTS } from '../test_assets/users/students.testdata.js'; | import { getDireStraits, getNoordkaap, getTheDoors, TEST_STUDENTS } from '../test_assets/users/students.testdata.js'; | ||||||
| import { NotFoundException } from '../../src/exceptions/not-found-exception.js'; | import { NotFoundException } from '../../src/exceptions/not-found-exception.js'; | ||||||
|  | @ -163,7 +164,6 @@ describe('Student controllers', () => { | ||||||
|         expect(result.assignments).to.have.length.greaterThan(0); |         expect(result.assignments).to.have.length.greaterThan(0); | ||||||
|     }); |     }); | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
|     it('Student submissions', async () => { |     it('Student submissions', async () => { | ||||||
|         const submission = getSubmission01(); |         const submission = getSubmission01(); | ||||||
|         req = { params: { username: submission.submitter.username }, query: { full: 'true' } }; |         req = { params: { username: submission.submitter.username }, query: { full: 'true' } }; | ||||||
|  |  | ||||||
|  | @ -109,7 +109,7 @@ | ||||||
|                 }, |                 }, | ||||||
|                 onError: (e) => { |                 onError: (e) => { | ||||||
|                     showSnackbar(t("failed") + ": " + e.response.data.error || e.message, "error"); |                     showSnackbar(t("failed") + ": " + e.response.data.error || e.message, "error"); | ||||||
|                 } |                 }, | ||||||
|             }, |             }, | ||||||
|         ); |         ); | ||||||
|     } |     } | ||||||
|  |  | ||||||
		Reference in a new issue
	
	 Lint Action
						Lint Action