Skip to content

Commit

Permalink
fix: Remove membership type from group save params
Browse files Browse the repository at this point in the history
  • Loading branch information
josebui committed Nov 15, 2023
1 parent 55b2795 commit 3a0b7b8
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions terraso_backend/apps/graphql/schema/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,15 @@ def mutate_and_get_payload(cls, root, info, **kwargs):
if not cls.is_update(kwargs):
kwargs["created_by"] = user

membership_type = kwargs.pop("membership_type") if "membership_type" in kwargs else None

result = super().mutate_and_get_payload(root, info, **kwargs)

group = result.group

if "membership_type" in kwargs:
if membership_type:
group.membership_list.membership_type = MembershipList.get_membership_type_from_text(
kwargs["membership_type"]
membership_type
)
group.membership_list.save()

Expand Down Expand Up @@ -166,13 +168,15 @@ def mutate_and_get_payload(cls, root, info, **kwargs):
model_name=Group.__name__, operation=MutationTypes.UPDATE
)

membership_type = kwargs.pop("membership_type") if "membership_type" in kwargs else None

result = super().mutate_and_get_payload(root, info, **kwargs)

group = result.group

if "membership_type" in kwargs:
if membership_type:
group.membership_list.membership_type = MembershipList.get_membership_type_from_text(
kwargs["membership_type"]
membership_type
)
group.membership_list.save()

Expand Down

0 comments on commit 3a0b7b8

Please sign in to comment.