style: fix linting issues met Prettier

This commit is contained in:
Lint Action 2025-05-14 16:53:13 +00:00
parent 5893933d4b
commit e348e1198b
3 changed files with 323 additions and 300 deletions

View file

@ -24,8 +24,12 @@ router.get('/testTeachersOnly', teachersOnly, (_req, res) => {
// This endpoint is called by the client when the user has just logged in.
// It creates or updates the user entity based on the authentication data the endpoint was called with.
router.post('/hello', authenticatedOnly, /*
router.post(
'/hello',
authenticatedOnly,
/*
#swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }]
*/ postHelloHandler );
*/ postHelloHandler
);
export default router;

View file

@ -19,11 +19,29 @@ router.get('/', (_, res: Response) => {
});
router.use('/auth', authRouter /* #swagger.tags = ['Auth'] */);
router.use('/class', classRouter /* #swagger.tags = ['Class'], #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] */);
router.use('/learningObject', learningObjectRoutes /* #swagger.tags = ['Learning Object'], #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] */);
router.use('/learningPath', learningPathRoutes /* #swagger.tags = ['Learning Path'], #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] */);
router.use('/student', studentRouter /* #swagger.tags = ['Student'], #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] */);
router.use('/teacher', teacherRouter /* #swagger.tags = ['Teacher'], #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] */);
router.use('/theme', themeRoutes /* #swagger.tags = ['Theme'], #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] */);
router.use(
'/class',
classRouter /* #swagger.tags = ['Class'], #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] */
);
router.use(
'/learningObject',
learningObjectRoutes /* #swagger.tags = ['Learning Object'], #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] */
);
router.use(
'/learningPath',
learningPathRoutes /* #swagger.tags = ['Learning Path'], #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] */
);
router.use(
'/student',
studentRouter /* #swagger.tags = ['Student'], #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] */
);
router.use(
'/teacher',
teacherRouter /* #swagger.tags = ['Teacher'], #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] */
);
router.use(
'/theme',
themeRoutes /* #swagger.tags = ['Theme'], #swagger.security = [{ "studentProduction": [ ] }, { "teacherProduction": [ ] }, { "studentStaging": [ ] }, { "teacherStaging": [ ] }, { "studentDev": [ ] }, { "teacherDev": [ ] }] */
);
export default router;

View file

@ -1,22 +1,22 @@
<script setup lang="ts">
import { useI18n } from 'vue-i18n';
import authState from '@/services/auth/auth-service.ts';
import { onMounted, ref, watchEffect } from 'vue';
import type { TeacherDTO } from '@dwengo-1/common/interfaces/teacher';
import type { ClassDTO } from '@dwengo-1/common/interfaces/class';
import type { TeacherInvitationData, TeacherInvitationDTO } from '@dwengo-1/common/interfaces/teacher-invitation';
import { useTeacherClassesQuery } from '@/queries/teachers';
import type { ClassesResponse } from '@/controllers/classes';
import UsingQueryResult from '@/components/UsingQueryResult.vue';
import { useCreateClassMutation } from '@/queries/classes';
import type { TeacherInvitationsResponse } from '@/controllers/teacher-invitations';
import { useI18n } from "vue-i18n";
import authState from "@/services/auth/auth-service.ts";
import { onMounted, ref, watchEffect } from "vue";
import type { TeacherDTO } from "@dwengo-1/common/interfaces/teacher";
import type { ClassDTO } from "@dwengo-1/common/interfaces/class";
import type { TeacherInvitationData, TeacherInvitationDTO } from "@dwengo-1/common/interfaces/teacher-invitation";
import { useTeacherClassesQuery } from "@/queries/teachers";
import type { ClassesResponse } from "@/controllers/classes";
import UsingQueryResult from "@/components/UsingQueryResult.vue";
import { useCreateClassMutation } from "@/queries/classes";
import type { TeacherInvitationsResponse } from "@/controllers/teacher-invitations";
import {
useRespondTeacherInvitationMutation,
useTeacherInvitationsReceivedQuery,
} from '@/queries/teacher-invitations';
import { useDisplay } from 'vuetify';
import '../../assets/common.css';
import ClassDisplay from '@/views/classes/ClassDisplay.vue';
} from "@/queries/teacher-invitations";
import { useDisplay } from "vuetify";
import "../../assets/common.css";
import ClassDisplay from "@/views/classes/ClassDisplay.vue";
const { t } = useI18n();
@ -24,7 +24,7 @@ const { t } = useI18n();
const username = ref<string | undefined>(undefined);
const isLoading = ref(false);
const isError = ref(false);
const errorMessage = ref<string>('');
const errorMessage = ref<string>("");
// Load current user before rendering the page
onMounted(async () => {
@ -51,7 +51,7 @@ const { mutate: respondToInvitation } = useRespondTeacherInvitationMutation();
const dialog = ref(false);
// Code generated when new class was created
const code = ref<string>('');
const code = ref<string>("");
// Function to handle an invitation request
function handleInvitation(ti: TeacherInvitationDTO, accepted: boolean): void {
@ -70,13 +70,13 @@ function handleInvitation(ti: TeacherInvitationDTO, accepted: boolean): void {
await getInvitationsQuery.refetch();
},
onError: (e) => {
showSnackbar(t('failed') + ': ' + e.response.data.error || e.message, 'error');
showSnackbar(t("failed") + ": " + e.response.data.error || e.message, "error");
},
});
}
// Teacher should be able to set a displayname when making a class
const className = ref<string>('');
const className = ref<string>("");
// The name can only contain dash, underscore letters and numbers
// These rules are used to display a message to the user if the name is not valid
@ -84,7 +84,7 @@ const nameRules = [
(value: string | undefined): string | boolean => {
if (!value) return true;
if (value && /^[a-zA-Z0-9_-]+$/.test(value)) return true;
return t('onlyUse');
return t("onlyUse");
},
];
@ -93,7 +93,7 @@ async function createClass(): Promise<void> {
// Check if the class name is valid
if (className.value && className.value.length > 0 && /^[a-zA-Z0-9_-]+$/.test(className.value)) {
const classDto: ClassDTO = {
id: '',
id: "",
displayName: className.value,
teachers: [username.value!],
students: [],
@ -101,26 +101,26 @@ async function createClass(): Promise<void> {
mutate(classDto, {
onSuccess: async (classResponse) => {
showSnackbar(t('classCreated'), 'success');
showSnackbar(t("classCreated"), "success");
const createdClass: ClassDTO = classResponse.class;
code.value = createdClass.id;
await classesQuery.refetch();
},
onError: (err) => {
showSnackbar(t('creationFailed') + ': ' + err.message, 'error');
showSnackbar(t("creationFailed") + ": " + err.message, "error");
},
});
dialog.value = true;
}
if (!className.value || className.value === '') {
showSnackbar(t('nameIsMandatory'), 'error');
if (!className.value || className.value === "") {
showSnackbar(t("nameIsMandatory"), "error");
}
}
const snackbar = ref({
visible: false,
message: '',
color: 'success',
message: "",
color: "success",
});
function showSnackbar(message: string, color: string): void {
@ -141,7 +141,7 @@ async function copyToClipboard(): Promise<void> {
async function copyCode(selectedCode: string): Promise<void> {
code.value = selectedCode;
await copyToClipboard();
showSnackbar(t('copied'), 'white');
showSnackbar(t("copied"), "white");
copied.value = false;
}
@ -169,7 +169,7 @@ watchEffect(() => {
// Code display dialog logic
const viewCodeDialog = ref(false);
const selectedCode = ref('');
const selectedCode = ref("");
function openCodeDialog(codeToView: string): void {
selectedCode.value = codeToView;
@ -192,7 +192,7 @@ function openCodeDialog(codeToView: string): void {
></v-empty-state>
</div>
<div v-else>
<h1 class="h1">{{ t('classes') }}</h1>
<h1 class="h1">{{ t("classes") }}</h1>
<using-query-result
:query-result="classesQuery"
v-slot="classesResponse: { data: ClassesResponse }"
@ -214,11 +214,11 @@ function openCodeDialog(codeToView: string): void {
<v-table class="table">
<thead>
<tr>
<th class="header">{{ t('classes') }}</th>
<th class="header">{{ t("classes") }}</th>
<th class="header">
{{ t('code') }}
{{ t("code") }}
</th>
<th class="header">{{ t('members') }}</th>
<th class="header">{{ t("members") }}</th>
</tr>
</thead>
<tbody v-if="classesResponse.data.classes.length">
@ -266,7 +266,7 @@ function openCodeDialog(codeToView: string): void {
size="small"
>
</v-icon>
{{ t('no-classes-found') }}
{{ t("no-classes-found") }}
</td>
</tr>
</tbody>
@ -279,13 +279,13 @@ function openCodeDialog(codeToView: string): void {
class="responsive-col"
>
<div>
<h2>{{ t('createClass') }}</h2>
<h2>{{ t("createClass") }}</h2>
<v-sheet
class="pa-4 sheet"
max-width="600px"
>
<p>{{ t('createClassInstructions') }}</p>
<p>{{ t("createClassInstructions") }}</p>
<v-form @submit.prevent>
<v-text-field
class="mt-4"
@ -301,9 +301,8 @@ function openCodeDialog(codeToView: string): void {
type="submit"
@click="createClass"
block
>{{ t('create') }}
</v-btn
>
>{{ t("create") }}
</v-btn>
</v-form>
</v-sheet>
<v-container>
@ -325,7 +324,7 @@ function openCodeDialog(codeToView: string): void {
v-if="copied"
class="text-center mt-2"
>
{{ t('copied') }}
{{ t("copied") }}
</div>
</v-slide-y-transition>
</v-card-text>
@ -338,7 +337,7 @@ function openCodeDialog(codeToView: string): void {
copied = false;
"
>
{{ t('close') }}
{{ t("close") }}
</v-btn>
</v-card-actions>
</v-card>
@ -351,7 +350,7 @@ function openCodeDialog(codeToView: string): void {
</using-query-result>
<h1 class="h1">
{{ t('invitations') }}
{{ t("invitations") }}
</h1>
<v-container
fluid
@ -360,9 +359,9 @@ function openCodeDialog(codeToView: string): void {
<v-table class="table">
<thead>
<tr>
<th class="header">{{ t('class') }}</th>
<th class="header">{{ t('sender') }}</th>
<th class="header">{{ t('accept') + '/' + t('reject') }}</th>
<th class="header">{{ t("class") }}</th>
<th class="header">{{ t("sender") }}</th>
<th class="header">{{ t("accept") + "/" + t("reject") }}</th>
</tr>
</thead>
<tbody>
@ -379,7 +378,9 @@ function openCodeDialog(codeToView: string): void {
<ClassDisplay :classId="i.classId" />
</td>
<td>
{{ (i.sender as TeacherDTO).firstName + ' ' + (i.sender as TeacherDTO).lastName }}
{{
(i.sender as TeacherDTO).firstName + " " + (i.sender as TeacherDTO).lastName
}}
</td>
<td class="text-right">
<span v-if="!isSmAndDown">
@ -389,13 +390,13 @@ function openCodeDialog(codeToView: string): void {
@click="handleInvitation(i, true)"
class="mr-2"
>
{{ t('accept') }}
{{ t("accept") }}
</v-btn>
<v-btn
color="red"
@click="handleInvitation(i, false)"
>
{{ t('deny') }}
{{ t("deny") }}
</v-btn>
</div>
</span>
@ -433,7 +434,7 @@ function openCodeDialog(codeToView: string): void {
size="small"
>
</v-icon>
{{ t('no-invitations-found') }}
{{ t("no-invitations-found") }}
</td>
</tr>
</template>
@ -454,7 +455,7 @@ function openCodeDialog(codeToView: string): void {
max-width="400px"
>
<v-card>
<v-card-title class="headline">{{ t('code') }}</v-card-title>
<v-card-title class="headline">{{ t("code") }}</v-card-title>
<v-card-text>
<v-text-field
v-model="selectedCode"
@ -467,7 +468,7 @@ function openCodeDialog(codeToView: string): void {
v-if="copied"
class="text-center mt-2"
>
{{ t('copied') }}
{{ t("copied") }}
</div>
</v-slide-y-transition>
</v-card-text>
@ -480,7 +481,7 @@ function openCodeDialog(codeToView: string): void {
copied = false;
"
>
{{ t('close') }}
{{ t("close") }}
</v-btn>
</v-card-actions>
</v-card>