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);
|
||||||
|
|
|
@ -29,8 +29,8 @@ 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);
|
||||||
|
|
|
@ -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>;
|
||||||
|
@ -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');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue