From 7f16131ce803dc9c1df3399efc7dedc688a634c0 Mon Sep 17 00:00:00 2001 From: magicfelix <felix@felix-zauberer.de> Date: Fri, 29 Jul 2022 13:54:46 +0200 Subject: [PATCH] Adjust frontend GraphQL mutation --- .../components/alsijil/LessonDocumentation.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/aleksis/apps/alsijil/assets/components/alsijil/LessonDocumentation.js b/aleksis/apps/alsijil/assets/components/alsijil/LessonDocumentation.js index 00443c8ea..5c96a8176 100644 --- a/aleksis/apps/alsijil/assets/components/alsijil/LessonDocumentation.js +++ b/aleksis/apps/alsijil/assets/components/alsijil/LessonDocumentation.js @@ -43,7 +43,11 @@ export default { computed: { lessonDocumentationMutationInputObject() { return { - id: this.id, + year: this.year, + week: this.week, + lessonPeriodId: this.lessonPeriod ? this.lessonPeriod.id : null, + eventId: this.event ? this.event.id : null, + extraLessonId: this.extraLesson ? this.extraLesson.id : null, topic: this.editTopic, groupNote: this.editGroupNote, homework: this.editHomework, @@ -59,18 +63,18 @@ export default { template: ` <ApolloMutation :mutation="gql => gql\` - mutation UpdateLessonDocumentation($input: LessonDocumentationMutationInput!) { - updateLessonDocumentation(input: $input) { - lessonDocumentation { + mutation UpdateLessonDocumentation($year:Int!, $week:Int!, $lessonPeriodId:ID, $topic:String, $homework:String, $groupNote:String){ + updateOrCreateLessonDocumentation(year:$year, week:$week, lessonPeriodId:$lessonPeriodId, topic:$topic, homework:$homework, groupNote:$groupNote){ + lessonDocumentation{ id topic - groupNote homework + groupNote } } } \`" - :variables="{ input: lessonDocumentationMutationInputObject }" + :variables=lessonDocumentationMutationInputObject @done="onDone" > <template v-slot="{ mutate, loading, error }"> -- GitLab