feature(backups): add backup structures and queries

pull/35/head
Houkime 2023-01-23 11:15:05 +00:00 committed by Inex Code
parent 7b7f782185
commit a1071fd2c9
3 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,9 @@
import datetime
import strawberry
@strawberry.type
class SnapshotInfo:
id: str
service_name: str
created_at: datetime.datetime

View File

@ -1,7 +1,9 @@
from enum import Enum
import typing
import strawberry
import datetime
from selfprivacy_api.graphql.common_types.dns import DnsRecord
from selfprivacy_api.graphql.common_types.backup_snapshot import SnapshotInfo
from selfprivacy_api.services import get_service_by_id, get_services_by_location
from selfprivacy_api.services import Service as ServiceInterface
@ -101,6 +103,10 @@ class Service:
"""Get storage usage for a service"""
return get_storage_usage(self)
@strawberry.field
def backup_snapshots(self) -> typing.Optional[typing.List[SnapshotInfo]]:
return None
def service_to_graphql_service(service: ServiceInterface) -> Service:
"""Convert service to graphql service"""

View File

@ -0,0 +1,14 @@
"""Backup"""
# pylint: disable=too-few-public-methods
import typing
import strawberry
from selfprivacy_api.graphql.common_types.backup_snapshot import SnapshotInfo
@strawberry.type
class Backup:
backend: str
@strawberry.field
def get_backups(self) -> typing.List[SnapshotInfo]:
return []