style: fix linting issues met Prettier
This commit is contained in:
parent
b963101f62
commit
34facfe7c8
12 changed files with 70 additions and 72 deletions
|
@ -1,8 +1,15 @@
|
|||
import { Request, Response } from 'express';
|
||||
import { createAssignment, deleteAssignment, getAllAssignments, getAssignment, getAssignmentsSubmissions, putAssignment } from '../services/assignments.js';
|
||||
import {
|
||||
createAssignment,
|
||||
deleteAssignment,
|
||||
getAllAssignments,
|
||||
getAssignment,
|
||||
getAssignmentsSubmissions,
|
||||
putAssignment,
|
||||
} from '../services/assignments.js';
|
||||
import { AssignmentDTO } from '@dwengo-1/common/interfaces/assignment';
|
||||
import {requireFields} from "./error-helper";
|
||||
import {BadRequestException} from "../exceptions/bad-request-exception";
|
||||
import { requireFields } from './error-helper';
|
||||
import { BadRequestException } from '../exceptions/bad-request-exception';
|
||||
import { getLogger } from '../logging/initalize.js';
|
||||
import { Assignment } from '../entities/assignments/assignment.entity.js';
|
||||
import { EntityDTO } from '@mikro-orm/core';
|
||||
|
@ -37,7 +44,7 @@ export async function getAssignmentHandler(req: Request, res: Response): Promise
|
|||
requireFields({ id, classid });
|
||||
|
||||
if (isNaN(id)) {
|
||||
throw new BadRequestException("Assignment id should be a number")
|
||||
throw new BadRequestException('Assignment id should be a number');
|
||||
}
|
||||
|
||||
const assignment = await getAssignment(classid, id);
|
||||
|
@ -51,7 +58,7 @@ export async function putAssignmentHandler(req: Request, res: Response): Promise
|
|||
requireFields({ id, classid });
|
||||
|
||||
if (isNaN(id)) {
|
||||
throw new BadRequestException("Assignment id should be a number")
|
||||
throw new BadRequestException('Assignment id should be a number');
|
||||
}
|
||||
|
||||
const assignmentData = req.body as Partial<EntityDTO<Assignment>>;
|
||||
|
@ -66,10 +73,10 @@ export async function deleteAssignmentHandler(req: Request, res: Response): Prom
|
|||
requireFields({ id, classid });
|
||||
|
||||
if (isNaN(id)) {
|
||||
throw new BadRequestException("Assignment id should be a number");
|
||||
throw new BadRequestException('Assignment id should be a number');
|
||||
}
|
||||
|
||||
const assignment = await deleteAssignment(classid, id);
|
||||
const assignment = await deleteAssignment(classid, id);
|
||||
}
|
||||
|
||||
export async function getAssignmentsSubmissionsHandler(req: Request, res: Response): Promise<void> {
|
||||
|
@ -79,7 +86,7 @@ export async function getAssignmentsSubmissionsHandler(req: Request, res: Respon
|
|||
requireFields({ assignmentNumber, classid });
|
||||
|
||||
if (isNaN(assignmentNumber)) {
|
||||
throw new BadRequestException("Assignment id should be a number")
|
||||
throw new BadRequestException('Assignment id should be a number');
|
||||
}
|
||||
|
||||
const submissions = await getAssignmentsSubmissions(classid, assignmentNumber, full);
|
||||
|
|
|
@ -11,10 +11,10 @@ import {
|
|||
getClassStudents,
|
||||
getClassTeacherInvitations,
|
||||
getClassTeachers,
|
||||
putClass
|
||||
putClass,
|
||||
} from '../services/classes.js';
|
||||
import { ClassDTO } from '@dwengo-1/common/interfaces/class';
|
||||
import {requireFields} from "./error-helper";
|
||||
import { requireFields } from './error-helper';
|
||||
import { EntityDTO } from '@mikro-orm/core';
|
||||
import { Class } from '../entities/classes/class.entity.js';
|
||||
|
||||
|
|
|
@ -7,19 +7,17 @@ import { Language, languageMap } from '@dwengo-1/common/util/language';
|
|||
import { SubmissionDTO } from '@dwengo-1/common/interfaces/submission';
|
||||
import { requireFields } from './error-helper.js';
|
||||
|
||||
|
||||
|
||||
export async function getSubmissionHandler(req: Request, res: Response): Promise<void> {
|
||||
const lohruid = req.params.hruid;
|
||||
const lang = languageMap[req.query.language as string] || Language.Dutch;
|
||||
const version = (req.query.version || 1) as number;
|
||||
const submissionNumber = Number(req.params.id);
|
||||
requireFields({ lohruid, submissionNumber });
|
||||
|
||||
|
||||
if (isNaN(submissionNumber)) {
|
||||
throw new BadRequestException('Submission number must be a number');
|
||||
}
|
||||
|
||||
|
||||
const loId = new LearningObjectIdentifier(lohruid, lang, version);
|
||||
const submission = await getSubmission(loId, submissionNumber);
|
||||
|
||||
|
@ -54,7 +52,7 @@ export async function deleteSubmissionHandler(req: Request, res: Response): Prom
|
|||
requireFields({ hruid, submissionNumber });
|
||||
|
||||
if (isNaN(submissionNumber)) {
|
||||
throw new BadRequestException('Submission number must be a number');
|
||||
throw new BadRequestException('Submission number must be a number');
|
||||
}
|
||||
|
||||
const loId = new LearningObjectIdentifier(hruid, lang, version);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue