drop deliverynote_address
This commit is contained in:
parent
95f04094c7
commit
fe824cc4fa
|
@ -28,7 +28,11 @@ def get_inv():
|
||||||
|
|
||||||
def upgrade():
|
def upgrade():
|
||||||
op.drop_column('deliverynote', 'ethereum_address', schema=f'{get_inv()}')
|
op.drop_column('deliverynote', 'ethereum_address', schema=f'{get_inv()}')
|
||||||
|
op.drop_column('computer', 'deliverynote_address', schema=f'{get_inv()}')
|
||||||
|
op.drop_column('lot', 'deliverynote_address', schema=f'{get_inv()}')
|
||||||
|
|
||||||
|
|
||||||
def downgrade():
|
def downgrade():
|
||||||
op.add_column('deliverynote', sa.Column('ethereum_address', citext.CIText(), nullable=True), schema=f'{get_inv()}')
|
op.add_column('deliverynote', sa.Column('ethereum_address', citext.CIText(), nullable=True), schema=f'{get_inv()}')
|
||||||
|
op.add_column('computer', sa.Column('deliverynote_address', citext.CIText(), nullable=True), schema=f'{get_inv()}')
|
||||||
|
op.add_column('lot', sa.Column('deliverynote_address', citext.CIText(), nullable=True), schema=f'{get_inv()}')
|
||||||
|
|
|
@ -30,7 +30,6 @@ class Lot(Thing):
|
||||||
transfer_state = ... # type: Column
|
transfer_state = ... # type: Column
|
||||||
receiver_address = ... # type: Column
|
receiver_address = ... # type: Column
|
||||||
receiver = ... # type: relationship
|
receiver = ... # type: relationship
|
||||||
deliverynote_address = ... # type: Column
|
|
||||||
|
|
||||||
def __init__(self, name: str, closed: bool = closed.default.arg) -> None:
|
def __init__(self, name: str, closed: bool = closed.default.arg) -> None:
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
@ -46,7 +45,6 @@ class Lot(Thing):
|
||||||
self.owner_address = ... # type: UUID
|
self.owner_address = ... # type: UUID
|
||||||
self.transfer_state = ...
|
self.transfer_state = ...
|
||||||
self.receiver_address = ... # type: str
|
self.receiver_address = ... # type: str
|
||||||
self.deliverynote_address = ... # type: str
|
|
||||||
|
|
||||||
def add_children(self, *children: Union[Lot, uuid.UUID]):
|
def add_children(self, *children: Union[Lot, uuid.UUID]):
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -484,7 +484,6 @@ class Computer(Device):
|
||||||
db.ForeignKey(User.id),
|
db.ForeignKey(User.id),
|
||||||
nullable=True)
|
nullable=True)
|
||||||
receiver = db.relationship(User, primaryjoin=receiver_id == User.id)
|
receiver = db.relationship(User, primaryjoin=receiver_id == User.id)
|
||||||
deliverynote_address = db.Column(CIText(), nullable=True)
|
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs) -> None:
|
def __init__(self, *args, **kwargs) -> None:
|
||||||
if args:
|
if args:
|
||||||
|
|
|
@ -145,7 +145,6 @@ class Computer(DisplayMixin, Device):
|
||||||
owner_address = ... # type: Column
|
owner_address = ... # type: Column
|
||||||
transfer_state = ... # type: Column
|
transfer_state = ... # type: Column
|
||||||
receiver_address = ... # type: Column
|
receiver_address = ... # type: Column
|
||||||
deliverynote_address = ... # type: Column
|
|
||||||
|
|
||||||
def __init__(self, **kwargs) -> None:
|
def __init__(self, **kwargs) -> None:
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
@ -155,7 +154,6 @@ class Computer(DisplayMixin, Device):
|
||||||
self.owner_address = ... # type: UUID
|
self.owner_address = ... # type: UUID
|
||||||
self.transfer_state = ...
|
self.transfer_state = ...
|
||||||
self.receiver_address = ... # type: str
|
self.receiver_address = ... # type: str
|
||||||
self.deliverynote_address = ... # type: str
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def actions(self) -> List:
|
def actions(self) -> List:
|
||||||
|
|
|
@ -130,7 +130,6 @@ class Computer(Device):
|
||||||
owner_id = UUID(data_key='ownerID')
|
owner_id = UUID(data_key='ownerID')
|
||||||
transfer_state = EnumField(enums.TransferState, description=m.Computer.transfer_state.comment)
|
transfer_state = EnumField(enums.TransferState, description=m.Computer.transfer_state.comment)
|
||||||
receiver_id = UUID(data_key='receiverID')
|
receiver_id = UUID(data_key='receiverID')
|
||||||
deliverynote_address = SanitizedStr(validate=f.validate.Length(max=42))
|
|
||||||
|
|
||||||
|
|
||||||
class Desktop(Computer):
|
class Desktop(Computer):
|
||||||
|
|
|
@ -106,7 +106,7 @@ class DeviceView(View):
|
||||||
resource_def = app.resources['Computer']
|
resource_def = app.resources['Computer']
|
||||||
# TODO check how to handle the 'actions_one'
|
# TODO check how to handle the 'actions_one'
|
||||||
patch_schema = resource_def.SCHEMA(
|
patch_schema = resource_def.SCHEMA(
|
||||||
only=['ethereum_address', 'transfer_state', 'deliverynote_address', 'actions_one'], partial=True)
|
only=['ethereum_address', 'transfer_state', 'actions_one'], partial=True)
|
||||||
json = request.get_json(schema=patch_schema)
|
json = request.get_json(schema=patch_schema)
|
||||||
# TODO check how to handle the 'actions_one'
|
# TODO check how to handle the 'actions_one'
|
||||||
json.pop('actions_one')
|
json.pop('actions_one')
|
||||||
|
|
|
@ -75,7 +75,6 @@ class Lot(Thing):
|
||||||
db.ForeignKey(User.ethereum_address),
|
db.ForeignKey(User.ethereum_address),
|
||||||
nullable=True)
|
nullable=True)
|
||||||
receiver = db.relationship(User, primaryjoin=receiver_address == User.ethereum_address)
|
receiver = db.relationship(User, primaryjoin=receiver_address == User.ethereum_address)
|
||||||
deliverynote_address = db.Column(CIText(), nullable=True)
|
|
||||||
|
|
||||||
def __init__(self, name: str, closed: bool = closed.default.arg,
|
def __init__(self, name: str, closed: bool = closed.default.arg,
|
||||||
description: str = None) -> None:
|
description: str = None) -> None:
|
||||||
|
|
|
@ -30,7 +30,6 @@ class Lot(Thing):
|
||||||
transfer_state = ... # type: Column
|
transfer_state = ... # type: Column
|
||||||
receiver_address = ... # type: Column
|
receiver_address = ... # type: Column
|
||||||
receiver = ... # type: relationship
|
receiver = ... # type: relationship
|
||||||
deliverynote_address = ... # type: Column
|
|
||||||
|
|
||||||
def __init__(self, name: str, closed: bool = closed.default.arg) -> None:
|
def __init__(self, name: str, closed: bool = closed.default.arg) -> None:
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
@ -46,7 +45,6 @@ class Lot(Thing):
|
||||||
self.owner_address = ... # type: UUID
|
self.owner_address = ... # type: UUID
|
||||||
self.transfer_state = ...
|
self.transfer_state = ...
|
||||||
self.receiver_address = ... # type: str
|
self.receiver_address = ... # type: str
|
||||||
self.deliverynote_address = ... # type: str
|
|
||||||
|
|
||||||
def add_children(self, *children: Union[Lot, uuid.UUID]):
|
def add_children(self, *children: Union[Lot, uuid.UUID]):
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -41,11 +41,11 @@ class LotView(View):
|
||||||
|
|
||||||
def patch(self, id):
|
def patch(self, id):
|
||||||
patch_schema = self.resource_def.SCHEMA(only=(
|
patch_schema = self.resource_def.SCHEMA(only=(
|
||||||
'name', 'description', 'transfer_state', 'receiver_address', 'deposit', 'deliverynote_address', 'devices',
|
'name', 'description', 'transfer_state', 'receiver_address', 'deposit', 'devices',
|
||||||
'owner_address'), partial=True)
|
'owner_address'), partial=True)
|
||||||
l = request.get_json(schema=patch_schema)
|
l = request.get_json(schema=patch_schema)
|
||||||
lot = Lot.query.filter_by(id=id).one()
|
lot = Lot.query.filter_by(id=id).one()
|
||||||
device_fields = ['transfer_state', 'receiver_address', 'deposit', 'deliverynote_address', 'owner_address']
|
device_fields = ['transfer_state', 'receiver_address', 'deposit', 'owner_address']
|
||||||
computers = [x for x in lot.all_devices if isinstance(x, Computer)]
|
computers = [x for x in lot.all_devices if isinstance(x, Computer)]
|
||||||
for key, value in l.items():
|
for key, value in l.items():
|
||||||
setattr(lot, key, value)
|
setattr(lot, key, value)
|
||||||
|
|
|
@ -125,7 +125,6 @@ def test_physical_properties():
|
||||||
}
|
}
|
||||||
assert pc.physical_properties == {
|
assert pc.physical_properties == {
|
||||||
'chassis': ComputerChassis.Tower,
|
'chassis': ComputerChassis.Tower,
|
||||||
'deliverynote_address': None,
|
|
||||||
'deposit': 0,
|
'deposit': 0,
|
||||||
'ethereum_address': None,
|
'ethereum_address': None,
|
||||||
'manufacturer': 'bar',
|
'manufacturer': 'bar',
|
||||||
|
|
Reference in a new issue