feature(backups): add backup structures and queries

This commit is contained in:
Houkime 2023-01-23 11:15:05 +00:00
parent 740b072b07
commit 6d73405118
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 []