style: fix linting issues met ESLint
This commit is contained in:
parent
b5390258e3
commit
e78849f568
21 changed files with 64 additions and 116 deletions
|
@ -83,7 +83,7 @@ export async function getGroupSubmissionsHandler(
|
|||
res: Response,
|
||||
): Promise<void> {
|
||||
const classId = req.params.classid;
|
||||
// const full = req.query.full === 'true';
|
||||
// Const full = req.query.full === 'true';
|
||||
|
||||
const assignmentId = +req.params.assignmentid;
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ function getQuestionId(req: Request, res: Response): QuestionId | null {
|
|||
const learningObjectIdentifier = getObjectId(req,res);
|
||||
|
||||
if (!learningObjectIdentifier)
|
||||
return null
|
||||
{return null}
|
||||
|
||||
return {
|
||||
learningObjectIdentifier,
|
||||
|
@ -48,28 +48,28 @@ export async function getAllQuestionsHandler(
|
|||
const full = req.query.full === 'true';
|
||||
|
||||
if (!objectId)
|
||||
return
|
||||
{return}
|
||||
|
||||
const questions = await getAllQuestions(objectId, full);
|
||||
|
||||
if (!questions)
|
||||
res.status(404).json({ error: `Questions not found.` });
|
||||
{res.status(404).json({ error: `Questions not found.` });}
|
||||
else
|
||||
res.json(questions);
|
||||
{res.json(questions);}
|
||||
}
|
||||
|
||||
export async function getQuestionHandler(req: Request, res: Response): Promise<void> {
|
||||
const questionId = getQuestionId(req, res);
|
||||
|
||||
if (!questionId)
|
||||
return
|
||||
{return}
|
||||
|
||||
const question = await getQuestion(questionId);
|
||||
|
||||
if (!question)
|
||||
res.status(404).json({ error: `Question not found.` });
|
||||
{res.status(404).json({ error: `Question not found.` });}
|
||||
else
|
||||
res.json(question)
|
||||
{res.json(question)}
|
||||
}
|
||||
|
||||
export async function getQuestionAnswersHandler(req: Request, res: Response): Promise<void> {
|
||||
|
@ -77,14 +77,14 @@ export async function getQuestionAnswersHandler(req: Request, res: Response): Pr
|
|||
const full = req.query.full === 'true';
|
||||
|
||||
if (!questionId)
|
||||
return
|
||||
{return}
|
||||
|
||||
const answers = getAnswersByQuestion(questionId, full);
|
||||
|
||||
if (!answers)
|
||||
res.status(404).json({ error: `Questions not found.` });
|
||||
{res.status(404).json({ error: `Questions not found.` });}
|
||||
else
|
||||
res.json(answers)
|
||||
{res.json(answers)}
|
||||
}
|
||||
|
||||
export async function createQuestionHandler(req: Request, res: Response): Promise<void> {
|
||||
|
@ -98,23 +98,23 @@ export async function createQuestionHandler(req: Request, res: Response): Promis
|
|||
const question = await createQuestion(questionDTO);
|
||||
|
||||
if (!question)
|
||||
res.status(400).json({error: 'Could not add question'});
|
||||
{res.status(400).json({error: 'Could not add question'});}
|
||||
else
|
||||
res.json(question)
|
||||
{res.json(question)}
|
||||
}
|
||||
|
||||
export async function deleteQuestionHandler(req: Request, res: Response): Promise<void> {
|
||||
const questionId = getQuestionId(req, res);
|
||||
|
||||
if (!questionId)
|
||||
return
|
||||
{return}
|
||||
|
||||
const question = await deleteQuestion(questionId);
|
||||
|
||||
if (!question)
|
||||
res.status(400).json({error: 'Could not find nor delete question'});
|
||||
{res.status(400).json({error: 'Could not find nor delete question'});}
|
||||
else
|
||||
res.json(question)
|
||||
{res.json(question)}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@ export async function getSubmissionHandler(
|
|||
return;
|
||||
}
|
||||
|
||||
let lang = languageMap[req.query.language as string] || Language.Dutch;
|
||||
let version = (req.query.version || 1) as number;
|
||||
const lang = languageMap[req.query.language as string] || Language.Dutch;
|
||||
const version = (req.query.version || 1) as number;
|
||||
|
||||
const submission = await getSubmission(lohruid, lang, version, submissionNumber);
|
||||
|
||||
|
@ -39,22 +39,22 @@ export async function createSubmissionHandler(req: Request, res: Response){
|
|||
const submission = await createSubmission(submissionDTO);
|
||||
|
||||
if (!submission)
|
||||
res.status(404).json({ error: 'Submission not added' });
|
||||
{res.status(404).json({ error: 'Submission not added' });}
|
||||
else
|
||||
res.json(submission)
|
||||
{res.json(submission)}
|
||||
}
|
||||
|
||||
export async function deleteSubmissionHandler(req: Request, res: Response){
|
||||
const hruid = req.params.hruid;
|
||||
const submissionNumber = +req.params.id;
|
||||
|
||||
let lang = languageMap[req.query.language as string] || Language.Dutch;
|
||||
let version = (req.query.version || 1) as number;
|
||||
const lang = languageMap[req.query.language as string] || Language.Dutch;
|
||||
const version = (req.query.version || 1) as number;
|
||||
|
||||
const submission = await deleteSubmission(hruid, lang, version, submissionNumber);
|
||||
|
||||
if (!submission)
|
||||
res.status(404).json({ error: 'Submission not found' });
|
||||
{res.status(404).json({ error: 'Submission not found' });}
|
||||
else
|
||||
res.json(submission)
|
||||
{res.json(submission)}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue