Merge remote-tracking branch 'origin/dev' into feature/own-learning-objects

# Conflicts:
#	backend/package.json
#	backend/src/config.ts
#	backend/src/controllers/learningObjects.ts
#	backend/src/controllers/learningPaths.ts
#	backend/src/data/content/attachment-repository.ts
#	backend/src/data/content/learning-object-repository.ts
#	backend/src/data/content/learning-path-repository.ts
#	backend/src/data/repositories.ts
#	backend/src/entities/content/learning-path.entity.ts
#	backend/src/exceptions.ts
#	backend/src/routes/learning-objects.ts
#	backend/src/services/learningObjects.ts
#	backend/src/services/learningPaths.ts
#	backend/src/util/apiHelper.ts
#	backend/src/util/envvars.ts
#	package-lock.json
This commit is contained in:
Gerald Schmittinger 2025-03-11 03:01:18 +01:00
commit cd0a3a8a7b
119 changed files with 8837 additions and 1697 deletions

View file

@ -1,11 +1,4 @@
import {
Entity,
Enum,
ManyToOne,
OneToMany,
PrimaryKey,
Property,
} from '@mikro-orm/core';
import { Entity, Enum, ManyToOne, OneToMany, PrimaryKey, Property } from '@mikro-orm/core';
import { Class } from '../classes/class.entity.js';
import { Group } from './group.entity.js';
import { Language } from '../content/language.js';

View file

@ -5,12 +5,17 @@ import {GroupRepository} from "../../data/assignments/group-repository";
@Entity({repository: () => GroupRepository})
export class Group {
@ManyToOne({ entity: () => Assignment, primary: true })
@ManyToOne({
entity: () => Assignment,
primary: true,
})
assignment!: Assignment;
@PrimaryKey({ type: 'integer' })
groupNumber!: number;
@ManyToMany({ entity: () => Student })
@ManyToMany({
entity: () => Student,
})
members!: Student[];
}

View file

@ -9,7 +9,10 @@ export class Submission {
@PrimaryKey({ type: 'string' })
learningObjectHruid!: string;
@Enum({ items: () => Language, primary: true })
@Enum({
items: () => Language,
primary: true,
})
learningObjectLanguage!: Language;
@PrimaryKey({ type: 'string' })
@ -18,13 +21,18 @@ export class Submission {
@PrimaryKey({ type: 'integer' })
submissionNumber!: number;
@ManyToOne({ entity: () => Student })
@ManyToOne({
entity: () => Student,
})
submitter!: Student;
@Property({ type: 'datetime' })
submissionTime!: Date;
@ManyToOne({ entity: () => Group, nullable: true })
@ManyToOne({
entity: () => Group,
nullable: true,
})
onBehalfOf?: Group;
@Property({ type: 'json' })

View file

@ -5,10 +5,16 @@ import {ClassJoinRequestRepository} from "../../data/classes/class-join-request-
@Entity({repository: () => ClassJoinRequestRepository})
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)

View file

@ -1,10 +1,4 @@
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.js';
import { Student } from '../users/student.entity.js';

View file

@ -8,12 +8,21 @@ import {TeacherInvitationRepository} from "../../data/classes/teacher-invitation
*/
@Entity({repository: () => TeacherInvitationRepository})
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;
}

View file

@ -4,7 +4,10 @@ import {AttachmentRepository} from "../../data/content/attachment-repository";
@Entity({repository: () => AttachmentRepository})
export class Attachment {
@ManyToOne({ entity: () => LearningObject, primary: true })
@ManyToOne({
entity: () => LearningObject,
primary: true,
})
learningObject!: LearningObject;
@PrimaryKey({ type: 'string' })

View file

@ -1,13 +1,4 @@
import {
Embeddable,
Embedded,
Entity,
Enum,
ManyToMany,
OneToMany,
PrimaryKey,
Property,
} from '@mikro-orm/core';
import { Embeddable, Embedded, Entity, Enum, ManyToMany, OneToMany, PrimaryKey, Property } from '@mikro-orm/core';
import { Language } from './language.js';
import { Attachment } from './attachment.entity.js';
import { Teacher } from '../users/teacher.entity.js';
@ -20,7 +11,10 @@ export class LearningObject {
@PrimaryKey({ type: 'string' })
hruid!: string;
@Enum({ items: () => Language, primary: true })
@Enum({
items: () => Language,
primary: true,
})
language!: Language;
@PrimaryKey({ type: 'number' })
@ -29,7 +23,9 @@ export class LearningObject {
@Property({type: 'uuid', unique: true})
uuid = v4();
@ManyToMany({ entity: () => Teacher })
@ManyToMany({
entity: () => Teacher,
})
admins!: Teacher[];
@Property({ type: 'string' })
@ -53,7 +49,10 @@ export class LearningObject {
@Property({ type: 'array' })
skosConcepts!: string[];
@Embedded({ entity: () => EducationalGoal, array: true })
@Embedded({
entity: () => EducationalGoal,
array: true,
})
educationalGoals: EducationalGoal[] = [];
@Property({ type: 'string' })
@ -68,7 +67,9 @@ export class LearningObject {
@Property({ type: 'integer' })
estimatedTime!: number;
@Embedded({ entity: () => ReturnValue })
@Embedded({
entity: () => ReturnValue,
})
returnValue!: ReturnValue;
@Property({ type: 'bool' })
@ -77,7 +78,10 @@ export class LearningObject {
@Property({ type: 'string', nullable: true })
contentLocation?: string;
@OneToMany({ entity: () => Attachment, mappedBy: 'learningObject' })
@OneToMany({
entity: () => Attachment,
mappedBy: 'learningObject',
})
attachments: Attachment[] = [];
@Property({ type: 'blob' })

View file

@ -5,10 +5,16 @@ import {AnswerRepository} from "../../data/questions/answer-repository";
@Entity({repository: () => AnswerRepository})
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' })

View file

@ -8,7 +8,10 @@ export class Question {
@PrimaryKey({ type: 'string' })
learningObjectHruid!: string;
@Enum({ items: () => Language, primary: true })
@Enum({
items: () => Language,
primary: true,
})
learningObjectLanguage!: Language;
@PrimaryKey({ type: 'string' })
@ -17,7 +20,9 @@ export class Question {
@PrimaryKey({ type: 'integer' })
sequenceNumber!: number;
@ManyToOne({ entity: () => Student })
@ManyToOne({
entity: () => Student,
})
author!: Student;
@Property({ type: 'datetime' })

View file

@ -4,7 +4,9 @@ import { Class } from '../classes/class.entity.js';
import { Group } from '../assignments/group.entity.js';
import { StudentRepository } from '../../data/users/student-repository.js';
@Entity({ repository: () => StudentRepository })
@Entity({
repository: () => StudentRepository,
})
export class Student extends User {
@ManyToMany(() => Class)
classes!: Collection<Class>;