fix: lint
This commit is contained in:
parent
c13788f269
commit
a5e4f2437b
4 changed files with 5 additions and 5 deletions
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -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 });
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -111,7 +111,7 @@ export async function createQuestion(loId: LearningObjectIdentifier, questionDat
|
|||
const question = await questionRepository.createQuestion({
|
||||
loId,
|
||||
author,
|
||||
inGroup: inGroup!,
|
||||
inGroup: inGroup,
|
||||
content,
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue