From bb2eacdc4c75e4018b18a2f006aceddeb0b54c3f Mon Sep 17 00:00:00 2001 From: Lint Action Date: Thu, 15 May 2025 19:01:10 +0000 Subject: [PATCH] style: fix linting issues met Prettier --- backend/src/controllers/auth.ts | 2 +- .../middleware/auth/checks/assignment-auth-checks.ts | 2 +- backend/src/middleware/auth/checks/auth-checks.ts | 2 +- .../src/middleware/auth/checks/class-auth-checks.ts | 2 +- .../src/middleware/auth/checks/group-auth-checker.ts | 2 +- .../auth/checks/learning-content-auth-checks.ts | 2 +- backend/src/middleware/auth/checks/question-checks.ts | 2 +- .../src/middleware/auth/checks/submission-checks.ts | 2 +- backend/src/services/teachers.ts | 8 ++------ common/src/util/account-types.ts | 2 +- frontend/src/components/SingleQuestion.vue | 2 +- frontend/src/views/LoginPage.vue | 2 +- frontend/src/views/assignments/CreateAssignment.vue | 2 +- frontend/src/views/assignments/SingleAssignment.vue | 2 +- frontend/src/views/assignments/UserAssignments.vue | 2 +- frontend/src/views/classes/UserClasses.vue | 2 +- frontend/src/views/learning-paths/LearningPathPage.vue | 10 +++++++--- .../learning-object/LearningObjectView.vue | 2 +- .../learning-object/submissions/SubmitButton.vue | 2 +- 19 files changed, 26 insertions(+), 26 deletions(-) diff --git a/backend/src/controllers/auth.ts b/backend/src/controllers/auth.ts index 2daace17..0a249c5b 100644 --- a/backend/src/controllers/auth.ts +++ b/backend/src/controllers/auth.ts @@ -5,7 +5,7 @@ import { envVars, getEnvVar } from '../util/envVars.js'; import { createOrUpdateStudent } from '../services/students.js'; import { Request, Response } from 'express'; import { createOrUpdateTeacher } from '../services/teachers.js'; -import {AccountType} from "@dwengo-1/common/util/account-types"; +import { AccountType } from '@dwengo-1/common/util/account-types'; interface FrontendIdpConfig { authority: string; diff --git a/backend/src/middleware/auth/checks/assignment-auth-checks.ts b/backend/src/middleware/auth/checks/assignment-auth-checks.ts index c812ef43..bd9f51d7 100644 --- a/backend/src/middleware/auth/checks/assignment-auth-checks.ts +++ b/backend/src/middleware/auth/checks/assignment-auth-checks.ts @@ -2,7 +2,7 @@ import { authorize } from './auth-checks.js'; import { fetchClass } from '../../../services/classes.js'; import { fetchAllGroups } from '../../../services/groups.js'; import { mapToUsername } from '../../../interfaces/user.js'; -import {AccountType} from "@dwengo-1/common/util/account-types"; +import { AccountType } from '@dwengo-1/common/util/account-types'; /** * Expects the path to contain the path parameters 'classId' and 'id' (meaning the ID of the assignment). diff --git a/backend/src/middleware/auth/checks/auth-checks.ts b/backend/src/middleware/auth/checks/auth-checks.ts index 2658c3b6..bf4891a3 100644 --- a/backend/src/middleware/auth/checks/auth-checks.ts +++ b/backend/src/middleware/auth/checks/auth-checks.ts @@ -5,7 +5,7 @@ import { RequestHandler } from 'express'; import { UnauthorizedException } from '../../../exceptions/unauthorized-exception.js'; import { ForbiddenException } from '../../../exceptions/forbidden-exception.js'; import { envVars, getEnvVar } from '../../../util/envVars.js'; -import {AccountType} from "@dwengo-1/common/util/account-types"; +import { AccountType } from '@dwengo-1/common/util/account-types'; /** * Middleware which rejects unauthenticated users (with HTTP 401) and authenticated users which do not fulfill diff --git a/backend/src/middleware/auth/checks/class-auth-checks.ts b/backend/src/middleware/auth/checks/class-auth-checks.ts index a1dcce52..ea75d21d 100644 --- a/backend/src/middleware/auth/checks/class-auth-checks.ts +++ b/backend/src/middleware/auth/checks/class-auth-checks.ts @@ -4,7 +4,7 @@ import { AuthenticatedRequest } from '../authenticated-request.js'; import { fetchClass } from '../../../services/classes.js'; import { mapToUsername } from '../../../interfaces/user.js'; import { getAllInvitations } from '../../../services/teacher-invitations.js'; -import {AccountType} from "@dwengo-1/common/util/account-types"; +import { AccountType } from '@dwengo-1/common/util/account-types'; async function teaches(teacherUsername: string, classId: string): Promise { const clazz = await fetchClass(classId); diff --git a/backend/src/middleware/auth/checks/group-auth-checker.ts b/backend/src/middleware/auth/checks/group-auth-checker.ts index 408dee7d..563edf57 100644 --- a/backend/src/middleware/auth/checks/group-auth-checker.ts +++ b/backend/src/middleware/auth/checks/group-auth-checker.ts @@ -2,7 +2,7 @@ import { authorize } from './auth-checks.js'; import { fetchClass } from '../../../services/classes.js'; import { fetchGroup } from '../../../services/groups.js'; import { mapToUsername } from '../../../interfaces/user.js'; -import {AccountType} from "@dwengo-1/common/util/account-types"; +import { AccountType } from '@dwengo-1/common/util/account-types'; /** * Expects the path to contain the path parameters 'classid', 'assignmentid' and 'groupid'. diff --git a/backend/src/middleware/auth/checks/learning-content-auth-checks.ts b/backend/src/middleware/auth/checks/learning-content-auth-checks.ts index fde71181..6942b425 100644 --- a/backend/src/middleware/auth/checks/learning-content-auth-checks.ts +++ b/backend/src/middleware/auth/checks/learning-content-auth-checks.ts @@ -1,7 +1,7 @@ import { authorize } from './auth-checks'; import { AuthenticationInfo } from '../authentication-info'; import { AuthenticatedRequest } from '../authenticated-request'; -import {AccountType} from "@dwengo-1/common/util/account-types"; +import { AccountType } from '@dwengo-1/common/util/account-types'; /** * Only allows requests whose learning path personalization query parameters ('forGroup' / 'assignmentNo' / 'classId') diff --git a/backend/src/middleware/auth/checks/question-checks.ts b/backend/src/middleware/auth/checks/question-checks.ts index fa306f8c..76ede049 100644 --- a/backend/src/middleware/auth/checks/question-checks.ts +++ b/backend/src/middleware/auth/checks/question-checks.ts @@ -7,7 +7,7 @@ import { fetchQuestion } from '../../../services/questions.js'; import { FALLBACK_SEQ_NUM } from '../../../config.js'; import { fetchAnswer } from '../../../services/answers.js'; import { mapToUsername } from '../../../interfaces/user.js'; -import {AccountType} from "@dwengo-1/common/util/account-types"; +import { AccountType } from '@dwengo-1/common/util/account-types'; export const onlyAllowAuthor = authorize( (auth: AuthenticationInfo, req: AuthenticatedRequest) => (req.body as { author: string }).author === auth.username diff --git a/backend/src/middleware/auth/checks/submission-checks.ts b/backend/src/middleware/auth/checks/submission-checks.ts index df7282f6..893371c2 100644 --- a/backend/src/middleware/auth/checks/submission-checks.ts +++ b/backend/src/middleware/auth/checks/submission-checks.ts @@ -6,7 +6,7 @@ import { AuthenticationInfo } from '../authentication-info.js'; import { authorize } from './auth-checks.js'; import { FALLBACK_LANG } from '../../../config.js'; import { mapToUsername } from '../../../interfaces/user.js'; -import {AccountType} from "@dwengo-1/common/util/account-types"; +import { AccountType } from '@dwengo-1/common/util/account-types'; export const onlyAllowSubmitter = authorize( (auth: AuthenticationInfo, req: AuthenticatedRequest) => (req.body as { submitter: string }).submitter === auth.username diff --git a/backend/src/services/teachers.ts b/backend/src/services/teachers.ts index 3d59d72b..3d07960f 100644 --- a/backend/src/services/teachers.ts +++ b/backend/src/services/teachers.ts @@ -100,13 +100,9 @@ export async function getStudentsByTeacher(username: string, full: boolean): Pro const classIds: string[] = classes.map((cls) => cls.id); - const students: StudentDTO[] = (await Promise.all( - classIds.map(async (classId) => await getClassStudentsDTO(classId)) - )) + const students: StudentDTO[] = (await Promise.all(classIds.map(async (classId) => await getClassStudentsDTO(classId)))) .flat() - .filter((student, index, self) => - self.findIndex((s) => s.username === student.username) === index - ); + .filter((student, index, self) => self.findIndex((s) => s.username === student.username) === index); if (full) { return students; diff --git a/common/src/util/account-types.ts b/common/src/util/account-types.ts index 61c761dc..f0957019 100644 --- a/common/src/util/account-types.ts +++ b/common/src/util/account-types.ts @@ -1,4 +1,4 @@ export enum AccountType { Student = 'student', - Teacher = 'teacher' + Teacher = 'teacher', } diff --git a/frontend/src/components/SingleQuestion.vue b/frontend/src/components/SingleQuestion.vue index 51ee3469..2a600d23 100644 --- a/frontend/src/components/SingleQuestion.vue +++ b/frontend/src/components/SingleQuestion.vue @@ -6,7 +6,7 @@ import type { AnswersResponse } from "@/controllers/answers"; import type { AnswerData, AnswerDTO } from "@dwengo-1/common/interfaces/answer"; import authService from "@/services/auth/auth-service"; - import {AccountType} from "@dwengo-1/common/util/account-types"; + import { AccountType } from "@dwengo-1/common/util/account-types"; const props = defineProps<{ question: QuestionDTO; diff --git a/frontend/src/views/LoginPage.vue b/frontend/src/views/LoginPage.vue index 34c87565..29b1abf8 100644 --- a/frontend/src/views/LoginPage.vue +++ b/frontend/src/views/LoginPage.vue @@ -3,7 +3,7 @@ import dwengoLogo from "../../../assets/img/dwengo-groen-zwart.svg"; import auth from "@/services/auth/auth-service.ts"; import { watch } from "vue"; - import {AccountType} from "@dwengo-1/common/util/account-types"; + import { AccountType } from "@dwengo-1/common/util/account-types"; const router = useRouter(); diff --git a/frontend/src/views/assignments/CreateAssignment.vue b/frontend/src/views/assignments/CreateAssignment.vue index dbe44021..02ce3c15 100644 --- a/frontend/src/views/assignments/CreateAssignment.vue +++ b/frontend/src/views/assignments/CreateAssignment.vue @@ -14,7 +14,7 @@ import type { AssignmentDTO } from "@dwengo-1/common/interfaces/assignment"; import { useCreateAssignmentMutation } from "@/queries/assignments.ts"; import { useRoute } from "vue-router"; - import {AccountType} from "@dwengo-1/common/util/account-types"; + import { AccountType } from "@dwengo-1/common/util/account-types"; const route = useRoute(); const router = useRouter(); diff --git a/frontend/src/views/assignments/SingleAssignment.vue b/frontend/src/views/assignments/SingleAssignment.vue index bf806a59..b77130ee 100644 --- a/frontend/src/views/assignments/SingleAssignment.vue +++ b/frontend/src/views/assignments/SingleAssignment.vue @@ -8,7 +8,7 @@ import { useGetLearningPathQuery } from "@/queries/learning-paths.ts"; import type { LearningPath } from "@/data-objects/learning-paths/learning-path.ts"; import type { GroupDTO } from "@dwengo-1/common/interfaces/group"; - import {AccountType} from "@dwengo-1/common/util/account-types"; + import { AccountType } from "@dwengo-1/common/util/account-types"; const role = auth.authState.activeRole; const isTeacher = computed(() => role === AccountType.Teacher); diff --git a/frontend/src/views/assignments/UserAssignments.vue b/frontend/src/views/assignments/UserAssignments.vue index f489da1e..2974d34e 100644 --- a/frontend/src/views/assignments/UserAssignments.vue +++ b/frontend/src/views/assignments/UserAssignments.vue @@ -9,7 +9,7 @@ import type { ClassDTO } from "@dwengo-1/common/interfaces/class"; import { asyncComputed } from "@vueuse/core"; import { useDeleteAssignmentMutation } from "@/queries/assignments.ts"; - import {AccountType} from "@dwengo-1/common/util/account-types"; + import { AccountType } from "@dwengo-1/common/util/account-types"; import "../../assets/common.css"; const { t, locale } = useI18n(); diff --git a/frontend/src/views/classes/UserClasses.vue b/frontend/src/views/classes/UserClasses.vue index fe730300..bab2177a 100644 --- a/frontend/src/views/classes/UserClasses.vue +++ b/frontend/src/views/classes/UserClasses.vue @@ -2,7 +2,7 @@ import authState from "@/services/auth/auth-service.ts"; import TeacherClasses from "./TeacherClasses.vue"; import StudentClasses from "./StudentClasses.vue"; - import {AccountType} from "@dwengo-1/common/util/account-types"; + import { AccountType } from "@dwengo-1/common/util/account-types"; // Determine if role is student or teacher to render correct view const role: string = authState.authState.activeRole!; diff --git a/frontend/src/views/learning-paths/LearningPathPage.vue b/frontend/src/views/learning-paths/LearningPathPage.vue index 865668fe..8ebf7e1a 100644 --- a/frontend/src/views/learning-paths/LearningPathPage.vue +++ b/frontend/src/views/learning-paths/LearningPathPage.vue @@ -22,7 +22,7 @@ import type { AssignmentDTO } from "@dwengo-1/common/interfaces/assignment"; import type { GroupDTO } from "@dwengo-1/common/interfaces/group"; import QuestionNotification from "@/components/QuestionNotification.vue"; - import {AccountType} from "@dwengo-1/common/util/account-types"; + import { AccountType } from "@dwengo-1/common/util/account-types"; const router = useRouter(); const route = useRoute(); @@ -237,7 +237,9 @@