This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
devicehub-teal/ereuse_devicehub/resources/documents/schemas.py

27 lines
1.2 KiB
Python
Raw Normal View History

2021-07-21 06:35:18 +00:00
from marshmallow.fields import DateTime, Integer, validate
from teal.marshmallow import SanitizedStr, URL
from ereuse_devicehub.resources.schemas import Thing
from ereuse_devicehub.resources.documents import models as m
# from marshmallow import ValidationError, validates_schema
2021-07-26 09:33:11 +00:00
class Document(Thing):
__doc__ = m.Document.__doc__
id = Integer(description=m.Document.id.comment, dump_only=True)
type = SanitizedStr(default='Document')
2021-07-21 06:35:18 +00:00
date = DateTime(data_key='endTime',
required=False,
2021-07-26 09:33:11 +00:00
description=m.Document.date.comment)
2021-07-21 06:35:18 +00:00
id_document = SanitizedStr(data_key='documentId',
default='',
2021-07-26 09:33:11 +00:00
description=m.Document.id_document.comment)
2021-07-21 06:35:18 +00:00
file_name = SanitizedStr(data_key='filename',
default='',
2021-07-26 09:33:11 +00:00
description=m.Document.file_name.comment,
2021-07-21 06:35:18 +00:00
validate=validate.Length(max=100))
file_hash = SanitizedStr(data_key='hash',
default='',
2021-07-26 09:33:11 +00:00
description=m.Document.file_hash.comment,
2021-07-21 06:35:18 +00:00
validate=validate.Length(max=64))
2021-07-26 09:33:11 +00:00
url = URL(description=m.Document.url.comment)