From 2175cd5efa1ac377fac6058aac33043ebfefb127 Mon Sep 17 00:00:00 2001 From: emmdim Date: Thu, 19 Dec 2019 12:27:02 +0100 Subject: [PATCH] Makes deposit writable and applies range check from 0-100 --- ereuse_devicehub/resources/device/schemas.py | 3 +-- ereuse_devicehub/resources/lot/schemas.py | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/ereuse_devicehub/resources/device/schemas.py b/ereuse_devicehub/resources/device/schemas.py index d2381216..f7d7fcb7 100644 --- a/ereuse_devicehub/resources/device/schemas.py +++ b/ereuse_devicehub/resources/device/schemas.py @@ -122,8 +122,7 @@ class Computer(Device): dump_only=True, collection_class=set, description=m.Computer.privacy.__doc__) - deposit = Integer(dump_only=True, - data_key='deposit', + deposit = Integer(validate=f.validate.Range(min=0, max=100), description=m.Computer.deposit.__doc__) # author_id = NestedOn(s_user.User,only_query='author_id') owner_address = SanitizedStr(validate=f.validate.Length(max=42)) diff --git a/ereuse_devicehub/resources/lot/schemas.py b/ereuse_devicehub/resources/lot/schemas.py index 861ef6a5..1cb10b24 100644 --- a/ereuse_devicehub/resources/lot/schemas.py +++ b/ereuse_devicehub/resources/lot/schemas.py @@ -18,8 +18,7 @@ class Lot(Thing): children = NestedOn('Lot', many=True, dump_only=True) parents = NestedOn('Lot', many=True, dump_only=True) url = URL(dump_only=True, description=m.Lot.url.__doc__) - deposit = f.Integer(dump_only=True, - data_key='deposit', + deposit = f.Integer(validate=f.validate.Range(min=0, max=100), description=m.Lot.deposit.__doc__) # author_id = NestedOn(s_user.User,only_query='author_id') owner_address = SanitizedStr(validate=f.validate.Length(max=42))