fix(backend): Formatting + .env.development.example
npm run format uitgevoerd, .env.development.example toegevoegd.
This commit is contained in:
parent
4e883a1a18
commit
48c8ce7c57
36 changed files with 499 additions and 331 deletions
|
@ -1,28 +1,35 @@
|
|||
import {Entity, Enum, ManyToOne, OneToMany, PrimaryKey, Property} from "@mikro-orm/core";
|
||||
import {Class} from "../classes/class.entity";
|
||||
import {Group} from "./group.entity"
|
||||
import {Language} from "../content/language";
|
||||
import {
|
||||
Entity,
|
||||
Enum,
|
||||
ManyToOne,
|
||||
OneToMany,
|
||||
PrimaryKey,
|
||||
Property,
|
||||
} from '@mikro-orm/core';
|
||||
import { Class } from '../classes/class.entity';
|
||||
import { Group } from './group.entity';
|
||||
import { Language } from '../content/language';
|
||||
|
||||
@Entity()
|
||||
export class Assignment {
|
||||
@ManyToOne({entity: () => Class, primary: true})
|
||||
@ManyToOne({ entity: () => Class, primary: true })
|
||||
within!: Class;
|
||||
|
||||
@PrimaryKey({type: "number"})
|
||||
@PrimaryKey({ type: 'number' })
|
||||
id!: number;
|
||||
|
||||
@Property({type: "string"})
|
||||
@Property({ type: 'string' })
|
||||
title!: string;
|
||||
|
||||
@Property({type: "text"})
|
||||
@Property({ type: 'text' })
|
||||
description!: string;
|
||||
|
||||
@Property({type: "string"})
|
||||
@Property({ type: 'string' })
|
||||
learningPathHruid!: string;
|
||||
|
||||
@Enum({items: () => Language})
|
||||
@Enum({ items: () => Language })
|
||||
learningPathLanguage!: Language;
|
||||
|
||||
@OneToMany({entity: () => Group, mappedBy: "assignment"})
|
||||
@OneToMany({ entity: () => Group, mappedBy: 'assignment' })
|
||||
groups!: Group[];
|
||||
}
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
import {Entity, ManyToMany, ManyToOne, PrimaryKey} from "@mikro-orm/core";
|
||||
import {Assignment} from "./assignment.entity";
|
||||
import {Student} from "../users/student.entity";
|
||||
import { Entity, ManyToMany, ManyToOne, PrimaryKey } from '@mikro-orm/core';
|
||||
import { Assignment } from './assignment.entity';
|
||||
import { Student } from '../users/student.entity';
|
||||
|
||||
@Entity()
|
||||
export class Group {
|
||||
@ManyToOne({entity: () => Assignment, primary: true})
|
||||
@ManyToOne({ entity: () => Assignment, primary: true })
|
||||
assignment!: Assignment;
|
||||
|
||||
@PrimaryKey({type: "integer"})
|
||||
@PrimaryKey({ type: 'integer' })
|
||||
groupNumber!: number;
|
||||
|
||||
@ManyToMany({entity: () => Student})
|
||||
@ManyToMany({ entity: () => Student })
|
||||
members!: Student[];
|
||||
}
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
import {Student} from "../users/student.entity";
|
||||
import {Group} from "./group.entity";
|
||||
import {Entity, Enum, ManyToOne, PrimaryKey, Property} from "@mikro-orm/core";
|
||||
import {Language} from "../content/language";
|
||||
import { Student } from '../users/student.entity';
|
||||
import { Group } from './group.entity';
|
||||
import { Entity, Enum, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core';
|
||||
import { Language } from '../content/language';
|
||||
|
||||
@Entity()
|
||||
export class Submission {
|
||||
@PrimaryKey({type: "string"})
|
||||
@PrimaryKey({ type: 'string' })
|
||||
learningObjectHruid!: string;
|
||||
|
||||
@Enum({items: () => Language, primary: true})
|
||||
@Enum({ items: () => Language, primary: true })
|
||||
learningObjectLanguage!: Language;
|
||||
|
||||
@PrimaryKey({type: "string"})
|
||||
learningObjectVersion: string = "1";
|
||||
@PrimaryKey({ type: 'string' })
|
||||
learningObjectVersion: string = '1';
|
||||
|
||||
@PrimaryKey({type: "integer"})
|
||||
@PrimaryKey({ type: 'integer' })
|
||||
submissionNumber!: number;
|
||||
|
||||
@ManyToOne({entity: () => Student})
|
||||
@ManyToOne({ entity: () => Student })
|
||||
submitter!: Student;
|
||||
|
||||
@Property({type: "datetime"})
|
||||
@Property({ type: 'datetime' })
|
||||
submissionTime!: Date;
|
||||
|
||||
@ManyToOne({entity: () => Group, nullable: true})
|
||||
@ManyToOne({ entity: () => Group, nullable: true })
|
||||
onBehalfOf?: Group;
|
||||
|
||||
@Property({type: "json"})
|
||||
@Property({ type: 'json' })
|
||||
content!: string;
|
||||
}
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import {Entity, Enum, ManyToOne} from "@mikro-orm/core";
|
||||
import {Student} from "../users/student.entity";
|
||||
import {Class} from "./class.entity";
|
||||
import { Entity, Enum, ManyToOne } from '@mikro-orm/core';
|
||||
import { Student } from '../users/student.entity';
|
||||
import { Class } from './class.entity';
|
||||
|
||||
@Entity()
|
||||
export class ClassJoinRequest {
|
||||
@ManyToOne({entity: () => Student, primary: true})
|
||||
@ManyToOne({ entity: () => Student, primary: true })
|
||||
requester!: Student;
|
||||
|
||||
@ManyToOne({entity: () => Class, primary: true})
|
||||
@ManyToOne({ entity: () => Class, primary: true })
|
||||
class!: Class;
|
||||
|
||||
@Enum(() => ClassJoinRequestStatus)
|
||||
|
@ -15,7 +15,7 @@ export class ClassJoinRequest {
|
|||
}
|
||||
|
||||
export enum ClassJoinRequestStatus {
|
||||
Open = "open",
|
||||
Accepted = "accepted",
|
||||
Declined = "declined"
|
||||
Open = 'open',
|
||||
Accepted = 'accepted',
|
||||
Declined = 'declined',
|
||||
}
|
||||
|
|
|
@ -1,14 +1,20 @@
|
|||
import {Collection, Entity, ManyToMany, PrimaryKey, Property} from "@mikro-orm/core";
|
||||
import {
|
||||
Collection,
|
||||
Entity,
|
||||
ManyToMany,
|
||||
PrimaryKey,
|
||||
Property,
|
||||
} from '@mikro-orm/core';
|
||||
import { v4 } from 'uuid';
|
||||
import {Teacher} from "../users/teacher.entity";
|
||||
import {Student} from "../users/student.entity";
|
||||
import { Teacher } from '../users/teacher.entity';
|
||||
import { Student } from '../users/student.entity';
|
||||
|
||||
@Entity()
|
||||
export class Class {
|
||||
@PrimaryKey()
|
||||
classId = v4();
|
||||
|
||||
@Property({type: "string"})
|
||||
@Property({ type: 'string' })
|
||||
displayName!: string;
|
||||
|
||||
@ManyToMany(() => Teacher)
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
import {Entity, ManyToOne} from "@mikro-orm/core";
|
||||
import {Teacher} from "../users/teacher.entity";
|
||||
import {Class} from "./class.entity";
|
||||
import { Entity, ManyToOne } from '@mikro-orm/core';
|
||||
import { Teacher } from '../users/teacher.entity';
|
||||
import { Class } from './class.entity';
|
||||
|
||||
/**
|
||||
* Invitation of a teacher into a class (in order to teach it).
|
||||
*/
|
||||
@Entity()
|
||||
export class TeacherInvitation {
|
||||
@ManyToOne({entity: () => Teacher, primary: true})
|
||||
@ManyToOne({ entity: () => Teacher, primary: true })
|
||||
sender!: Teacher;
|
||||
|
||||
@ManyToOne({entity: () => Teacher, primary: true})
|
||||
@ManyToOne({ entity: () => Teacher, primary: true })
|
||||
receiver!: Teacher;
|
||||
|
||||
@ManyToOne({entity: () => Class, primary: true})
|
||||
@ManyToOne({ entity: () => Class, primary: true })
|
||||
class!: Class;
|
||||
}
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
import {Entity, ManyToOne, PrimaryKey, Property} from "@mikro-orm/core";
|
||||
import {LearningObject} from "./learning-object.entity";
|
||||
import { Entity, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core';
|
||||
import { LearningObject } from './learning-object.entity';
|
||||
|
||||
@Entity()
|
||||
export class Attachment {
|
||||
@ManyToOne({entity: () => LearningObject, primary: true})
|
||||
@ManyToOne({ entity: () => LearningObject, primary: true })
|
||||
learningObject!: LearningObject;
|
||||
|
||||
@PrimaryKey({type: "integer"})
|
||||
@PrimaryKey({ type: 'integer' })
|
||||
sequenceNumber!: number;
|
||||
|
||||
@Property({type: "string"})
|
||||
@Property({ type: 'string' })
|
||||
mimeType!: string;
|
||||
|
||||
@Property({type: "blob"})
|
||||
@Property({ type: 'blob' })
|
||||
content!: Buffer;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
export enum Language {
|
||||
Dutch = "nl",
|
||||
French = "fr",
|
||||
English = "en",
|
||||
Germany = "de"
|
||||
Dutch = 'nl',
|
||||
French = 'fr',
|
||||
English = 'en',
|
||||
Germany = 'de',
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import {Language} from "./language";
|
||||
import { Language } from './language';
|
||||
|
||||
export class LearningObjectIdentifier {
|
||||
constructor(public hruid: string, public language: Language, public version: string) {
|
||||
|
||||
}
|
||||
constructor(
|
||||
public hruid: string,
|
||||
public language: Language,
|
||||
public version: string
|
||||
) {}
|
||||
}
|
||||
|
|
|
@ -1,97 +1,106 @@
|
|||
import {Embeddable, Embedded, Entity, Enum, ManyToMany, OneToMany, PrimaryKey, Property} from "@mikro-orm/core";
|
||||
import {Language} from "./language";
|
||||
import {Attachment} from "./attachment.entity";
|
||||
import {Teacher} from "../users/teacher.entity";
|
||||
import {
|
||||
Embeddable,
|
||||
Embedded,
|
||||
Entity,
|
||||
Enum,
|
||||
ManyToMany,
|
||||
OneToMany,
|
||||
PrimaryKey,
|
||||
Property,
|
||||
} from '@mikro-orm/core';
|
||||
import { Language } from './language';
|
||||
import { Attachment } from './attachment.entity';
|
||||
import { Teacher } from '../users/teacher.entity';
|
||||
|
||||
@Entity()
|
||||
export class LearningObject {
|
||||
@PrimaryKey({type: "string"})
|
||||
@PrimaryKey({ type: 'string' })
|
||||
hruid!: string;
|
||||
|
||||
@Enum({items: () => Language, primary: true})
|
||||
@Enum({ items: () => Language, primary: true })
|
||||
language!: Language;
|
||||
|
||||
@PrimaryKey({type: "string"})
|
||||
version: string = "1";
|
||||
@PrimaryKey({ type: 'string' })
|
||||
version: string = '1';
|
||||
|
||||
@ManyToMany({entity: () => Teacher})
|
||||
@ManyToMany({ entity: () => Teacher })
|
||||
admins!: Teacher[];
|
||||
|
||||
@Property({type: "string"})
|
||||
@Property({ type: 'string' })
|
||||
title!: string;
|
||||
|
||||
@Property({type: "text"})
|
||||
@Property({ type: 'text' })
|
||||
description!: string;
|
||||
|
||||
@Property({type: "string"})
|
||||
@Property({ type: 'string' })
|
||||
contentType!: string;
|
||||
|
||||
@Property({type: "array"})
|
||||
@Property({ type: 'array' })
|
||||
keywords: string[] = [];
|
||||
|
||||
@Property({type: "array", nullable: true})
|
||||
@Property({ type: 'array', nullable: true })
|
||||
targetAges?: number[];
|
||||
|
||||
@Property({type: "bool"})
|
||||
@Property({ type: 'bool' })
|
||||
teacherExclusive: boolean = false;
|
||||
|
||||
@Property({type: "array"})
|
||||
@Property({ type: 'array' })
|
||||
skosConcepts!: string[];
|
||||
|
||||
@Embedded({entity: () => EducationalGoal, array: true})
|
||||
@Embedded({ entity: () => EducationalGoal, array: true })
|
||||
educationalGoals: EducationalGoal[] = [];
|
||||
|
||||
@Property({type: "string"})
|
||||
copyright: string = ""
|
||||
@Property({ type: 'string' })
|
||||
copyright: string = '';
|
||||
|
||||
@Property({type: "string"})
|
||||
license: string = ""
|
||||
@Property({ type: 'string' })
|
||||
license: string = '';
|
||||
|
||||
@Property({type: "smallint", nullable: true})
|
||||
@Property({ type: 'smallint', nullable: true })
|
||||
difficulty?: number;
|
||||
|
||||
@Property({type: "integer"})
|
||||
@Property({ type: 'integer' })
|
||||
estimatedTime!: number;
|
||||
|
||||
@Embedded({entity: () => ReturnValue})
|
||||
@Embedded({ entity: () => ReturnValue })
|
||||
returnValue!: ReturnValue;
|
||||
|
||||
@Property({type: "bool"})
|
||||
@Property({ type: 'bool' })
|
||||
available: boolean = true;
|
||||
|
||||
@Property({type: "string", nullable: true})
|
||||
@Property({ type: 'string', nullable: true })
|
||||
contentLocation?: string;
|
||||
|
||||
@OneToMany({entity: () => Attachment, mappedBy: "learningObject"})
|
||||
@OneToMany({ entity: () => Attachment, mappedBy: 'learningObject' })
|
||||
attachments: Attachment[] = [];
|
||||
|
||||
@Property({type: "blob"})
|
||||
@Property({ type: 'blob' })
|
||||
content!: Buffer;
|
||||
}
|
||||
|
||||
@Embeddable()
|
||||
export class EducationalGoal {
|
||||
@Property({type: "string"})
|
||||
@Property({ type: 'string' })
|
||||
source!: string;
|
||||
|
||||
@Property({type: "string"})
|
||||
@Property({ type: 'string' })
|
||||
id!: string;
|
||||
}
|
||||
|
||||
@Embeddable()
|
||||
export class ReturnValue {
|
||||
@Property({type: "string"})
|
||||
@Property({ type: 'string' })
|
||||
callbackUrl!: string;
|
||||
|
||||
@Property({type: "json"})
|
||||
@Property({ type: 'json' })
|
||||
callbackSchema!: string;
|
||||
}
|
||||
|
||||
export enum ContentType {
|
||||
Markdown = "text/markdown",
|
||||
Image = "image/image",
|
||||
Mpeg = "audio/mpeg",
|
||||
Pdf = "application/pdf",
|
||||
Extern = "extern",
|
||||
Blockly = "Blockly"
|
||||
Markdown = 'text/markdown',
|
||||
Image = 'image/image',
|
||||
Mpeg = 'audio/mpeg',
|
||||
Pdf = 'application/pdf',
|
||||
Extern = 'extern',
|
||||
Blockly = 'Blockly',
|
||||
}
|
||||
|
|
|
@ -1,57 +1,66 @@
|
|||
import {Embeddable, Embedded, Entity, Enum, ManyToMany, OneToOne, PrimaryKey, Property} from "@mikro-orm/core";
|
||||
import {Language} from "./language";
|
||||
import {Teacher} from "../users/teacher.entity";
|
||||
import {
|
||||
Embeddable,
|
||||
Embedded,
|
||||
Entity,
|
||||
Enum,
|
||||
ManyToMany,
|
||||
OneToOne,
|
||||
PrimaryKey,
|
||||
Property,
|
||||
} from '@mikro-orm/core';
|
||||
import { Language } from './language';
|
||||
import { Teacher } from '../users/teacher.entity';
|
||||
|
||||
@Entity()
|
||||
export class LearningPath {
|
||||
@PrimaryKey({type: "string"})
|
||||
@PrimaryKey({ type: 'string' })
|
||||
hruid!: string;
|
||||
|
||||
@Enum({items: () => Language, primary: true})
|
||||
@Enum({ items: () => Language, primary: true })
|
||||
language!: Language;
|
||||
|
||||
@ManyToMany({entity: () => Teacher})
|
||||
@ManyToMany({ entity: () => Teacher })
|
||||
admins!: Teacher[];
|
||||
|
||||
@Property({type: "string"})
|
||||
@Property({ type: 'string' })
|
||||
title!: string;
|
||||
|
||||
@Property({type: "text"})
|
||||
@Property({ type: 'text' })
|
||||
description!: string;
|
||||
|
||||
@Property({type: "blob"})
|
||||
@Property({ type: 'blob' })
|
||||
image!: string;
|
||||
|
||||
@Embedded({entity: () => LearningPathNode, array: true})
|
||||
@Embedded({ entity: () => LearningPathNode, array: true })
|
||||
nodes: LearningPathNode[] = [];
|
||||
}
|
||||
|
||||
@Embeddable()
|
||||
export class LearningPathNode {
|
||||
@Property({type: "string"})
|
||||
@Property({ type: 'string' })
|
||||
learningObjectHruid!: string;
|
||||
|
||||
@Enum({items: () => Language})
|
||||
@Enum({ items: () => Language })
|
||||
language!: Language;
|
||||
|
||||
@Property({type: "string"})
|
||||
@Property({ type: 'string' })
|
||||
version!: string;
|
||||
|
||||
@Property({type: "longtext"})
|
||||
@Property({ type: 'longtext' })
|
||||
instruction!: string;
|
||||
|
||||
@Property({type: "bool"})
|
||||
@Property({ type: 'bool' })
|
||||
startNode!: boolean;
|
||||
|
||||
@Embedded({entity: () => LearningPathTransition, array: true})
|
||||
@Embedded({ entity: () => LearningPathTransition, array: true })
|
||||
transitions!: LearningPathTransition[];
|
||||
}
|
||||
|
||||
@Embeddable()
|
||||
export class LearningPathTransition {
|
||||
@Property({type: "string"})
|
||||
@Property({ type: 'string' })
|
||||
condition!: string;
|
||||
|
||||
@OneToOne({entity: () => LearningPathNode})
|
||||
@OneToOne({ entity: () => LearningPathNode })
|
||||
next!: LearningPathNode;
|
||||
}
|
||||
|
|
|
@ -1,22 +1,21 @@
|
|||
import {Entity, ManyToOne, PrimaryKey, Property} from "@mikro-orm/core";
|
||||
import {Question} from "./question.entity";
|
||||
import {Teacher} from "../users/teacher.entity";
|
||||
import { Entity, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core';
|
||||
import { Question } from './question.entity';
|
||||
import { Teacher } from '../users/teacher.entity';
|
||||
|
||||
@Entity()
|
||||
export class Answer {
|
||||
|
||||
@ManyToOne({entity: () => Teacher, primary: true})
|
||||
@ManyToOne({ entity: () => Teacher, primary: true })
|
||||
author!: Teacher;
|
||||
|
||||
@ManyToOne({entity: () => Question, primary: true})
|
||||
@ManyToOne({ entity: () => Question, primary: true })
|
||||
toQuestion!: Question;
|
||||
|
||||
@PrimaryKey({type: "integer"})
|
||||
@PrimaryKey({ type: 'integer' })
|
||||
sequenceNumber!: number;
|
||||
|
||||
@Property({type: "datetime"})
|
||||
@Property({ type: 'datetime' })
|
||||
timestamp: Date = new Date();
|
||||
|
||||
@Property({type: "text"})
|
||||
@Property({ type: 'text' })
|
||||
content!: string;
|
||||
}
|
||||
|
|
|
@ -1,27 +1,27 @@
|
|||
import {Entity, Enum, ManyToOne, PrimaryKey, Property} from "@mikro-orm/core";
|
||||
import {Language} from "../content/language";
|
||||
import {Student} from "../users/student.entity";
|
||||
import { Entity, Enum, ManyToOne, PrimaryKey, Property } from '@mikro-orm/core';
|
||||
import { Language } from '../content/language';
|
||||
import { Student } from '../users/student.entity';
|
||||
|
||||
@Entity()
|
||||
export class Question {
|
||||
@PrimaryKey({type: "string"})
|
||||
@PrimaryKey({ type: 'string' })
|
||||
learningObjectHruid!: string;
|
||||
|
||||
@Enum({items: () => Language, primary: true})
|
||||
@Enum({ items: () => Language, primary: true })
|
||||
learningObjectLanguage!: Language;
|
||||
|
||||
@PrimaryKey({type: "string"})
|
||||
learningObjectVersion: string = "1";
|
||||
@PrimaryKey({ type: 'string' })
|
||||
learningObjectVersion: string = '1';
|
||||
|
||||
@PrimaryKey({type: "integer"})
|
||||
@PrimaryKey({ type: 'integer' })
|
||||
sequenceNumber!: number;
|
||||
|
||||
@ManyToOne({entity: () => Student})
|
||||
@ManyToOne({ entity: () => Student })
|
||||
author!: Student;
|
||||
|
||||
@Property({type: "datetime"})
|
||||
@Property({ type: 'datetime' })
|
||||
timestamp: Date = new Date();
|
||||
|
||||
@Property({type: "text"})
|
||||
@Property({ type: 'text' })
|
||||
content!: string;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import {User} from "./user.entity";
|
||||
import {Collection, Entity, ManyToMany} from '@mikro-orm/core';
|
||||
import {Class} from "../classes/class.entity";
|
||||
import {Group} from "../assignments/group.entity";
|
||||
import {StudentRepository} from "../../data/users/student-repository";
|
||||
import { User } from './user.entity';
|
||||
import { Collection, Entity, ManyToMany } from '@mikro-orm/core';
|
||||
import { Class } from '../classes/class.entity';
|
||||
import { Group } from '../assignments/group.entity';
|
||||
import { StudentRepository } from '../../data/users/student-repository';
|
||||
|
||||
@Entity({repository: () => StudentRepository})
|
||||
@Entity({ repository: () => StudentRepository })
|
||||
export class Student extends User {
|
||||
@ManyToMany(() => Class)
|
||||
classes!: Collection<Class>;
|
||||
|
@ -12,7 +12,11 @@ export class Student extends User {
|
|||
@ManyToMany(() => Group)
|
||||
groups!: Collection<Group>;
|
||||
|
||||
constructor(public username: string, public firstName: string, public lastName: string) {
|
||||
constructor(
|
||||
public username: string,
|
||||
public firstName: string,
|
||||
public lastName: string
|
||||
) {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import {Collection, Entity, ManyToMany} from '@mikro-orm/core';
|
||||
import {User} from "./user.entity";
|
||||
import {Class} from "../classes/class.entity";
|
||||
import { Collection, Entity, ManyToMany } from '@mikro-orm/core';
|
||||
import { User } from './user.entity';
|
||||
import { Class } from '../classes/class.entity';
|
||||
|
||||
@Entity()
|
||||
export class Teacher extends User {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { Entity, PrimaryKey, Property } from '@mikro-orm/core';
|
||||
|
||||
@Entity({abstract: true})
|
||||
@Entity({ abstract: true })
|
||||
export abstract class User {
|
||||
@PrimaryKey({type: "string"})
|
||||
@PrimaryKey({ type: 'string' })
|
||||
username!: string;
|
||||
|
||||
@Property()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue