From 7ad808cf3b77f86c2b5c508dcd8e30d952ec4092 Mon Sep 17 00:00:00 2001 From: Lint Action Date: Sun, 30 Mar 2025 12:54:22 +0000 Subject: [PATCH] style: fix linting issues met Prettier --- backend/src/app.ts | 2 +- backend/src/controllers/learning-objects.ts | 2 +- backend/src/controllers/learning-paths.ts | 4 +- backend/src/controllers/students.ts | 2 +- backend/src/data/dwengo-entity-repository.ts | 8 +- .../classes/class-join-request.entity.ts | 2 +- .../src/exceptions/bad-request-exception.ts | 2 +- backend/src/exceptions/conflict-exception.ts | 2 +- .../entity-already-exists-exception.ts | 2 +- .../exceptions/exception-with-http-state.ts | 6 +- backend/src/exceptions/forbidden-exception.ts | 2 +- backend/src/exceptions/not-found-exception.ts | 2 +- .../src/exceptions/unauthorized-exception.ts | 2 +- backend/src/interfaces/student.ts | 4 +- backend/src/interfaces/teacher.ts | 4 +- backend/src/middleware/auth/auth.ts | 4 +- .../error-handling/error-handler.ts | 6 +- backend/src/mikro-orm.config.ts | 2 +- backend/src/services/learning-objects.ts | 1 - backend/src/services/students.ts | 2 +- backend/src/services/teachers.ts | 9 +- backend/tests/data/users/students.test.ts | 2 +- backend/tests/data/users/teachers.test.ts | 2 +- frontend/src/components/BrowseThemes.vue | 69 ++++++---- frontend/src/components/MenuBar.vue | 2 +- frontend/src/components/ThemeCard.vue | 77 ++++++----- frontend/src/controllers/base-controller.ts | 2 +- frontend/src/controllers/controllers.ts | 2 +- frontend/src/controllers/themes.ts | 2 +- frontend/src/main.ts | 2 +- frontend/src/queries/themes.ts | 17 +-- frontend/src/utils/constants.ts | 73 ++++++---- frontend/src/views/SingleTheme.vue | 10 +- frontend/src/views/homepage/UserHomePage.vue | 128 +++++++++--------- 34 files changed, 244 insertions(+), 214 deletions(-) diff --git a/backend/src/app.ts b/backend/src/app.ts index 3ee7307b..b23d0890 100644 --- a/backend/src/app.ts +++ b/backend/src/app.ts @@ -9,7 +9,7 @@ import { EnvVars, getNumericEnvVar } from './util/envvars.js'; import apiRouter from './routes/router.js'; import swaggerMiddleware from './swagger.js'; import swaggerUi from 'swagger-ui-express'; -import {errorHandler} from "./middleware/error-handling/error-handler"; +import { errorHandler } from './middleware/error-handling/error-handler'; const logger: Logger = getLogger(); diff --git a/backend/src/controllers/learning-objects.ts b/backend/src/controllers/learning-objects.ts index eb5c587a..53eb1ded 100644 --- a/backend/src/controllers/learning-objects.ts +++ b/backend/src/controllers/learning-objects.ts @@ -6,7 +6,7 @@ import { EnvVars, getEnvVar } from '../util/envvars.js'; import { Language } from '../entities/content/language.js'; import attachmentService from '../services/learning-objects/attachment-service.js'; import { NotFoundError } from '@mikro-orm/core'; -import {BadRequestException} from "../exceptions/bad-request-exception.js"; +import { BadRequestException } from '../exceptions/bad-request-exception.js'; function getLearningObjectIdentifierFromRequest(req: Request): LearningObjectIdentifier { if (!req.params.hruid) { diff --git a/backend/src/controllers/learning-paths.ts b/backend/src/controllers/learning-paths.ts index 67b11d13..04e44b59 100644 --- a/backend/src/controllers/learning-paths.ts +++ b/backend/src/controllers/learning-paths.ts @@ -8,8 +8,8 @@ import { personalizedForGroup, personalizedForStudent, } from '../services/learning-paths/learning-path-personalization-util.js'; -import {BadRequestException} from "../exceptions/bad-request-exception.js"; -import {NotFoundException} from "../exceptions/not-found-exception.js"; +import { BadRequestException } from '../exceptions/bad-request-exception.js'; +import { NotFoundException } from '../exceptions/not-found-exception.js'; /** * Fetch learning paths based on query parameters. diff --git a/backend/src/controllers/students.ts b/backend/src/controllers/students.ts index 5190c1d6..8ce5b11a 100644 --- a/backend/src/controllers/students.ts +++ b/backend/src/controllers/students.ts @@ -60,7 +60,7 @@ export async function createStudentHandler(req: Request, res: Response) { if (!newUser) { res.status(500).json({ - error: 'Something went wrong while creating student' + error: 'Something went wrong while creating student', }); return; } diff --git a/backend/src/data/dwengo-entity-repository.ts b/backend/src/data/dwengo-entity-repository.ts index 09b13f50..c090731e 100644 --- a/backend/src/data/dwengo-entity-repository.ts +++ b/backend/src/data/dwengo-entity-repository.ts @@ -1,9 +1,9 @@ -import {EntityRepository, FilterQuery} from '@mikro-orm/core'; -import {EntityAlreadyExistsException} from "../exceptions/entity-already-exists-exception"; +import { EntityRepository, FilterQuery } from '@mikro-orm/core'; +import { EntityAlreadyExistsException } from '../exceptions/entity-already-exists-exception'; export abstract class DwengoEntityRepository extends EntityRepository { - public async save(entity: T, options?: {preventOverwrite?: boolean}): Promise { - if (options?.preventOverwrite && await this.findOne(entity)) { + public async save(entity: T, options?: { preventOverwrite?: boolean }): Promise { + if (options?.preventOverwrite && (await this.findOne(entity))) { throw new EntityAlreadyExistsException(`A ${this.getEntityName()} with this identifier already exists.`); } await this.getEntityManager().persistAndFlush(entity); diff --git a/backend/src/entities/classes/class-join-request.entity.ts b/backend/src/entities/classes/class-join-request.entity.ts index 64a597bb..fdf13aa9 100644 --- a/backend/src/entities/classes/class-join-request.entity.ts +++ b/backend/src/entities/classes/class-join-request.entity.ts @@ -27,4 +27,4 @@ export class ClassJoinRequest { @Enum(() => ClassJoinRequestStatus) status!: ClassJoinRequestStatus; -} \ No newline at end of file +} diff --git a/backend/src/exceptions/bad-request-exception.ts b/backend/src/exceptions/bad-request-exception.ts index fa2ae17a..f6672a62 100644 --- a/backend/src/exceptions/bad-request-exception.ts +++ b/backend/src/exceptions/bad-request-exception.ts @@ -1,4 +1,4 @@ -import {ExceptionWithHttpState} from "./exception-with-http-state.js"; +import { ExceptionWithHttpState } from './exception-with-http-state.js'; /** * Exception for HTTP 400 Bad Request diff --git a/backend/src/exceptions/conflict-exception.ts b/backend/src/exceptions/conflict-exception.ts index b69081cb..ed1d0b24 100644 --- a/backend/src/exceptions/conflict-exception.ts +++ b/backend/src/exceptions/conflict-exception.ts @@ -1,4 +1,4 @@ -import {ExceptionWithHttpState} from "./exception-with-http-state.js"; +import { ExceptionWithHttpState } from './exception-with-http-state.js'; /** * Exception for HTTP 409 Conflict diff --git a/backend/src/exceptions/entity-already-exists-exception.ts b/backend/src/exceptions/entity-already-exists-exception.ts index fe5a8fa2..6fb435b9 100644 --- a/backend/src/exceptions/entity-already-exists-exception.ts +++ b/backend/src/exceptions/entity-already-exists-exception.ts @@ -1,4 +1,4 @@ -import {ConflictException} from "./conflict-exception"; +import { ConflictException } from './conflict-exception'; export class EntityAlreadyExistsException extends ConflictException { constructor(message: string) { diff --git a/backend/src/exceptions/exception-with-http-state.ts b/backend/src/exceptions/exception-with-http-state.ts index fab6b1dd..e5b9b9bd 100644 --- a/backend/src/exceptions/exception-with-http-state.ts +++ b/backend/src/exceptions/exception-with-http-state.ts @@ -2,8 +2,10 @@ * Exceptions which are associated with a HTTP error code. */ export abstract class ExceptionWithHttpState extends Error { - constructor(public status: number, public error: string) { + constructor( + public status: number, + public error: string + ) { super(error); } } - diff --git a/backend/src/exceptions/forbidden-exception.ts b/backend/src/exceptions/forbidden-exception.ts index ba084162..5712e0c8 100644 --- a/backend/src/exceptions/forbidden-exception.ts +++ b/backend/src/exceptions/forbidden-exception.ts @@ -1,4 +1,4 @@ -import {ExceptionWithHttpState} from "./exception-with-http-state.js"; +import { ExceptionWithHttpState } from './exception-with-http-state.js'; /** * Exception for HTTP 403 Forbidden diff --git a/backend/src/exceptions/not-found-exception.ts b/backend/src/exceptions/not-found-exception.ts index 8fb2f3f1..a3e7d762 100644 --- a/backend/src/exceptions/not-found-exception.ts +++ b/backend/src/exceptions/not-found-exception.ts @@ -1,4 +1,4 @@ -import {ExceptionWithHttpState} from "./exception-with-http-state.js"; +import { ExceptionWithHttpState } from './exception-with-http-state.js'; /** * Exception for HTTP 404 Not Found diff --git a/backend/src/exceptions/unauthorized-exception.ts b/backend/src/exceptions/unauthorized-exception.ts index 1c61a742..7ea9aca8 100644 --- a/backend/src/exceptions/unauthorized-exception.ts +++ b/backend/src/exceptions/unauthorized-exception.ts @@ -1,4 +1,4 @@ -import {ExceptionWithHttpState} from "./exception-with-http-state.js"; +import { ExceptionWithHttpState } from './exception-with-http-state.js'; /** * Exception for HTTP 401 Unauthorized diff --git a/backend/src/interfaces/student.ts b/backend/src/interfaces/student.ts index 85ade31e..9613b509 100644 --- a/backend/src/interfaces/student.ts +++ b/backend/src/interfaces/student.ts @@ -1,5 +1,5 @@ import { Student } from '../entities/users/student.entity.js'; -import {getStudentRepository} from "../data/repositories"; +import { getStudentRepository } from '../data/repositories'; export interface StudentDTO { id: string; @@ -27,6 +27,6 @@ export function mapToStudent(studentData: StudentDTO): Student { return getStudentRepository().create({ username: studentData.username, firstName: studentData.firstName, - lastName: studentData.lastName + lastName: studentData.lastName, }); } diff --git a/backend/src/interfaces/teacher.ts b/backend/src/interfaces/teacher.ts index b4cda2d4..cf13caa5 100644 --- a/backend/src/interfaces/teacher.ts +++ b/backend/src/interfaces/teacher.ts @@ -1,5 +1,5 @@ import { Teacher } from '../entities/users/teacher.entity.js'; -import {getTeacherRepository} from "../data/repositories"; +import { getTeacherRepository } from '../data/repositories'; export interface TeacherDTO { id: string; @@ -27,6 +27,6 @@ export function mapToTeacher(teacherData: TeacherDTO): Teacher { return getTeacherRepository().create({ username: teacherData.username, firstName: teacherData.firstName, - lastName: teacherData.lastName + lastName: teacherData.lastName, }); } diff --git a/backend/src/middleware/auth/auth.ts b/backend/src/middleware/auth/auth.ts index b98fb262..3b7f46f3 100644 --- a/backend/src/middleware/auth/auth.ts +++ b/backend/src/middleware/auth/auth.ts @@ -6,8 +6,8 @@ import * as express from 'express'; import * as jwt from 'jsonwebtoken'; import { AuthenticatedRequest } from './authenticated-request.js'; import { AuthenticationInfo } from './authentication-info.js'; -import {UnauthorizedException} from "../../exceptions/unauthorized-exception"; -import {ForbiddenException} from "../../exceptions/forbidden-exception"; +import { UnauthorizedException } from '../../exceptions/unauthorized-exception'; +import { ForbiddenException } from '../../exceptions/forbidden-exception'; const JWKS_CACHE = true; const JWKS_RATE_LIMIT = true; diff --git a/backend/src/middleware/error-handling/error-handler.ts b/backend/src/middleware/error-handling/error-handler.ts index a5a8f290..eef6a7ee 100644 --- a/backend/src/middleware/error-handling/error-handler.ts +++ b/backend/src/middleware/error-handling/error-handler.ts @@ -1,6 +1,6 @@ -import {NextFunction, Request, Response} from "express"; -import {getLogger, Logger} from "../../logging/initalize"; -import {ExceptionWithHttpState} from "../../exceptions/exception-with-http-state"; +import { NextFunction, Request, Response } from 'express'; +import { getLogger, Logger } from '../../logging/initalize'; +import { ExceptionWithHttpState } from '../../exceptions/exception-with-http-state'; const logger: Logger = getLogger(); diff --git a/backend/src/mikro-orm.config.ts b/backend/src/mikro-orm.config.ts index ab667978..189c77ce 100644 --- a/backend/src/mikro-orm.config.ts +++ b/backend/src/mikro-orm.config.ts @@ -66,7 +66,7 @@ function config(testingMode: boolean = false): Options { password: getEnvVar(EnvVars.DbPassword), entities: entities, persistOnCreate: false, // Entities should not be implicitly persisted when calling create(...), but only after - // They were saved explicitly. + // They were saved explicitly. // EntitiesTs: entitiesTs, // Logging diff --git a/backend/src/services/learning-objects.ts b/backend/src/services/learning-objects.ts index 85141b1d..faa77cb4 100644 --- a/backend/src/services/learning-objects.ts +++ b/backend/src/services/learning-objects.ts @@ -92,4 +92,3 @@ export async function getLearningObjectsFromPath(hruid: string, language: string export async function getLearningObjectIdsFromPath(hruid: string, language: string): Promise { return (await fetchLearningObjects(hruid, false, language)) as string[]; } - diff --git a/backend/src/services/students.ts b/backend/src/services/students.ts index 67974a33..66327b6d 100644 --- a/backend/src/services/students.ts +++ b/backend/src/services/students.ts @@ -27,7 +27,7 @@ export async function createStudent(userData: StudentDTO): Promise { }); it('should return the queried student after he was added', async () => { - await studentRepository.insert(studentRepository.create({username, firstName, lastName})); + await studentRepository.insert(studentRepository.create({ username, firstName, lastName })); const retrievedStudent = await studentRepository.findByUsername(username); expect(retrievedStudent).toBeTruthy(); diff --git a/backend/tests/data/users/teachers.test.ts b/backend/tests/data/users/teachers.test.ts index 3ff828a7..62ad6d81 100644 --- a/backend/tests/data/users/teachers.test.ts +++ b/backend/tests/data/users/teachers.test.ts @@ -29,7 +29,7 @@ describe('TeacherRepository', () => { }); it('should return the queried teacher after he was added', async () => { - await teacherRepository.insert(teacherRepository.create({username, firstName, lastName})); + await teacherRepository.insert(teacherRepository.create({ username, firstName, lastName })); const retrievedTeacher = await teacherRepository.findByUsername(username); expect(retrievedTeacher).toBeTruthy(); diff --git a/frontend/src/components/BrowseThemes.vue b/frontend/src/components/BrowseThemes.vue index eeea2c81..97ff8352 100644 --- a/frontend/src/components/BrowseThemes.vue +++ b/frontend/src/components/BrowseThemes.vue @@ -1,47 +1,56 @@ -