style: fix linting issues met Prettier
This commit is contained in:
		
							parent
							
								
									c7155fb438
								
							
						
					
					
						commit
						1dce9c65c6
					
				
					 3 changed files with 13 additions and 13 deletions
				
			
		|  | @ -23,8 +23,8 @@ import { GroupDTO } from '@dwengo-1/common/interfaces/group'; | ||||||
| import { SubmissionDTO, SubmissionDTOId } from '@dwengo-1/common/interfaces/submission'; | import { SubmissionDTO, SubmissionDTOId } from '@dwengo-1/common/interfaces/submission'; | ||||||
| import { QuestionDTO, QuestionId } from '@dwengo-1/common/interfaces/question'; | import { QuestionDTO, QuestionId } from '@dwengo-1/common/interfaces/question'; | ||||||
| import { ClassJoinRequestDTO } from '@dwengo-1/common/interfaces/class-join-request'; | import { ClassJoinRequestDTO } from '@dwengo-1/common/interfaces/class-join-request'; | ||||||
| import {BadRequestException} from "../exceptions/bad-request-exception"; | import { BadRequestException } from '../exceptions/bad-request-exception'; | ||||||
| import {ConflictException} from "../exceptions/conflict-exception"; | import { ConflictException } from '../exceptions/conflict-exception'; | ||||||
| 
 | 
 | ||||||
| export async function getAllStudents(full: boolean): Promise<StudentDTO[] | string[]> { | export async function getAllStudents(full: boolean): Promise<StudentDTO[] | string[]> { | ||||||
|     const studentRepository = getStudentRepository(); |     const studentRepository = getStudentRepository(); | ||||||
|  | @ -138,7 +138,7 @@ export async function createClassJoinRequest(username: string, classId: string): | ||||||
|     const cls = await fetchClass(classId); |     const cls = await fetchClass(classId); | ||||||
| 
 | 
 | ||||||
|     if (cls.students.contains(student)) { |     if (cls.students.contains(student)) { | ||||||
|         throw new ConflictException("Student already in this class"); |         throw new ConflictException('Student already in this class'); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     const request = mapToStudentRequest(student, cls); |     const request = mapToStudentRequest(student, cls); | ||||||
|  |  | ||||||
|  | @ -22,15 +22,15 @@ import { Question } from '../entities/questions/question.entity.js'; | ||||||
| import { ClassJoinRequestRepository } from '../data/classes/class-join-request-repository.js'; | import { ClassJoinRequestRepository } from '../data/classes/class-join-request-repository.js'; | ||||||
| import { Student } from '../entities/users/student.entity.js'; | import { Student } from '../entities/users/student.entity.js'; | ||||||
| import { NotFoundException } from '../exceptions/not-found-exception.js'; | import { NotFoundException } from '../exceptions/not-found-exception.js'; | ||||||
| import {addClassStudent, fetchClass, getClassStudents, getClassStudentsDTO} from './classes.js'; | import { addClassStudent, fetchClass, getClassStudents, getClassStudentsDTO } from './classes.js'; | ||||||
| import { TeacherDTO } from '@dwengo-1/common/interfaces/teacher'; | import { TeacherDTO } from '@dwengo-1/common/interfaces/teacher'; | ||||||
| import { ClassDTO } from '@dwengo-1/common/interfaces/class'; | import { ClassDTO } from '@dwengo-1/common/interfaces/class'; | ||||||
| import { StudentDTO } from '@dwengo-1/common/interfaces/student'; | import { StudentDTO } from '@dwengo-1/common/interfaces/student'; | ||||||
| import { QuestionDTO, QuestionId } from '@dwengo-1/common/interfaces/question'; | import { QuestionDTO, QuestionId } from '@dwengo-1/common/interfaces/question'; | ||||||
| import { ClassJoinRequestDTO } from '@dwengo-1/common/interfaces/class-join-request'; | import { ClassJoinRequestDTO } from '@dwengo-1/common/interfaces/class-join-request'; | ||||||
| import { ClassJoinRequestStatus } from '@dwengo-1/common/util/class-join-request'; | import { ClassJoinRequestStatus } from '@dwengo-1/common/util/class-join-request'; | ||||||
| import {BadRequestException} from "../exceptions/bad-request-exception"; | import { BadRequestException } from '../exceptions/bad-request-exception'; | ||||||
| import {ConflictException} from "../exceptions/conflict-exception"; | import { ConflictException } from '../exceptions/conflict-exception'; | ||||||
| 
 | 
 | ||||||
| export async function getAllTeachers(full: boolean): Promise<TeacherDTO[] | string[]> { | export async function getAllTeachers(full: boolean): Promise<TeacherDTO[] | string[]> { | ||||||
|     const teacherRepository: TeacherRepository = getTeacherRepository(); |     const teacherRepository: TeacherRepository = getTeacherRepository(); | ||||||
|  | @ -152,7 +152,7 @@ export async function updateClassJoinRequestStatus(studentUsername: string, clas | ||||||
|     const cls = await fetchClass(classId); |     const cls = await fetchClass(classId); | ||||||
| 
 | 
 | ||||||
|     if (cls.students.contains(student)) { |     if (cls.students.contains(student)) { | ||||||
|         throw new ConflictException("Student already in this class"); |         throw new ConflictException('Student already in this class'); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     const request: ClassJoinRequest | null = await requestRepo.findByStudentAndClass(student, cls); |     const request: ClassJoinRequest | null = await requestRepo.findByStudentAndClass(student, cls); | ||||||
|  | @ -163,7 +163,7 @@ export async function updateClassJoinRequestStatus(studentUsername: string, clas | ||||||
| 
 | 
 | ||||||
|     request.status = ClassJoinRequestStatus.Declined; |     request.status = ClassJoinRequestStatus.Declined; | ||||||
| 
 | 
 | ||||||
|     if (accepted){ |     if (accepted) { | ||||||
|         request.status = ClassJoinRequestStatus.Accepted; |         request.status = ClassJoinRequestStatus.Accepted; | ||||||
|         await addClassStudent(classId, studentUsername); |         await addClassStudent(classId, studentUsername); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | @ -16,7 +16,7 @@ import { BadRequestException } from '../../src/exceptions/bad-request-exception. | ||||||
| import { EntityAlreadyExistsException } from '../../src/exceptions/entity-already-exists-exception.js'; | import { EntityAlreadyExistsException } from '../../src/exceptions/entity-already-exists-exception.js'; | ||||||
| import { getStudentRequestsHandler } from '../../src/controllers/students.js'; | import { getStudentRequestsHandler } from '../../src/controllers/students.js'; | ||||||
| import { TeacherDTO } from '@dwengo-1/common/interfaces/teacher'; | import { TeacherDTO } from '@dwengo-1/common/interfaces/teacher'; | ||||||
| import {getClassHandler} from "../../src/controllers/classes"; | import { getClassHandler } from '../../src/controllers/classes'; | ||||||
| 
 | 
 | ||||||
| describe('Teacher controllers', () => { | describe('Teacher controllers', () => { | ||||||
|     let req: Partial<Request>; |     let req: Partial<Request>; | ||||||
|  | @ -183,7 +183,7 @@ describe('Teacher controllers', () => { | ||||||
| 
 | 
 | ||||||
|     it('Update join request status', async () => { |     it('Update join request status', async () => { | ||||||
|         req = { |         req = { | ||||||
|             params: { classId: 'id02', studentUsername: 'PinkFloyd'}, |             params: { classId: 'id02', studentUsername: 'PinkFloyd' }, | ||||||
|             body: { accepted: 'true' }, |             body: { accepted: 'true' }, | ||||||
|         }; |         }; | ||||||
| 
 | 
 | ||||||
|  | @ -201,11 +201,11 @@ describe('Teacher controllers', () => { | ||||||
|         expect(status).toBeTruthy(); |         expect(status).toBeTruthy(); | ||||||
| 
 | 
 | ||||||
|         req = { |         req = { | ||||||
|             params: { id: 'id02' } |             params: { id: 'id02' }, | ||||||
|         } |         }; | ||||||
| 
 | 
 | ||||||
|         await getClassHandler(req as Request, res as Response); |         await getClassHandler(req as Request, res as Response); | ||||||
|         const students: string[] = jsonMock.mock.lastCall?.[0].class.students; |         const students: string[] = jsonMock.mock.lastCall?.[0].class.students; | ||||||
|         expect(students).contains("PinkFloyd"); |         expect(students).contains('PinkFloyd'); | ||||||
|     }); |     }); | ||||||
| }); | }); | ||||||
|  |  | ||||||
		Reference in a new issue
	
	 Lint Action
						Lint Action