Merge branch 'feature/rm-ethereum-constraint' into mvp_deliverynote

This commit is contained in:
Big Lebowski 2020-04-13 13:21:51 +02:00
commit 23b5afe1d8
4 changed files with 32 additions and 32 deletions

View file

@ -384,17 +384,17 @@ class Computer(Device):
"""
ethereum_address = Column(CIText(), unique=True, default=None)
deposit = Column(Integer, check_range('deposit',min=0,max=100), default=0)
owner_address = db.Column(CIText(),
db.ForeignKey(User.ethereum_address),
owner_id = db.Column(UUID(as_uuid=True),
db.ForeignKey(User.id),
nullable=False,
default=lambda: g.user.ethereum_address)
author = db.relationship(User, primaryjoin=owner_address == User.ethereum_address)
default=lambda: g.user.id)
author = db.relationship(User, primaryjoin=owner_id == User.id)
transfer_state = db.Column(IntEnum(TransferState), default=TransferState.Initial, nullable=False)
transfer_state.comment = TransferState.__doc__
receiver_address = db.Column(CIText(),
db.ForeignKey(User.ethereum_address),
receiver_id = db.Column(UUID(as_uuid=True),
db.ForeignKey(User.id),
nullable=True)
receiver = db.relationship(User, primaryjoin=receiver_address == User.ethereum_address)
receiver = db.relationship(User, primaryjoin=receiver_id == User.id)
deliverynote_address = db.Column(CIText(), nullable=True)
def __init__(self, chassis, **kwargs) -> None:

View file

@ -126,9 +126,9 @@ class Computer(Device):
deposit = Integer(validate=f.validate.Range(min=0, max=100),
description=m.Computer.deposit.__doc__)
# author_id = NestedOn(s_user.User,only_query='author_id')
owner_address = SanitizedStr(validate=f.validate.Length(max=42))
owner_id = UUID(data_key='ownerID')
transfer_state = EnumField(enums.TransferState, description=m.Computer.transfer_state.comment)
receiver_address = SanitizedStr(validate=f.validate.Length(max=42))
receiver_id = UUID(data_key='receiverID')
deliverynote_address = SanitizedStr(validate=f.validate.Length(max=42))

View file

@ -63,11 +63,11 @@ class Lot(Thing):
descendants.
"""
deposit = db.Column(db.Integer, check_range('deposit', min=0, max=100), default=0)
owner_address = db.Column(CIText(),
db.ForeignKey(User.ethereum_address),
owner_id = db.Column(UUID(as_uuid=True),
db.ForeignKey(User.id),
nullable=False,
default=lambda: g.user.ethereum_address)
owner = db.relationship(User, primaryjoin=owner_address == User.ethereum_address)
default=lambda: g.user.id)
owner = db.relationship(User, primaryjoin=owner_id == User.id)
transfer_state = db.Column(IntEnum(TransferState), default=TransferState.Initial, nullable=False)
transfer_state.comment = TransferState.__doc__
receiver_address = db.Column(CIText(),

View file

@ -22,7 +22,7 @@ class Lot(Thing):
deposit = f.Integer(validate=f.validate.Range(min=0, max=100),
description=m.Lot.deposit.__doc__)
# author_id = NestedOn(s_user.User,only_query='author_id')
owner_address = SanitizedStr(validate=f.validate.Length(max=42))
owner_id = f.UUID(data_key='ownerID')
transfer_state = EnumField(TransferState, description=m.Lot.transfer_state.comment)
receiver_address = SanitizedStr(validate=f.validate.Length(max=42))
deliverynote = NestedOn(s_deliverynote.Deliverynote, dump_only=True)