Set camelCase fields, correct fields in PATCH, fix typo in GET deliverynote

This commit is contained in:
yiorgos marinellis 2020-03-04 18:52:07 +01:00
parent de8af45065
commit 98bd4dd897
2 changed files with 4 additions and 5 deletions

View file

@ -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)

View file

@ -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)