From 364ad0a30135ee87c8787883644ffcab19d0028b Mon Sep 17 00:00:00 2001 From: pablohashescobar Date: Thu, 22 Dec 2022 17:00:20 +0530 Subject: [PATCH] fix: module update serializer and removed create --- apiserver/plane/api/serializers/module.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/apiserver/plane/api/serializers/module.py b/apiserver/plane/api/serializers/module.py index 662c357cd..989802c8b 100644 --- a/apiserver/plane/api/serializers/module.py +++ b/apiserver/plane/api/serializers/module.py @@ -52,6 +52,7 @@ class ModuleWriteSerializer(BaseSerializer): for member in members ], batch_size=10, + ignore_conflicts=True, ) return module @@ -59,24 +60,22 @@ class ModuleWriteSerializer(BaseSerializer): def update(self, instance, validated_data): members = validated_data.pop("members_list", None) - - - module = Module.objects.create(**validated_data, project=instance.project) - if members is not None: + ModuleIssue.objects.filter(module=instance).delete() ModuleMember.objects.bulk_create( [ ModuleMember( - module=module, + module=instance, member=member, project=instance.project, workspace=instance.project.workspace, - created_by=module.created_by, - updated_by=module.updated_by, + created_by=instance.created_by, + updated_by=instance.updated_by, ) for member in members ], batch_size=10, + ignore_conflicts=True ) return super().update(instance, validated_data)