From 2c21bd2a14ffadede4188f6b726aaaea7a01ec00 Mon Sep 17 00:00:00 2001 From: Inex Code Date: Thu, 29 Jun 2023 13:45:00 +0300 Subject: [PATCH] feat(backups): expose if the service can be backed up --- selfprivacy_api/graphql/common_types/service.py | 2 ++ selfprivacy_api/services/ocserv/__init__.py | 4 ++++ selfprivacy_api/services/service.py | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/selfprivacy_api/graphql/common_types/service.py b/selfprivacy_api/graphql/common_types/service.py index b3403e9..fd671d4 100644 --- a/selfprivacy_api/graphql/common_types/service.py +++ b/selfprivacy_api/graphql/common_types/service.py @@ -93,6 +93,7 @@ class Service: is_movable: bool is_required: bool is_enabled: bool + can_be_backed_up: bool status: ServiceStatusEnum url: typing.Optional[str] dns_records: typing.Optional[typing.List[DnsRecord]] @@ -124,6 +125,7 @@ def service_to_graphql_service(service: ServiceInterface) -> Service: is_movable=service.is_movable(), is_required=service.is_required(), is_enabled=service.is_enabled(), + can_be_backed_up=service.can_be_backed_up(), status=ServiceStatusEnum(service.get_status().value), url=service.get_url(), dns_records=[ diff --git a/selfprivacy_api/services/ocserv/__init__.py b/selfprivacy_api/services/ocserv/__init__.py index a15cb84..4f46692 100644 --- a/selfprivacy_api/services/ocserv/__init__.py +++ b/selfprivacy_api/services/ocserv/__init__.py @@ -44,6 +44,10 @@ class Ocserv(Service): def is_required() -> bool: return False + @staticmethod + def can_be_backed_up() -> bool: + return False + @staticmethod def is_enabled() -> bool: with ReadUserData() as user_data: diff --git a/selfprivacy_api/services/service.py b/selfprivacy_api/services/service.py index f804773..65337b4 100644 --- a/selfprivacy_api/services/service.py +++ b/selfprivacy_api/services/service.py @@ -81,6 +81,10 @@ class Service(ABC): def is_required() -> bool: pass + @staticmethod + def can_be_backed_up() -> bool: + return True + @staticmethod @abstractmethod def is_enabled() -> bool: