mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-28 06:51:28 +00:00
feature(backups): add backup structures and queries
This commit is contained in:
parent
cdcb4ec4c0
commit
fbed185475
9
selfprivacy_api/graphql/common_types/backup_snapshot.py
Normal file
9
selfprivacy_api/graphql/common_types/backup_snapshot.py
Normal file
|
@ -0,0 +1,9 @@
|
|||
import datetime
|
||||
import strawberry
|
||||
|
||||
|
||||
@strawberry.type
|
||||
class SnapshotInfo:
|
||||
id: str
|
||||
service_name: str
|
||||
created_at: datetime.datetime
|
|
@ -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"""
|
||||
|
|
14
selfprivacy_api/graphql/queries/backup.py
Normal file
14
selfprivacy_api/graphql/queries/backup.py
Normal 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 []
|
Loading…
Reference in a new issue