From 621e172e5581b4964c2712213b4fed7195de90ab Mon Sep 17 00:00:00 2001 From: Big Lebowski Date: Tue, 17 Mar 2020 00:57:14 +0100 Subject: [PATCH] Add required field result and ethereumHash on POST --- ereuse_devicehub/resources/proof/models.py | 2 +- ereuse_devicehub/resources/proof/schemas.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ereuse_devicehub/resources/proof/models.py b/ereuse_devicehub/resources/proof/models.py index 60e18ae3..3fe4ab7b 100644 --- a/ereuse_devicehub/resources/proof/models.py +++ b/ereuse_devicehub/resources/proof/models.py @@ -42,7 +42,7 @@ class Proof(Thing): """ id = Column(UUID(as_uuid=True), primary_key=True, default=uuid4) type = Column(Unicode, nullable=False) - ethereum_hashes = Column(CIText(), default='', nullable=False) + ethereum_hash = Column(CIText(), default='', nullable=False) @property def url(self) -> urlutils.URL: diff --git a/ereuse_devicehub/resources/proof/schemas.py b/ereuse_devicehub/resources/proof/schemas.py index 4859150a..aa7cba1c 100644 --- a/ereuse_devicehub/resources/proof/schemas.py +++ b/ereuse_devicehub/resources/proof/schemas.py @@ -16,8 +16,8 @@ from ereuse_devicehub.resources.action import schemas as s_action class Proof(Thing): __doc__ = m.Proof.__doc__ id = UUID(dump_only=True) - ethereum_hashes = SanitizedStr(default='', validate=Length(max=STR_BIG_SIZE), - data_key="ethereumHashes") + ethereum_hash = SanitizedStr(default='', validate=Length(max=STR_BIG_SIZE), + data_key="ethereumHash", required=True) url = URL(dump_only=True, description=m.Proof.url.__doc__) @@ -30,10 +30,10 @@ class ProofTransfer(Proof): class ProofDataWipe(Proof): __doc__ = m.ProofDataWipe.__doc__ - erasure_type = SanitizedStr(default='') + erasure_type = SanitizedStr(default='', data_key='erasureType') date = DateTime('iso', required=True) - result = Boolean(missing=False) - erasure = NestedOn(s_action.EraseBasic, only_query='id') + result = Boolean(required=True) + erasure = NestedOn(s_action.EraseBasic, only_query='id', data_key='erasureID') class ProofFunction(Proof):