fix: question service + refactor loID
This commit is contained in:
parent
dbc1da741c
commit
bd75ab8af9
16 changed files with 86 additions and 81 deletions
|
@ -1,9 +1,11 @@
|
|||
import { Question } from '../entities/questions/question.entity.js';
|
||||
import { mapToStudentDTO } from './student.js';
|
||||
import { QuestionDTO, QuestionId } from '@dwengo-1/common/interfaces/question';
|
||||
import { LearningObjectIdentifier } from '@dwengo-1/common/interfaces/learning-content';
|
||||
import { LearningObjectIdentifierDTO } from '@dwengo-1/common/interfaces/learning-content';
|
||||
import { LearningObjectIdentifier } from '../entities/content/learning-object-identifier.js';
|
||||
|
||||
function getLearningObjectIdentifier(question: Question): LearningObjectIdentifier {
|
||||
|
||||
function getLearningObjectIdentifier(question: Question): LearningObjectIdentifierDTO {
|
||||
return {
|
||||
hruid: question.learningObjectHruid,
|
||||
language: question.learningObjectLanguage,
|
||||
|
@ -11,6 +13,14 @@ function getLearningObjectIdentifier(question: Question): LearningObjectIdentifi
|
|||
};
|
||||
}
|
||||
|
||||
export function mapToLearningObjectID(loID: LearningObjectIdentifierDTO): LearningObjectIdentifier {
|
||||
return {
|
||||
hruid: loID.hruid,
|
||||
language: loID.language,
|
||||
version: loID.version ?? 1
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a Question entity to a DTO format.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue