Set camelCase fields, correct fields in PATCH, fix typo in GET deliverynote
This commit is contained in:
parent
de8af45065
commit
98bd4dd897
|
@ -16,13 +16,14 @@ class Deliverynote(Thing):
|
||||||
required=True, data_key='documentID')
|
required=True, data_key='documentID')
|
||||||
creator = NestedOn(s_user.User, dump_only=True)
|
creator = NestedOn(s_user.User, dump_only=True)
|
||||||
supplier_email = SanitizedStr(validate=f.validate.Length(max=STR_SIZE),
|
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)
|
supplier = NestedOn(s_user.User, dump_only=True)
|
||||||
receiver = NestedOn(s_user.User, dump_only=True)
|
receiver = NestedOn(s_user.User, dump_only=True)
|
||||||
date = f.DateTime('iso', required=True)
|
date = f.DateTime('iso', required=True)
|
||||||
deposit = f.Integer(validate=f.validate.Range(min=0, max=100),
|
deposit = f.Integer(validate=f.validate.Range(min=0, max=100),
|
||||||
description=m.Deliverynote.deposit.__doc__)
|
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')
|
expected_devices = f.List(f.Integer(), required=True, data_key='expectedDevices')
|
||||||
transferred_devices = f.List(f.Integer(), required=False, data_key='transferredDevices')
|
transferred_devices = f.List(f.Integer(), required=False, data_key='transferredDevices')
|
||||||
transfer_state = EnumField(TransferState, description=m.Lot.transfer_state.comment)
|
transfer_state = EnumField(TransferState, description=m.Lot.transfer_state.comment)
|
||||||
|
|
|
@ -38,8 +38,6 @@ class DeliverynoteView(View):
|
||||||
|
|
||||||
def patch(self, id):
|
def patch(self, id):
|
||||||
patch_schema = self.resource_def.SCHEMA(only=('transfer_state',
|
patch_schema = self.resource_def.SCHEMA(only=('transfer_state',
|
||||||
'transferred_devices',
|
|
||||||
'supplier_email',
|
|
||||||
'ethereum_address'), partial=True)
|
'ethereum_address'), partial=True)
|
||||||
d = request.get_json(schema=patch_schema)
|
d = request.get_json(schema=patch_schema)
|
||||||
dlvnote = Deliverynote.query.filter_by(id=id).one()
|
dlvnote = Deliverynote.query.filter_by(id=id).one()
|
||||||
|
@ -51,4 +49,4 @@ class DeliverynoteView(View):
|
||||||
def one(self, id: uuid.UUID):
|
def one(self, id: uuid.UUID):
|
||||||
"""Get one delivery note"""
|
"""Get one delivery note"""
|
||||||
deliverynote = Deliverynote.query.filter_by(id=id).one() # type Deliverynote
|
deliverynote = Deliverynote.query.filter_by(id=id).one() # type Deliverynote
|
||||||
return self.schema.jsonify(Deliverynote)
|
return self.schema.jsonify(deliverynote)
|
||||||
|
|
Reference in a new issue