From a5e4f2437b51acd52e7b037681f387ee53b781ca Mon Sep 17 00:00:00 2001 From: Gabriellvl Date: Fri, 9 May 2025 18:20:06 +0200 Subject: [PATCH] fix: lint --- backend/src/middleware/auth/checks/class-auth-checks.ts | 2 +- backend/src/routes/answers.ts | 2 +- backend/src/routes/questions.ts | 4 ++-- backend/src/services/questions.ts | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/src/middleware/auth/checks/class-auth-checks.ts b/backend/src/middleware/auth/checks/class-auth-checks.ts index e85aaf3b..6af44827 100644 --- a/backend/src/middleware/auth/checks/class-auth-checks.ts +++ b/backend/src/middleware/auth/checks/class-auth-checks.ts @@ -50,7 +50,7 @@ export const onlyAllowIfInClassOrInvited = authorize(async (auth: Authentication const clazz = await fetchClass(classId); if (auth.accountType === 'teacher') { const invitations = await getAllInvitations(auth.username, false); - return clazz.teachers.map(mapToUsername).includes(auth.username) || invitations.some(invitation => invitation.classId == classId); + return clazz.teachers.map(mapToUsername).includes(auth.username) || invitations.some(invitation => invitation.classId === classId); } return clazz.students.map(mapToUsername).includes(auth.username); }); diff --git a/backend/src/routes/answers.ts b/backend/src/routes/answers.ts index 0944095f..58179197 100644 --- a/backend/src/routes/answers.ts +++ b/backend/src/routes/answers.ts @@ -1,6 +1,6 @@ import express from 'express'; import { createAnswerHandler, deleteAnswerHandler, getAnswerHandler, getAllAnswersHandler, updateAnswerHandler } from '../controllers/answers.js'; -import {adminOnly, authenticatedOnly, teachersOnly} from '../middleware/auth/checks/auth-checks.js'; +import { authenticatedOnly, teachersOnly } from '../middleware/auth/checks/auth-checks.js'; import { onlyAllowAuthor, onlyAllowAuthorRequestAnswer, onlyAllowIfHasAccessToQuestion } from '../middleware/auth/checks/question-checks.js'; const router = express.Router({ mergeParams: true }); diff --git a/backend/src/routes/questions.ts b/backend/src/routes/questions.ts index c4ffa442..6cad3c01 100644 --- a/backend/src/routes/questions.ts +++ b/backend/src/routes/questions.ts @@ -1,7 +1,7 @@ import express from 'express'; import { createQuestionHandler, deleteQuestionHandler, getAllQuestionsHandler, getQuestionHandler } from '../controllers/questions.js'; import answerRoutes from './answers.js'; -import {adminOnly, authenticatedOnly, studentsOnly} from '../middleware/auth/checks/auth-checks.js'; +import { authenticatedOnly, studentsOnly } from '../middleware/auth/checks/auth-checks.js'; import { updateAnswerHandler } from '../controllers/answers.js'; import { onlyAllowAuthor, onlyAllowAuthorRequest, onlyAllowIfHasAccessToQuestion } from '../middleware/auth/checks/question-checks.js'; @@ -12,7 +12,7 @@ const router = express.Router({ mergeParams: true }); // Root endpoint used to search objects router.get('/', authenticatedOnly, getAllQuestionsHandler); -router.post('/', studentsOnly, onlyAllowAuthor, createQuestionHandler); // TODO part of group +router.post('/', studentsOnly, onlyAllowAuthor, createQuestionHandler); // Information about a question with id router.get('/:seq', onlyAllowIfHasAccessToQuestion, getQuestionHandler); diff --git a/backend/src/services/questions.ts b/backend/src/services/questions.ts index 90b5d7dd..c6d978d8 100644 --- a/backend/src/services/questions.ts +++ b/backend/src/services/questions.ts @@ -111,7 +111,7 @@ export async function createQuestion(loId: LearningObjectIdentifier, questionDat const question = await questionRepository.createQuestion({ loId, author, - inGroup: inGroup!, + inGroup: inGroup, content, });