Method to save the updated data for SourceFolder api.
(root, info, input=None)
| 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 | |
| 733 | class CreateLibraryInput(graphene.InputObjectType): |
nothing calls this directly
no test coverage detected