2020-02-26 19:21:59 +00:00
|
|
|
from marshmallow import fields as f
|
|
|
|
from teal.marshmallow import SanitizedStr, URL, EnumField
|
|
|
|
|
|
|
|
from ereuse_devicehub.marshmallow import NestedOn
|
|
|
|
from ereuse_devicehub.resources.deliverynote import models as m
|
2020-02-27 17:29:26 +00:00
|
|
|
from ereuse_devicehub.resources.user import schemas as s_user
|
2020-02-26 19:21:59 +00:00
|
|
|
from ereuse_devicehub.resources.models import STR_SIZE
|
|
|
|
from ereuse_devicehub.resources.schemas import Thing
|
2020-02-29 21:58:49 +00:00
|
|
|
from ereuse_devicehub.resources.enums import TransferState
|
2020-02-26 19:21:59 +00:00
|
|
|
|
|
|
|
|
2020-02-27 17:29:26 +00:00
|
|
|
class Deliverynote(Thing):
|
2020-02-26 19:21:59 +00:00
|
|
|
id = f.UUID(dump_only=True)
|
2020-02-29 21:58:49 +00:00
|
|
|
document_id = SanitizedStr(validate=f.validate.Length(max=STR_SIZE), required=True)
|
2020-02-27 17:29:26 +00:00
|
|
|
url = URL(dump_only=True, description=m.Deliverynote.url.__doc__)
|
|
|
|
creator = NestedOn(s_user.User,only_query='id')
|
2020-02-29 21:58:49 +00:00
|
|
|
supplier_email = SanitizedStr(validate=f.validate.Length(max=STR_SIZE), required=True)
|
2020-02-27 17:29:26 +00:00
|
|
|
supplier = NestedOn(s_user.User,only_query='id')
|
|
|
|
# deposit = f.Integer(validate=f.validate.Range(min=0, max=100),
|
|
|
|
# description=m.Lot.deposit.__doc__)
|
|
|
|
deposit = SanitizedStr(validate=f.validate.Length(max=STR_SIZE), required=True)
|
|
|
|
expected_devices = SanitizedStr(validate=f.validate.Length(max=STR_SIZE), required=True)
|
|
|
|
transferred_devices = SanitizedStr(validate=f.validate.Length(max=STR_SIZE), required=True)
|
|
|
|
transfer_state = EnumField(TransferState, description=m.Lot.transfer_state.comment)
|