MCPcopy
hub / github.com/photonixapp/photonix / mutate

Method mutate

photonix/photos/schema.py:622–638  ·  view source on GitHub ↗

Method to save the updated data for StyleEnabled api.

(root, info, input=None)

Source from the content-addressed store, hash-verified

620
621 @staticmethod
622 def mutate(root, info, input=None):
623 """Method to save the updated data for StyleEnabled api."""
624 ok = False
625 user = info.context.user
626 libraries = Library.objects.filter(users__user=user, users__owner=True, id=input.library_id)
627 if libraries and str(input.get('classification_style_enabled')) != 'None':
628 library_obj = libraries[0]
629 library_obj.classification_style_enabled = input.classification_style_enabled
630 library_obj.save()
631 ok = True
632 return UpdateLibraryStyleEnabled(
633 ok=ok,
634 classification_style_enabled=library_obj.classification_style_enabled)
635 if not libraries:
636 raise Exception('User is not the owner of library!')
637 else:
638 return UpdateLibraryStyleEnabled(ok=ok, classification_style_enabled=None)
639
640
641class UpdateLibraryObjectEnabled(graphene.Mutation):

Callers

nothing calls this directly

Calls 3

getMethod · 0.80
saveMethod · 0.80

Tested by

no test coverage detected