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):
|
class ProofTransfer(JoinedTableMixin, Proof):
|
||||||
transfer_id = Column(UUID(as_uuid=True), ForeignKey(Trade.id), nullable=False)
|
supplier_id = db.Column(CIText(),
|
||||||
transfer = relationship(DisposeProduct,
|
db.ForeignKey(User.ethereum_address),
|
||||||
backref=backref("proof_transfer",
|
nullable=False,
|
||||||
lazy=True,
|
default=lambda: g.user.ethereum_address)
|
||||||
uselist=False,
|
supplier = db.relationship(User, primaryjoin=lambda: ProofTransfer.supplier_id == User.ethereum_address)
|
||||||
cascade=CASCADE_OWN),
|
receiver_id = db.Column(CIText(),
|
||||||
primaryjoin=DisposeProduct.id == transfer_id)
|
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):
|
class ProofDataWipe(JoinedTableMixin, Proof):
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from flask import current_app as app
|
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.fields import Boolean, DateTime, Integer, Nested, String, UUID
|
||||||
from marshmallow.validate import Length
|
from marshmallow.validate import Length
|
||||||
from sqlalchemy.util import OrderedSet
|
from sqlalchemy.util import OrderedSet
|
||||||
|
@ -26,9 +26,11 @@ class Proof(Thing):
|
||||||
|
|
||||||
class ProofTransfer(Proof):
|
class ProofTransfer(Proof):
|
||||||
__doc__ = m.ProofTransfer.__doc__
|
__doc__ = m.ProofTransfer.__doc__
|
||||||
transfer = NestedOn(s_action.DisposeProduct,
|
deposit = Integer()
|
||||||
required=True,
|
supplier_id = SanitizedStr(validate=f.validate.Length(max=STR_SIZE),
|
||||||
only_query='id')
|
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):
|
class ProofDataWipe(Proof):
|
||||||
|
|
Reference in New Issue