feat(backend): Groep aan primaire sleutel van submissions en questions toegevoegd.
This commit is contained in:
parent
dbc1da741c
commit
12c1505ba7
3 changed files with 13 additions and 6 deletions
|
@ -5,12 +5,13 @@ import { Student } from '../../entities/users/student.entity.js';
|
||||||
import { LearningObject } from '../../entities/content/learning-object.entity.js';
|
import { LearningObject } from '../../entities/content/learning-object.entity.js';
|
||||||
|
|
||||||
export class QuestionRepository extends DwengoEntityRepository<Question> {
|
export class QuestionRepository extends DwengoEntityRepository<Question> {
|
||||||
public async createQuestion(question: { loId: LearningObjectIdentifier; author: Student; content: string }): Promise<Question> {
|
public async createQuestion(question: { loId: LearningObjectIdentifier; author: Student; group: Group, content: string }): Promise<Question> {
|
||||||
const questionEntity = this.create({
|
const questionEntity = this.create({
|
||||||
learningObjectHruid: question.loId.hruid,
|
learningObjectHruid: question.loId.hruid,
|
||||||
learningObjectLanguage: question.loId.language,
|
learningObjectLanguage: question.loId.language,
|
||||||
learningObjectVersion: question.loId.version,
|
learningObjectVersion: question.loId.version,
|
||||||
author: question.author,
|
author: question.author,
|
||||||
|
group: question.group,
|
||||||
content: question.content,
|
content: question.content,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
});
|
});
|
||||||
|
@ -18,6 +19,7 @@ export class QuestionRepository extends DwengoEntityRepository<Question> {
|
||||||
questionEntity.learningObjectLanguage = question.loId.language;
|
questionEntity.learningObjectLanguage = question.loId.language;
|
||||||
questionEntity.learningObjectVersion = question.loId.version;
|
questionEntity.learningObjectVersion = question.loId.version;
|
||||||
questionEntity.author = question.author;
|
questionEntity.author = question.author;
|
||||||
|
questionEntity.group = question.group;
|
||||||
questionEntity.content = question.content;
|
questionEntity.content = question.content;
|
||||||
return this.insert(questionEntity);
|
return this.insert(questionEntity);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,12 @@ export class Submission {
|
||||||
@PrimaryKey({ type: 'integer', autoincrement: true })
|
@PrimaryKey({ type: 'integer', autoincrement: true })
|
||||||
submissionNumber?: number;
|
submissionNumber?: number;
|
||||||
|
|
||||||
|
@ManyToOne({
|
||||||
|
entity: () => Group,
|
||||||
|
primary: true
|
||||||
|
})
|
||||||
|
onBehalfOf: Group;
|
||||||
|
|
||||||
@ManyToOne({
|
@ManyToOne({
|
||||||
entity: () => Student,
|
entity: () => Student,
|
||||||
})
|
})
|
||||||
|
@ -29,11 +35,7 @@ export class Submission {
|
||||||
@Property({ type: 'datetime' })
|
@Property({ type: 'datetime' })
|
||||||
submissionTime!: Date;
|
submissionTime!: Date;
|
||||||
|
|
||||||
@ManyToOne({
|
|
||||||
entity: () => Group,
|
|
||||||
nullable: true,
|
|
||||||
})
|
|
||||||
onBehalfOf?: Group;
|
|
||||||
|
|
||||||
@Property({ type: 'json' })
|
@Property({ type: 'json' })
|
||||||
content!: string;
|
content!: string;
|
||||||
|
|
|
@ -20,6 +20,9 @@ export class Question {
|
||||||
@PrimaryKey({ type: 'integer', autoincrement: true })
|
@PrimaryKey({ type: 'integer', autoincrement: true })
|
||||||
sequenceNumber?: number;
|
sequenceNumber?: number;
|
||||||
|
|
||||||
|
@ManyToOne({ entity: () => Group, primary: true })
|
||||||
|
inGroup: Group;
|
||||||
|
|
||||||
@ManyToOne({
|
@ManyToOne({
|
||||||
entity: () => Student,
|
entity: () => Student,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue