From 200974e8f6447ca791e5b53bb2af504a7ecd4800 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Thu, 19 Nov 2020 11:36:09 +0100 Subject: [PATCH] remove deallocate --- .../versions/e93aec8fc41f_added_assigned_action.py | 9 +-------- ereuse_devicehub/resources/action/models.py | 4 ---- ereuse_devicehub/resources/action/schemas.py | 5 ----- ereuse_devicehub/resources/allocate/definitions.py | 6 +----- 4 files changed, 2 insertions(+), 22 deletions(-) diff --git a/ereuse_devicehub/migrations/versions/e93aec8fc41f_added_assigned_action.py b/ereuse_devicehub/migrations/versions/e93aec8fc41f_added_assigned_action.py index effd4dcf..0867d8f9 100644 --- a/ereuse_devicehub/migrations/versions/e93aec8fc41f_added_assigned_action.py +++ b/ereuse_devicehub/migrations/versions/e93aec8fc41f_added_assigned_action.py @@ -38,15 +38,8 @@ def upgrade(): ) op.drop_table('deallocate', schema=f'{get_inv()}') - op.create_table('deallocate', - sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False), - sa.ForeignKeyConstraint(['id'], [f'{get_inv()}.action.id'], ), - sa.PrimaryKeyConstraint('id'), - schema=f'{get_inv()}' - ) - op.add_column('device', sa.Column('inuse', sa.Boolean(), nullable=True), schema=f'{get_inv()}') + op.add_column('device', sa.Column('allocate', sa.Boolean(), nullable=True), schema=f'{get_inv()}') def downgrade(): op.drop_table('allocate', schema=f'{get_inv()}') - op.drop_table('deallocate', schema=f'{get_inv()}') diff --git a/ereuse_devicehub/resources/action/models.py b/ereuse_devicehub/resources/action/models.py index 06c9e6cc..734a5207 100644 --- a/ereuse_devicehub/resources/action/models.py +++ b/ereuse_devicehub/resources/action/models.py @@ -319,10 +319,6 @@ class Allocate(JoinedTableMixin, ActionWithMultipleDevices): end_users = Column(Numeric(precision=4), check_range('end_users', 0), nullable=False) -class Deallocate(JoinedTableMixin, ActionWithMultipleDevices): - pass - - class EraseBasic(JoinedWithOneDeviceMixin, ActionWithOneDevice): """An erasure attempt to a ``DataStorage``. The action contains information about success and nature of the erasure. diff --git a/ereuse_devicehub/resources/action/schemas.py b/ereuse_devicehub/resources/action/schemas.py index 554317eb..0eb3f1c4 100644 --- a/ereuse_devicehub/resources/action/schemas.py +++ b/ereuse_devicehub/resources/action/schemas.py @@ -75,11 +75,6 @@ class Allocate(ActionWithMultipleDevices): required=True) -class Deallocate(ActionWithMultipleDevices): - __doc__ = m.Deallocate.__doc__ - end_time = DateTime(data_key='end_time', description=m.Action.end_time.comment) - - class EraseBasic(ActionWithOneDevice): __doc__ = m.EraseBasic.__doc__ steps = NestedOn('Step', many=True) diff --git a/ereuse_devicehub/resources/allocate/definitions.py b/ereuse_devicehub/resources/allocate/definitions.py index 7cda6eb4..38e740ed 100644 --- a/ereuse_devicehub/resources/allocate/definitions.py +++ b/ereuse_devicehub/resources/allocate/definitions.py @@ -1,14 +1,10 @@ from typing import Callable, Iterable, Tuple from ereuse_devicehub.resources.action import schemas from teal.resource import Resource -from ereuse_devicehub.resources.allocate.views import AllocateView, DeAllocateView +from ereuse_devicehub.resources.allocate.views import AllocateView class AssignedDef(Resource): VIEW = AllocateView SCHEMA = schemas.Allocate - -class EndAssignedDef(Resource): - VIEW = DeAllocateView - SCHEMA = schemas.Deallocate