From 9ff3f2a7950bb63f79980cd6e1fef983d9c8697c Mon Sep 17 00:00:00 2001
From: Hangzhi Yu <hangzhi@protonmail.com>
Date: Sat, 3 Aug 2024 15:43:09 +0200
Subject: [PATCH] Add id field in amend lesson patch mutation

---
 aleksis/apps/chronos/frontend/components/AmendLesson.vue | 2 +-
 aleksis/apps/chronos/schema/__init__.py                  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/aleksis/apps/chronos/frontend/components/AmendLesson.vue b/aleksis/apps/chronos/frontend/components/AmendLesson.vue
index 0a7e502d..fe1d605c 100644
--- a/aleksis/apps/chronos/frontend/components/AmendLesson.vue
+++ b/aleksis/apps/chronos/frontend/components/AmendLesson.vue
@@ -166,7 +166,7 @@ export default {
       };
     },
     transformPatchData(item) {
-      let { id, __typename, cancelled, ...patchItem } = item;
+      let { __typename, cancelled, ...patchItem } = item;
       return {
         ...patchItem,
         // Normalize cancelled, v-checkbox returns null & does not
diff --git a/aleksis/apps/chronos/schema/__init__.py b/aleksis/apps/chronos/schema/__init__.py
index c6f1cdf0..253f56f1 100644
--- a/aleksis/apps/chronos/schema/__init__.py
+++ b/aleksis/apps/chronos/schema/__init__.py
@@ -107,7 +107,7 @@ class AmendLessonBatchPatchMutation(DatetimeTimezoneMixin, DjangoBatchPatchMutat
     class Meta:
         model = LessonEvent
         permissions = ("chronos.edit_substitution_rule",)
-        only_fields = ("subject", "teachers", "groups", "rooms", "cancelled", "comment")
+        only_fields = ("id", "subject", "teachers", "groups", "rooms", "cancelled", "comment")
 
     @classmethod
     def before_save(cls, root, info, input, updated_objects):  # noqa: A002
-- 
GitLab