From 64fe93491c5f1dcfa454e35e524dad4c03b12846 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Wed, 18 Nov 2020 11:31:23 +0100 Subject: [PATCH] change name rent resource for assigned --- ereuse_devicehub/config.py | 4 ++-- .../resources/{rent => assigned}/__init__.py | 0 ereuse_devicehub/resources/assigned/definitions.py | 9 +++++++++ ereuse_devicehub/resources/{rent => assigned}/views.py | 2 +- ereuse_devicehub/resources/rent/definitions.py | 8 -------- 5 files changed, 12 insertions(+), 11 deletions(-) rename ereuse_devicehub/resources/{rent => assigned}/__init__.py (100%) create mode 100644 ereuse_devicehub/resources/assigned/definitions.py rename ereuse_devicehub/resources/{rent => assigned}/views.py (98%) delete mode 100644 ereuse_devicehub/resources/rent/definitions.py diff --git a/ereuse_devicehub/config.py b/ereuse_devicehub/config.py index 7c28f5fd..d5226c26 100644 --- a/ereuse_devicehub/config.py +++ b/ereuse_devicehub/config.py @@ -14,7 +14,7 @@ from ereuse_devicehub.resources.device import definitions from ereuse_devicehub.resources.documents import documents from ereuse_devicehub.resources.enums import PriceSoftware from ereuse_devicehub.resources.versions import versions -from ereuse_devicehub.resources.rent import definitions as rent_def +from ereuse_devicehub.resources.assigned import definitions as assigned_def class DevicehubConfig(Config): @@ -29,7 +29,7 @@ class DevicehubConfig(Config): import_resource(documents), import_resource(inventory), import_resource(versions), - import_resource(rent_def)), + import_resource(assigned_def)), ) PASSWORD_SCHEMES = {'pbkdf2_sha256'} # type: Set[str] DB_USER = config('DB_USER', 'dhub') diff --git a/ereuse_devicehub/resources/rent/__init__.py b/ereuse_devicehub/resources/assigned/__init__.py similarity index 100% rename from ereuse_devicehub/resources/rent/__init__.py rename to ereuse_devicehub/resources/assigned/__init__.py diff --git a/ereuse_devicehub/resources/assigned/definitions.py b/ereuse_devicehub/resources/assigned/definitions.py new file mode 100644 index 00000000..f2ce97ba --- /dev/null +++ b/ereuse_devicehub/resources/assigned/definitions.py @@ -0,0 +1,9 @@ +from typing import Callable, Iterable, Tuple +from ereuse_devicehub.resources.action import schemas +from teal.resource import Resource +from ereuse_devicehub.resources.assigned.views import AssignedView + + +class AssignedDef(Resource): + VIEW = AssignedView + SCHEMA = schemas.Assigned diff --git a/ereuse_devicehub/resources/rent/views.py b/ereuse_devicehub/resources/assigned/views.py similarity index 98% rename from ereuse_devicehub/resources/rent/views.py rename to ereuse_devicehub/resources/assigned/views.py index e8ed15ad..e07471cd 100644 --- a/ereuse_devicehub/resources/rent/views.py +++ b/ereuse_devicehub/resources/assigned/views.py @@ -10,7 +10,7 @@ from ereuse_devicehub.query import things_response from ereuse_devicehub.resources.action.models import Assigned -class RentingView(View): +class AssignedView(View): @auth.Auth.requires_auth def get(self, id: uuid.UUID) -> Assigned: return super().get(id) diff --git a/ereuse_devicehub/resources/rent/definitions.py b/ereuse_devicehub/resources/rent/definitions.py deleted file mode 100644 index e87e0f72..00000000 --- a/ereuse_devicehub/resources/rent/definitions.py +++ /dev/null @@ -1,8 +0,0 @@ -from ereuse_devicehub.resources.action import schemas -from teal.resource import Resource -from ereuse_devicehub.resources.rent.views import RentingView - - -class RentDef(Resource): - VIEW = RentingView - SCHEMA = schemas.Assigned