From 79bc2668e19701d8ef29498779b11ff260a6479e Mon Sep 17 00:00:00 2001 From: inexcode Date: Sat, 13 Aug 2022 02:32:08 +0400 Subject: [PATCH] fix --- selfprivacy_api/graphql/common_types/service.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/selfprivacy_api/graphql/common_types/service.py b/selfprivacy_api/graphql/common_types/service.py index fc9f205..1634f89 100644 --- a/selfprivacy_api/graphql/common_types/service.py +++ b/selfprivacy_api/graphql/common_types/service.py @@ -7,6 +7,7 @@ from selfprivacy_api.services import get_service_by_id, get_services_by_location from selfprivacy_api.services import Service as ServiceInterface from selfprivacy_api.utils.block_devices import BlockDevices + def get_usages(root: "StorageVolume") -> list["StorageUsageInterface"]: """Get usages of a volume""" return [ @@ -19,6 +20,7 @@ def get_usages(root: "StorageVolume") -> list["StorageUsageInterface"]: for service in get_services_by_location(root.name) ] + @strawberry.type class StorageVolume: """Stats and basic info about a volume or a system disk.""" @@ -34,7 +36,6 @@ class StorageVolume: usages: list["StorageUsageInterface"] = strawberry.field(resolver=get_usages) - @strawberry.interface class StorageUsageInterface: used_space: str @@ -132,13 +133,4 @@ def get_volume_by_id(volume_id: str) -> typing.Optional[StorageVolume]: model=volume.model, serial=volume.serial, type=volume.type, - usages=[ - ServiceStorageUsage( - service=service_to_graphql_service(service), - title=service.get_display_name(), - used_space=str(service.get_storage_usage()), - volume=get_volume_by_id(service.get_location()), - ) - for service in get_services_by_location(volume.name) - ], )