From 98bd4dd897608aec3d8273cad03f422af6559529 Mon Sep 17 00:00:00 2001 From: yiorgos marinellis Date: Wed, 4 Mar 2020 18:52:07 +0100 Subject: [PATCH] Set camelCase fields, correct fields in PATCH, fix typo in GET deliverynote --- ereuse_devicehub/resources/deliverynote/schemas.py | 5 +++-- ereuse_devicehub/resources/deliverynote/views.py | 4 +--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ereuse_devicehub/resources/deliverynote/schemas.py b/ereuse_devicehub/resources/deliverynote/schemas.py index f6b5f312..3e649b4e 100644 --- a/ereuse_devicehub/resources/deliverynote/schemas.py +++ b/ereuse_devicehub/resources/deliverynote/schemas.py @@ -16,13 +16,14 @@ class Deliverynote(Thing): required=True, data_key='documentID') creator = NestedOn(s_user.User, dump_only=True) supplier_email = SanitizedStr(validate=f.validate.Length(max=STR_SIZE), - load_only=True, required=True) + load_only=True, required=True, data_key='supplierEmail') supplier = NestedOn(s_user.User, dump_only=True) receiver = NestedOn(s_user.User, dump_only=True) date = f.DateTime('iso', required=True) deposit = f.Integer(validate=f.validate.Range(min=0, max=100), description=m.Deliverynote.deposit.__doc__) - ethereum_address = f.String(description='User identifier address inside the Blockchain') + ethereum_address = f.String(description='User identifier address inside the Blockchain', + data_key='ethereumAddress') expected_devices = f.List(f.Integer(), required=True, data_key='expectedDevices') transferred_devices = f.List(f.Integer(), required=False, data_key='transferredDevices') transfer_state = EnumField(TransferState, description=m.Lot.transfer_state.comment) diff --git a/ereuse_devicehub/resources/deliverynote/views.py b/ereuse_devicehub/resources/deliverynote/views.py index ae3e56d3..0b0cb35a 100644 --- a/ereuse_devicehub/resources/deliverynote/views.py +++ b/ereuse_devicehub/resources/deliverynote/views.py @@ -38,8 +38,6 @@ class DeliverynoteView(View): def patch(self, id): patch_schema = self.resource_def.SCHEMA(only=('transfer_state', - 'transferred_devices', - 'supplier_email', 'ethereum_address'), partial=True) d = request.get_json(schema=patch_schema) dlvnote = Deliverynote.query.filter_by(id=id).one() @@ -51,4 +49,4 @@ class DeliverynoteView(View): def one(self, id: uuid.UUID): """Get one delivery note""" deliverynote = Deliverynote.query.filter_by(id=id).one() # type Deliverynote - return self.schema.jsonify(Deliverynote) + return self.schema.jsonify(deliverynote)