From 23abf3e08d788d434ade149aa677481427fa38e2 Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Mon, 30 Nov 2020 18:17:47 +0100 Subject: [PATCH] change code for transaction --- .../versions/e93aec8fc41f_added_assigned_action.py | 4 ++-- ereuse_devicehub/resources/action/models.py | 4 ++-- ereuse_devicehub/resources/action/schemas.py | 10 ++++++---- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/ereuse_devicehub/migrations/versions/e93aec8fc41f_added_assigned_action.py b/ereuse_devicehub/migrations/versions/e93aec8fc41f_added_assigned_action.py index b1f6aa4f..690967e4 100644 --- a/ereuse_devicehub/migrations/versions/e93aec8fc41f_added_assigned_action.py +++ b/ereuse_devicehub/migrations/versions/e93aec8fc41f_added_assigned_action.py @@ -30,7 +30,7 @@ def upgrade(): # Allocate action op.drop_table('allocate', schema=f'{get_inv()}') op.create_table('allocate', - sa.Column('code', citext.CIText(), nullable=True, comment=' This is a internal code for mainteing the secrets of the personal datas of the new holder '), + sa.Column('transaction', citext.CIText(), nullable=True, comment='The code used from the owner for relation with external tool.'), sa.Column('end_users', sa.Numeric(precision=4), nullable=True), sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False), sa.ForeignKeyConstraint(['id'], [f'{get_inv()}.action.id'], ), @@ -41,7 +41,7 @@ def upgrade(): # Deallocate action op.drop_table('deallocate', schema=f'{get_inv()}') op.create_table('deallocate', - sa.Column('code', citext.CIText(), nullable=True, comment=' This is a internal code for mainteing the secrets of the personal datas of the new holder '), + sa.Column('transaction', citext.CIText(), nullable=True, comment='The code used from the owner for relation with external tool.'), sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False), sa.ForeignKeyConstraint(['id'], [f'{get_inv()}.action.id'], ), sa.PrimaryKeyConstraint('id'), diff --git a/ereuse_devicehub/resources/action/models.py b/ereuse_devicehub/resources/action/models.py index 6b22f9b8..31be2b40 100644 --- a/ereuse_devicehub/resources/action/models.py +++ b/ereuse_devicehub/resources/action/models.py @@ -321,8 +321,8 @@ class Allocate(JoinedTableMixin, ActionWithMultipleDevices): class Deallocate(JoinedTableMixin, ActionWithMultipleDevices): """The act of deallocate one list of devices to one person of the system or not """ - code = Column(CIText(), default='', nullable=True) - code.comment = """ This is a internal code for mainteing the secrets of the personal datas of the new holder """ + transaction= Column(CIText(), default='', nullable=True) + transaction.comment = """ This is a internal code for mainteing the secrets of the personal datas of the new holder """ class EraseBasic(JoinedWithOneDeviceMixin, ActionWithOneDevice): diff --git a/ereuse_devicehub/resources/action/schemas.py b/ereuse_devicehub/resources/action/schemas.py index 1d361f20..4c72a456 100644 --- a/ereuse_devicehub/resources/action/schemas.py +++ b/ereuse_devicehub/resources/action/schemas.py @@ -71,9 +71,10 @@ class Allocate(ActionWithMultipleDevices): description=m.Action.start_time.comment) end_time = DateTime(data_key='endTime', required=False, description=m.Action.end_time.comment) - code = SanitizedStr(data_key='transaction', validate=Length(min=1, max=STR_BIG_SIZE), + transaction = SanitizedStr(validate=Length(min=1, max=STR_BIG_SIZE), required=False, - description='The code of the agent to assigned.') + description='The code used from the owner for \ + relation with external tool.') end_users = Integer(data_key='endUsers', validate=[Range(min=1, error="Value must be greater than 0")]) @validates_schema @@ -97,9 +98,10 @@ class Deallocate(ActionWithMultipleDevices): __doc__ = m.Deallocate.__doc__ start_time = DateTime(data_key='startTime', required=True, description=m.Action.start_time.comment) - code = SanitizedStr(data_key='transaction', validate=Length(min=1, max=STR_BIG_SIZE), + transaction = SanitizedStr(validate=Length(min=1, max=STR_BIG_SIZE), required=False, - description='The code of the agent to assigned.') + description='The code used from the owner for \ + relation with external tool.') @validates_schema def validate_deallocate(self, data: dict):