change code for transaction

This commit is contained in:
Cayo Puigdefabregas 2020-11-30 18:17:47 +01:00
parent bcb3358af3
commit 23abf3e08d
3 changed files with 10 additions and 8 deletions

View File

@ -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'),

View File

@ -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):

View File

@ -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):