fix: mikrORM fix voor questions
This commit is contained in:
parent
50cfcb69a6
commit
c8d1112db2
2 changed files with 11 additions and 7 deletions
|
@ -18,13 +18,14 @@ export class QuestionRepository extends DwengoEntityRepository<Question> {
|
||||||
content: question.content,
|
content: question.content,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
});
|
});
|
||||||
|
await this.insert(questionEntity);
|
||||||
questionEntity.learningObjectHruid = question.loId.hruid;
|
questionEntity.learningObjectHruid = question.loId.hruid;
|
||||||
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.inGroup = question.inGroup;
|
questionEntity.inGroup = question.inGroup;
|
||||||
questionEntity.content = question.content;
|
questionEntity.content = question.content;
|
||||||
return await this.insert(questionEntity);
|
return questionEntity;
|
||||||
}
|
}
|
||||||
public async findAllQuestionsAboutLearningObject(loId: LearningObjectIdentifier): Promise<Question[]> {
|
public async findAllQuestionsAboutLearningObject(loId: LearningObjectIdentifier): Promise<Question[]> {
|
||||||
return this.findAll({
|
return this.findAll({
|
||||||
|
|
|
@ -139,12 +139,15 @@
|
||||||
(assignment) => assignment.learningPath === props.hruid && assignment.language === props.language,
|
(assignment) => assignment.learningPath === props.hruid && assignment.language === props.language,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
const loID: ComputedRef<LearningObjectIdentifierDTO> = computed(() => {
|
||||||
|
return {
|
||||||
|
hruid: props.learningObjectHruid as string,
|
||||||
|
language: props.language,
|
||||||
|
version: currentNode.value?.version
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
const loID: LearningObjectIdentifierDTO = {
|
const createQuestionMutation = useCreateQuestionMutation(loID.value);
|
||||||
hruid: props.learningObjectHruid as string,
|
|
||||||
language: props.language,
|
|
||||||
};
|
|
||||||
const createQuestionMutation = useCreateQuestionMutation(loID);
|
|
||||||
const groupsQueryResult = useStudentGroupsQuery(authService.authState.user?.profile.preferred_username);
|
const groupsQueryResult = useStudentGroupsQuery(authService.authState.user?.profile.preferred_username);
|
||||||
|
|
||||||
const questionInput = ref("");
|
const questionInput = ref("");
|
||||||
|
@ -159,7 +162,7 @@
|
||||||
const questionData: QuestionData = {
|
const questionData: QuestionData = {
|
||||||
author: authService.authState.user?.profile.preferred_username,
|
author: authService.authState.user?.profile.preferred_username,
|
||||||
content: questionInput.value,
|
content: questionInput.value,
|
||||||
inGroup: group, //TODO: POST response zegt dat dit null is???
|
inGroup: group,
|
||||||
};
|
};
|
||||||
if (questionInput.value !== "") {
|
if (questionInput.value !== "") {
|
||||||
createQuestionMutation.mutate(questionData, {
|
createQuestionMutation.mutate(questionData, {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue