From 2e22ad721982ce5911a7d4da01d9f5d3dcc4597e Mon Sep 17 00:00:00 2001 From: inexcode Date: Sat, 20 Aug 2022 22:50:42 +0400 Subject: [PATCH] Implement Pull repository changes in GraphQL --- .../graphql/mutations/system_mutations.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/selfprivacy_api/graphql/mutations/system_mutations.py b/selfprivacy_api/graphql/mutations/system_mutations.py index c19460f..daada17 100644 --- a/selfprivacy_api/graphql/mutations/system_mutations.py +++ b/selfprivacy_api/graphql/mutations/system_mutations.py @@ -111,3 +111,18 @@ class SystemMutations: message="System reboot has started", code=200, ) + + @strawberry.mutation(permission_classes=[IsAuthenticated]) + def pull_repository_changes(self) -> GenericMutationReturn: + result = system_actions.pull_repository_changes() + if result.status == 0: + return GenericMutationReturn( + success=True, + message="Repository changes pulled", + code=200, + ) + return GenericMutationReturn( + success=False, + message=f"Failed to pull repository changes:\n{result.data}", + code=500, + )