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

Method mutate

photonix/photos/schema.py:715–730  ·  view source on GitHub ↗

Method to save the updated data for SourceFolder api.

(root, info, input=None)

Source from the content-addressed store, hash-verified

713
714 @staticmethod
715 def mutate(root, info, input=None):
716 """Method to save the updated data for SourceFolder api."""
717 ok = False
718 user = info.context.user
719 libraries = Library.objects.filter(users__user=user, users__owner=True, id=input.library_id)
720 if libraries and input.get('source_folder'):
721 library_path = libraries[0].paths.all()[0]
722 library_path.path = input.source_folder
723 library_path.save()
724 return UpdateLibrarySourceFolder(
725 ok=ok,
726 source_folder=library_path.path)
727 if not libraries:
728 raise Exception('User is not the owner of library!')
729 else:
730 return UpdateLibrarySourceFolder(ok=ok, source_folder=None)
731
732
733class CreateLibraryInput(graphene.InputObjectType):

Callers

nothing calls this directly

Calls 3

getMethod · 0.80
saveMethod · 0.80

Tested by

no test coverage detected