style: fix linting issues met Prettier
This commit is contained in:
parent
7da52284e6
commit
bb2eacdc4c
19 changed files with 26 additions and 26 deletions
|
@ -5,7 +5,7 @@ import { envVars, getEnvVar } from '../util/envVars.js';
|
||||||
import { createOrUpdateStudent } from '../services/students.js';
|
import { createOrUpdateStudent } from '../services/students.js';
|
||||||
import { Request, Response } from 'express';
|
import { Request, Response } from 'express';
|
||||||
import { createOrUpdateTeacher } from '../services/teachers.js';
|
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 {
|
interface FrontendIdpConfig {
|
||||||
authority: string;
|
authority: string;
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { authorize } from './auth-checks.js';
|
||||||
import { fetchClass } from '../../../services/classes.js';
|
import { fetchClass } from '../../../services/classes.js';
|
||||||
import { fetchAllGroups } from '../../../services/groups.js';
|
import { fetchAllGroups } from '../../../services/groups.js';
|
||||||
import { mapToUsername } from '../../../interfaces/user.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).
|
* Expects the path to contain the path parameters 'classId' and 'id' (meaning the ID of the assignment).
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { RequestHandler } from 'express';
|
||||||
import { UnauthorizedException } from '../../../exceptions/unauthorized-exception.js';
|
import { UnauthorizedException } from '../../../exceptions/unauthorized-exception.js';
|
||||||
import { ForbiddenException } from '../../../exceptions/forbidden-exception.js';
|
import { ForbiddenException } from '../../../exceptions/forbidden-exception.js';
|
||||||
import { envVars, getEnvVar } from '../../../util/envVars.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
|
* Middleware which rejects unauthenticated users (with HTTP 401) and authenticated users which do not fulfill
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { AuthenticatedRequest } from '../authenticated-request.js';
|
||||||
import { fetchClass } from '../../../services/classes.js';
|
import { fetchClass } from '../../../services/classes.js';
|
||||||
import { mapToUsername } from '../../../interfaces/user.js';
|
import { mapToUsername } from '../../../interfaces/user.js';
|
||||||
import { getAllInvitations } from '../../../services/teacher-invitations.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<boolean> {
|
async function teaches(teacherUsername: string, classId: string): Promise<boolean> {
|
||||||
const clazz = await fetchClass(classId);
|
const clazz = await fetchClass(classId);
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { authorize } from './auth-checks.js';
|
||||||
import { fetchClass } from '../../../services/classes.js';
|
import { fetchClass } from '../../../services/classes.js';
|
||||||
import { fetchGroup } from '../../../services/groups.js';
|
import { fetchGroup } from '../../../services/groups.js';
|
||||||
import { mapToUsername } from '../../../interfaces/user.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'.
|
* Expects the path to contain the path parameters 'classid', 'assignmentid' and 'groupid'.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { authorize } from './auth-checks';
|
import { authorize } from './auth-checks';
|
||||||
import { AuthenticationInfo } from '../authentication-info';
|
import { AuthenticationInfo } from '../authentication-info';
|
||||||
import { AuthenticatedRequest } from '../authenticated-request';
|
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')
|
* Only allows requests whose learning path personalization query parameters ('forGroup' / 'assignmentNo' / 'classId')
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { fetchQuestion } from '../../../services/questions.js';
|
||||||
import { FALLBACK_SEQ_NUM } from '../../../config.js';
|
import { FALLBACK_SEQ_NUM } from '../../../config.js';
|
||||||
import { fetchAnswer } from '../../../services/answers.js';
|
import { fetchAnswer } from '../../../services/answers.js';
|
||||||
import { mapToUsername } from '../../../interfaces/user.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(
|
export const onlyAllowAuthor = authorize(
|
||||||
(auth: AuthenticationInfo, req: AuthenticatedRequest) => (req.body as { author: string }).author === auth.username
|
(auth: AuthenticationInfo, req: AuthenticatedRequest) => (req.body as { author: string }).author === auth.username
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { AuthenticationInfo } from '../authentication-info.js';
|
||||||
import { authorize } from './auth-checks.js';
|
import { authorize } from './auth-checks.js';
|
||||||
import { FALLBACK_LANG } from '../../../config.js';
|
import { FALLBACK_LANG } from '../../../config.js';
|
||||||
import { mapToUsername } from '../../../interfaces/user.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(
|
export const onlyAllowSubmitter = authorize(
|
||||||
(auth: AuthenticationInfo, req: AuthenticatedRequest) => (req.body as { submitter: string }).submitter === auth.username
|
(auth: AuthenticationInfo, req: AuthenticatedRequest) => (req.body as { submitter: string }).submitter === auth.username
|
||||||
|
|
|
@ -100,13 +100,9 @@ export async function getStudentsByTeacher(username: string, full: boolean): Pro
|
||||||
|
|
||||||
const classIds: string[] = classes.map((cls) => cls.id);
|
const classIds: string[] = classes.map((cls) => cls.id);
|
||||||
|
|
||||||
const students: StudentDTO[] = (await Promise.all(
|
const students: StudentDTO[] = (await Promise.all(classIds.map(async (classId) => await getClassStudentsDTO(classId))))
|
||||||
classIds.map(async (classId) => await getClassStudentsDTO(classId))
|
|
||||||
))
|
|
||||||
.flat()
|
.flat()
|
||||||
.filter((student, index, self) =>
|
.filter((student, index, self) => self.findIndex((s) => s.username === student.username) === index);
|
||||||
self.findIndex((s) => s.username === student.username) === index
|
|
||||||
);
|
|
||||||
|
|
||||||
if (full) {
|
if (full) {
|
||||||
return students;
|
return students;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
export enum AccountType {
|
export enum AccountType {
|
||||||
Student = 'student',
|
Student = 'student',
|
||||||
Teacher = 'teacher'
|
Teacher = 'teacher',
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
import type { AnswersResponse } from "@/controllers/answers";
|
import type { AnswersResponse } from "@/controllers/answers";
|
||||||
import type { AnswerData, AnswerDTO } from "@dwengo-1/common/interfaces/answer";
|
import type { AnswerData, AnswerDTO } from "@dwengo-1/common/interfaces/answer";
|
||||||
import authService from "@/services/auth/auth-service";
|
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<{
|
const props = defineProps<{
|
||||||
question: QuestionDTO;
|
question: QuestionDTO;
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import dwengoLogo from "../../../assets/img/dwengo-groen-zwart.svg";
|
import dwengoLogo from "../../../assets/img/dwengo-groen-zwart.svg";
|
||||||
import auth from "@/services/auth/auth-service.ts";
|
import auth from "@/services/auth/auth-service.ts";
|
||||||
import { watch } from "vue";
|
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();
|
const router = useRouter();
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
import type { AssignmentDTO } from "@dwengo-1/common/interfaces/assignment";
|
import type { AssignmentDTO } from "@dwengo-1/common/interfaces/assignment";
|
||||||
import { useCreateAssignmentMutation } from "@/queries/assignments.ts";
|
import { useCreateAssignmentMutation } from "@/queries/assignments.ts";
|
||||||
import { useRoute } from "vue-router";
|
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 route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import { useGetLearningPathQuery } from "@/queries/learning-paths.ts";
|
import { useGetLearningPathQuery } from "@/queries/learning-paths.ts";
|
||||||
import type { LearningPath } from "@/data-objects/learning-paths/learning-path.ts";
|
import type { LearningPath } from "@/data-objects/learning-paths/learning-path.ts";
|
||||||
import type { GroupDTO } from "@dwengo-1/common/interfaces/group";
|
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 role = auth.authState.activeRole;
|
||||||
const isTeacher = computed(() => role === AccountType.Teacher);
|
const isTeacher = computed(() => role === AccountType.Teacher);
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
import type { ClassDTO } from "@dwengo-1/common/interfaces/class";
|
import type { ClassDTO } from "@dwengo-1/common/interfaces/class";
|
||||||
import { asyncComputed } from "@vueuse/core";
|
import { asyncComputed } from "@vueuse/core";
|
||||||
import { useDeleteAssignmentMutation } from "@/queries/assignments.ts";
|
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";
|
import "../../assets/common.css";
|
||||||
|
|
||||||
const { t, locale } = useI18n();
|
const { t, locale } = useI18n();
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import authState from "@/services/auth/auth-service.ts";
|
import authState from "@/services/auth/auth-service.ts";
|
||||||
import TeacherClasses from "./TeacherClasses.vue";
|
import TeacherClasses from "./TeacherClasses.vue";
|
||||||
import StudentClasses from "./StudentClasses.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
|
// Determine if role is student or teacher to render correct view
|
||||||
const role: string = authState.authState.activeRole!;
|
const role: string = authState.authState.activeRole!;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
import type { AssignmentDTO } from "@dwengo-1/common/interfaces/assignment";
|
import type { AssignmentDTO } from "@dwengo-1/common/interfaces/assignment";
|
||||||
import type { GroupDTO } from "@dwengo-1/common/interfaces/group";
|
import type { GroupDTO } from "@dwengo-1/common/interfaces/group";
|
||||||
import QuestionNotification from "@/components/QuestionNotification.vue";
|
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 router = useRouter();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
@ -237,7 +237,9 @@
|
||||||
</template>
|
</template>
|
||||||
</v-list-item>
|
</v-list-item>
|
||||||
<v-list-itemF
|
<v-list-itemF
|
||||||
v-if="query.classId && query.assignmentNo && authService.authState.activeRole === AccountType.Teacher"
|
v-if="
|
||||||
|
query.classId && query.assignmentNo && authService.authState.activeRole === AccountType.Teacher
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<template v-slot:default>
|
<template v-slot:default>
|
||||||
<learning-path-group-selector
|
<learning-path-group-selector
|
||||||
|
@ -260,7 +262,9 @@
|
||||||
:title="node.title"
|
:title="node.title"
|
||||||
:active="node.key === props.learningObjectHruid"
|
:active="node.key === props.learningObjectHruid"
|
||||||
:key="node.key"
|
:key="node.key"
|
||||||
v-if="!node.teacherExclusive || authService.authState.activeRole === AccountType.Teacher"
|
v-if="
|
||||||
|
!node.teacherExclusive || authService.authState.activeRole === AccountType.Teacher
|
||||||
|
"
|
||||||
>
|
>
|
||||||
<template v-slot:prepend>
|
<template v-slot:prepend>
|
||||||
<v-icon
|
<v-icon
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
import type { SubmissionData } from "@/views/learning-paths/learning-object/submission-data";
|
import type { SubmissionData } from "@/views/learning-paths/learning-object/submission-data";
|
||||||
import LearningObjectContentView from "@/views/learning-paths/learning-object/content/LearningObjectContentView.vue";
|
import LearningObjectContentView from "@/views/learning-paths/learning-object/content/LearningObjectContentView.vue";
|
||||||
import LearningObjectSubmissionsView from "@/views/learning-paths/learning-object/submissions/LearningObjectSubmissionsView.vue";
|
import LearningObjectSubmissionsView from "@/views/learning-paths/learning-object/submissions/LearningObjectSubmissionsView.vue";
|
||||||
import {AccountType} from "@dwengo-1/common/util/account-types";
|
import { AccountType } from "@dwengo-1/common/util/account-types";
|
||||||
|
|
||||||
const _isStudent = computed(() => authService.authState.activeRole === AccountType.Student);
|
const _isStudent = computed(() => authService.authState.activeRole === AccountType.Student);
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
import type { StudentDTO } from "@dwengo-1/common/interfaces/student";
|
import type { StudentDTO } from "@dwengo-1/common/interfaces/student";
|
||||||
import type { GroupDTO } from "@dwengo-1/common/interfaces/group";
|
import type { GroupDTO } from "@dwengo-1/common/interfaces/group";
|
||||||
import { useI18n } from "vue-i18n";
|
import { useI18n } from "vue-i18n";
|
||||||
import {AccountType} from "@dwengo-1/common/util/account-types";
|
import { AccountType } from "@dwengo-1/common/util/account-types";
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue