style: fix linting issues met ESLint
This commit is contained in:
parent
710adcaa34
commit
b8aae0ab1b
17 changed files with 46 additions and 136 deletions
|
@ -26,9 +26,7 @@ export async function getLearningPaths(
|
|||
? hruids.map(String)
|
||||
: [String(hruids)];
|
||||
} else if (themeKey) {
|
||||
const theme = themes.find((t) => {
|
||||
return t.title === themeKey;
|
||||
});
|
||||
const theme = themes.find((t) => t.title === themeKey);
|
||||
if (theme) {
|
||||
hruidList = theme.hruids;
|
||||
} else {
|
||||
|
@ -45,9 +43,7 @@ export async function getLearningPaths(
|
|||
res.json(searchResults);
|
||||
return;
|
||||
} else {
|
||||
hruidList = themes.flatMap((theme) => {
|
||||
return theme.hruids;
|
||||
});
|
||||
hruidList = themes.flatMap((theme) => theme.hruids);
|
||||
}
|
||||
|
||||
const learningPaths = await fetchLearningPaths(
|
||||
|
|
|
@ -11,24 +11,20 @@ interface Translations {
|
|||
export function getThemes(req: Request, res: Response) {
|
||||
const language = (req.query.language as string)?.toLowerCase() || 'nl';
|
||||
const translations = loadTranslations<Translations>(language);
|
||||
const themeList = themes.map((theme) => {
|
||||
return {
|
||||
const themeList = themes.map((theme) => ({
|
||||
key: theme.title,
|
||||
title:
|
||||
translations.curricula_page[theme.title]?.title || theme.title,
|
||||
description: translations.curricula_page[theme.title]?.description,
|
||||
image: `https://dwengo.org/images/curricula/logo_${theme.title}.png`,
|
||||
};
|
||||
});
|
||||
}));
|
||||
|
||||
res.json(themeList);
|
||||
}
|
||||
|
||||
export function getThemeByTitle(req: Request, res: Response) {
|
||||
const themeKey = req.params.theme;
|
||||
const theme = themes.find((t) => {
|
||||
return t.title === themeKey;
|
||||
});
|
||||
const theme = themes.find((t) => t.title === themeKey);
|
||||
|
||||
if (theme) {
|
||||
res.json(theme.hruids);
|
||||
|
|
|
@ -5,9 +5,7 @@ import { Student } from '../users/student.entity.js';
|
|||
@Entity()
|
||||
export class Group {
|
||||
@ManyToOne({
|
||||
entity: () => {
|
||||
return Assignment;
|
||||
},
|
||||
entity: () => Assignment,
|
||||
primary: true,
|
||||
})
|
||||
assignment!: Assignment;
|
||||
|
@ -16,9 +14,7 @@ export class Group {
|
|||
groupNumber!: number;
|
||||
|
||||
@ManyToMany({
|
||||
entity: () => {
|
||||
return Student;
|
||||
},
|
||||
entity: () => Student,
|
||||
})
|
||||
members!: Student[];
|
||||
}
|
||||
|
|
|
@ -9,9 +9,7 @@ export class Submission {
|
|||
learningObjectHruid!: string;
|
||||
|
||||
@Enum({
|
||||
items: () => {
|
||||
return Language;
|
||||
},
|
||||
items: () => Language,
|
||||
primary: true,
|
||||
})
|
||||
learningObjectLanguage!: Language;
|
||||
|
@ -23,9 +21,7 @@ export class Submission {
|
|||
submissionNumber!: number;
|
||||
|
||||
@ManyToOne({
|
||||
entity: () => {
|
||||
return Student;
|
||||
},
|
||||
entity: () => Student,
|
||||
})
|
||||
submitter!: Student;
|
||||
|
||||
|
@ -33,9 +29,7 @@ export class Submission {
|
|||
submissionTime!: Date;
|
||||
|
||||
@ManyToOne({
|
||||
entity: () => {
|
||||
return Group;
|
||||
},
|
||||
entity: () => Group,
|
||||
nullable: true,
|
||||
})
|
||||
onBehalfOf?: Group;
|
||||
|
|
|
@ -5,24 +5,18 @@ import { Class } from './class.entity.js';
|
|||
@Entity()
|
||||
export class ClassJoinRequest {
|
||||
@ManyToOne({
|
||||
entity: () => {
|
||||
return Student;
|
||||
},
|
||||
entity: () => Student,
|
||||
primary: true,
|
||||
})
|
||||
requester!: Student;
|
||||
|
||||
@ManyToOne({
|
||||
entity: () => {
|
||||
return Class;
|
||||
},
|
||||
entity: () => Class,
|
||||
primary: true,
|
||||
})
|
||||
class!: Class;
|
||||
|
||||
@Enum(() => {
|
||||
return ClassJoinRequestStatus;
|
||||
})
|
||||
@Enum(() => ClassJoinRequestStatus)
|
||||
status!: ClassJoinRequestStatus;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,13 +17,9 @@ export class Class {
|
|||
@Property({ type: 'string' })
|
||||
displayName!: string;
|
||||
|
||||
@ManyToMany(() => {
|
||||
return Teacher;
|
||||
})
|
||||
@ManyToMany(() => Teacher)
|
||||
teachers!: Collection<Teacher>;
|
||||
|
||||
@ManyToMany(() => {
|
||||
return Student;
|
||||
})
|
||||
@ManyToMany(() => Student)
|
||||
students!: Collection<Student>;
|
||||
}
|
||||
|
|
|
@ -8,25 +8,19 @@ import { Class } from './class.entity.js';
|
|||
@Entity()
|
||||
export class TeacherInvitation {
|
||||
@ManyToOne({
|
||||
entity: () => {
|
||||
return Teacher;
|
||||
},
|
||||
entity: () => Teacher,
|
||||
primary: true,
|
||||
})
|
||||
sender!: Teacher;
|
||||
|
||||
@ManyToOne({
|
||||
entity: () => {
|
||||
return Teacher;
|
||||
},
|
||||
entity: () => Teacher,
|
||||
primary: true,
|
||||
})
|
||||
receiver!: Teacher;
|
||||
|
||||
@ManyToOne({
|
||||
entity: () => {
|
||||
return Class;
|
||||
},
|
||||
entity: () => Class,
|
||||
primary: true,
|
||||
})
|
||||
class!: Class;
|
||||
|
|
|
@ -4,9 +4,7 @@ import { LearningObject } from './learning-object.entity.js';
|
|||
@Entity()
|
||||
export class Attachment {
|
||||
@ManyToOne({
|
||||
entity: () => {
|
||||
return LearningObject;
|
||||
},
|
||||
entity: () => LearningObject,
|
||||
primary: true,
|
||||
})
|
||||
learningObject!: LearningObject;
|
||||
|
|
|
@ -18,9 +18,7 @@ export class LearningObject {
|
|||
hruid!: string;
|
||||
|
||||
@Enum({
|
||||
items: () => {
|
||||
return Language;
|
||||
},
|
||||
items: () => Language,
|
||||
primary: true,
|
||||
})
|
||||
language!: Language;
|
||||
|
@ -29,9 +27,7 @@ export class LearningObject {
|
|||
version: string = '1';
|
||||
|
||||
@ManyToMany({
|
||||
entity: () => {
|
||||
return Teacher;
|
||||
},
|
||||
entity: () => Teacher,
|
||||
})
|
||||
admins!: Teacher[];
|
||||
|
||||
|
@ -57,9 +53,7 @@ export class LearningObject {
|
|||
skosConcepts!: string[];
|
||||
|
||||
@Embedded({
|
||||
entity: () => {
|
||||
return EducationalGoal;
|
||||
},
|
||||
entity: () => EducationalGoal,
|
||||
array: true,
|
||||
})
|
||||
educationalGoals: EducationalGoal[] = [];
|
||||
|
@ -77,9 +71,7 @@ export class LearningObject {
|
|||
estimatedTime!: number;
|
||||
|
||||
@Embedded({
|
||||
entity: () => {
|
||||
return ReturnValue;
|
||||
},
|
||||
entity: () => ReturnValue,
|
||||
})
|
||||
returnValue!: ReturnValue;
|
||||
|
||||
|
@ -90,9 +82,7 @@ export class LearningObject {
|
|||
contentLocation?: string;
|
||||
|
||||
@OneToMany({
|
||||
entity: () => {
|
||||
return Attachment;
|
||||
},
|
||||
entity: () => Attachment,
|
||||
mappedBy: 'learningObject',
|
||||
})
|
||||
attachments: Attachment[] = [];
|
||||
|
|
|
@ -17,17 +17,13 @@ export class LearningPath {
|
|||
hruid!: string;
|
||||
|
||||
@Enum({
|
||||
items: () => {
|
||||
return Language;
|
||||
},
|
||||
items: () => Language,
|
||||
primary: true,
|
||||
})
|
||||
language!: Language;
|
||||
|
||||
@ManyToMany({
|
||||
entity: () => {
|
||||
return Teacher;
|
||||
},
|
||||
entity: () => Teacher,
|
||||
})
|
||||
admins!: Teacher[];
|
||||
|
||||
|
@ -41,9 +37,7 @@ export class LearningPath {
|
|||
image!: string;
|
||||
|
||||
@Embedded({
|
||||
entity: () => {
|
||||
return LearningPathNode;
|
||||
},
|
||||
entity: () => LearningPathNode,
|
||||
array: true,
|
||||
})
|
||||
nodes: LearningPathNode[] = [];
|
||||
|
@ -55,9 +49,7 @@ export class LearningPathNode {
|
|||
learningObjectHruid!: string;
|
||||
|
||||
@Enum({
|
||||
items: () => {
|
||||
return Language;
|
||||
},
|
||||
items: () => Language,
|
||||
})
|
||||
language!: Language;
|
||||
|
||||
|
@ -71,9 +63,7 @@ export class LearningPathNode {
|
|||
startNode!: boolean;
|
||||
|
||||
@Embedded({
|
||||
entity: () => {
|
||||
return LearningPathTransition;
|
||||
},
|
||||
entity: () => LearningPathTransition,
|
||||
array: true,
|
||||
})
|
||||
transitions!: LearningPathTransition[];
|
||||
|
@ -85,9 +75,7 @@ export class LearningPathTransition {
|
|||
condition!: string;
|
||||
|
||||
@OneToOne({
|
||||
entity: () => {
|
||||
return LearningPathNode;
|
||||
},
|
||||
entity: () => LearningPathNode,
|
||||
})
|
||||
next!: LearningPathNode;
|
||||
}
|
||||
|
|
|
@ -5,17 +5,13 @@ import { Teacher } from '../users/teacher.entity.js';
|
|||
@Entity()
|
||||
export class Answer {
|
||||
@ManyToOne({
|
||||
entity: () => {
|
||||
return Teacher;
|
||||
},
|
||||
entity: () => Teacher,
|
||||
primary: true,
|
||||
})
|
||||
author!: Teacher;
|
||||
|
||||
@ManyToOne({
|
||||
entity: () => {
|
||||
return Question;
|
||||
},
|
||||
entity: () => Question,
|
||||
primary: true,
|
||||
})
|
||||
toQuestion!: Question;
|
||||
|
|
|
@ -8,9 +8,7 @@ export class Question {
|
|||
learningObjectHruid!: string;
|
||||
|
||||
@Enum({
|
||||
items: () => {
|
||||
return Language;
|
||||
},
|
||||
items: () => Language,
|
||||
primary: true,
|
||||
})
|
||||
learningObjectLanguage!: Language;
|
||||
|
@ -22,9 +20,7 @@ export class Question {
|
|||
sequenceNumber!: number;
|
||||
|
||||
@ManyToOne({
|
||||
entity: () => {
|
||||
return Student;
|
||||
},
|
||||
entity: () => Student,
|
||||
})
|
||||
author!: Student;
|
||||
|
||||
|
|
|
@ -5,19 +5,13 @@ import { Group } from '../assignments/group.entity.js';
|
|||
import { StudentRepository } from '../../data/users/student-repository.js';
|
||||
|
||||
@Entity({
|
||||
repository: () => {
|
||||
return StudentRepository;
|
||||
},
|
||||
repository: () => StudentRepository,
|
||||
})
|
||||
export class Student extends User {
|
||||
@ManyToMany(() => {
|
||||
return Class;
|
||||
})
|
||||
@ManyToMany(() => Class)
|
||||
classes!: Collection<Class>;
|
||||
|
||||
@ManyToMany(() => {
|
||||
return Group;
|
||||
})
|
||||
@ManyToMany(() => Group)
|
||||
groups!: Collection<Group>;
|
||||
|
||||
constructor(
|
||||
|
|
|
@ -4,8 +4,6 @@ import { Class } from '../classes/class.entity.js';
|
|||
|
||||
@Entity()
|
||||
export class Teacher extends User {
|
||||
@ManyToMany(() => {
|
||||
return Class;
|
||||
})
|
||||
@ManyToMany(() => Class)
|
||||
classes!: Collection<Class>;
|
||||
}
|
||||
|
|
|
@ -52,9 +52,7 @@ function config(testingMode: boolean = false): Options {
|
|||
|
||||
// Workaround: vitest: `TypeError: Unknown file extension ".ts"` (ERR_UNKNOWN_FILE_EXTENSION)
|
||||
// (see https://mikro-orm.io/docs/guide/project-setup#testing-the-endpoint)
|
||||
dynamicImportProvider: (id) => {
|
||||
return import(id);
|
||||
},
|
||||
dynamicImportProvider: (id) => import(id),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -70,9 +68,7 @@ function config(testingMode: boolean = false): Options {
|
|||
|
||||
// Logging
|
||||
debug: LOG_LEVEL === 'debug',
|
||||
loggerFactory: (options: LoggerOptions) => {
|
||||
return new MikroOrmLogger(options);
|
||||
},
|
||||
loggerFactory: (options: LoggerOptions) => new MikroOrmLogger(options),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -89,23 +89,15 @@ async function fetchLearningObjects(
|
|||
const nodes: LearningObjectNode[] = learningPathResponse.data[0].nodes;
|
||||
|
||||
if (!full) {
|
||||
return nodes.map((node) => {
|
||||
return node.learningobject_hruid;
|
||||
});
|
||||
return nodes.map((node) => node.learningobject_hruid);
|
||||
}
|
||||
|
||||
return await Promise.all(
|
||||
nodes.map(async (node) => {
|
||||
return getLearningObjectById(
|
||||
nodes.map(async (node) => getLearningObjectById(
|
||||
node.learningobject_hruid,
|
||||
language
|
||||
);
|
||||
})
|
||||
).then((objects) => {
|
||||
return objects.filter((obj): obj is FilteredLearningObject => {
|
||||
return obj !== null;
|
||||
});
|
||||
});
|
||||
))
|
||||
).then((objects) => objects.filter((obj): obj is FilteredLearningObject => obj !== null));
|
||||
} catch (error) {
|
||||
logger.error('❌ Error fetching learning objects:', error);
|
||||
return [];
|
||||
|
|
|
@ -22,16 +22,12 @@ const router = createRouter({
|
|||
{
|
||||
path: "/",
|
||||
name: "home",
|
||||
component: () => {
|
||||
return import("../views/HomePage.vue");
|
||||
},
|
||||
component: () => import("../views/HomePage.vue"),
|
||||
},
|
||||
{
|
||||
path: "/login",
|
||||
name: "LoginPage",
|
||||
component: () => {
|
||||
return import("../views/LoginPage.vue");
|
||||
},
|
||||
component: () => import("../views/LoginPage.vue"),
|
||||
},
|
||||
{
|
||||
path: "/student/:id",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue