Align ProofTransfer to Chapter 6 on specs, fixes #12
This commit is contained in:
parent
8a818bdc00
commit
e78d62602b
|
@ -85,13 +85,16 @@ class Proof(Thing):
|
|||
|
||||
|
||||
class ProofTransfer(JoinedTableMixin, Proof):
|
||||
transfer_id = Column(UUID(as_uuid=True), ForeignKey(Trade.id), nullable=False)
|
||||
transfer = relationship(DisposeProduct,
|
||||
backref=backref("proof_transfer",
|
||||
lazy=True,
|
||||
uselist=False,
|
||||
cascade=CASCADE_OWN),
|
||||
primaryjoin=DisposeProduct.id == transfer_id)
|
||||
supplier_id = db.Column(CIText(),
|
||||
db.ForeignKey(User.ethereum_address),
|
||||
nullable=False,
|
||||
default=lambda: g.user.ethereum_address)
|
||||
supplier = db.relationship(User, primaryjoin=lambda: ProofTransfer.supplier_id == User.ethereum_address)
|
||||
receiver_id = db.Column(CIText(),
|
||||
db.ForeignKey(User.ethereum_address),
|
||||
nullable=False)
|
||||
receiver = db.relationship(User, primaryjoin=lambda: ProofTransfer.receiver_id == User.ethereum_address)
|
||||
deposit = Column(db.Integer, default=0)
|
||||
|
||||
|
||||
class ProofDataWipe(JoinedTableMixin, Proof):
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from flask import current_app as app
|
||||
from marshmallow import Schema as MarshmallowSchema, ValidationError, validates_schema
|
||||
from marshmallow import Schema as MarshmallowSchema, ValidationError, fields as f, validates_schema
|
||||
from marshmallow.fields import Boolean, DateTime, Integer, Nested, String, UUID
|
||||
from marshmallow.validate import Length
|
||||
from sqlalchemy.util import OrderedSet
|
||||
|
@ -26,9 +26,11 @@ class Proof(Thing):
|
|||
|
||||
class ProofTransfer(Proof):
|
||||
__doc__ = m.ProofTransfer.__doc__
|
||||
transfer = NestedOn(s_action.DisposeProduct,
|
||||
required=True,
|
||||
only_query='id')
|
||||
deposit = Integer()
|
||||
supplier_id = SanitizedStr(validate=f.validate.Length(max=STR_SIZE),
|
||||
load_only=True, required=True, data_key='supplierID')
|
||||
receiver_id = SanitizedStr(validate=f.validate.Length(max=STR_SIZE),
|
||||
load_only=True, required=True, data_key='receiverID')
|
||||
|
||||
|
||||
class ProofDataWipe(Proof):
|
||||
|
|
Reference in New Issue