feat: question-teacher route
This commit is contained in:
parent
4968d7cb07
commit
16b73b9e18
6 changed files with 138 additions and 22 deletions
|
@ -2,6 +2,7 @@ import { DwengoEntityRepository } from '../dwengo-entity-repository.js';
|
|||
import { Question } from '../../entities/questions/question.entity.js';
|
||||
import { LearningObjectIdentifier } from '../../entities/content/learning-object-identifier.js';
|
||||
import { Student } from '../../entities/users/student.entity.js';
|
||||
import {LearningObject} from "../../entities/content/learning-object.entity";
|
||||
|
||||
export class QuestionRepository extends DwengoEntityRepository<Question> {
|
||||
public createQuestion(question: {
|
||||
|
@ -42,4 +43,17 @@ export class QuestionRepository extends DwengoEntityRepository<Question> {
|
|||
sequenceNumber: sequenceNumber,
|
||||
});
|
||||
}
|
||||
|
||||
public async findAllByLearningObjects(learningObjects: LearningObject[]): Promise<Question[]> {
|
||||
const objectIdentifiers = learningObjects.map(lo => ({
|
||||
learningObjectHruid: lo.hruid,
|
||||
learningObjectLanguage: lo.language,
|
||||
learningObjectVersion: lo.version
|
||||
}));
|
||||
|
||||
return this.findAll({
|
||||
where: { $or: objectIdentifiers },
|
||||
orderBy: { timestamp: 'ASC' },
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue