39 lines
775 B
Python
39 lines
775 B
Python
#!/usr/bin/env python3
|
|
from flask_marshmallow.sqla import auto_field
|
|
|
|
from models import SampleMetadata
|
|
from marshm import ma
|
|
from marshmallow import fields
|
|
|
|
|
|
"""
|
|
Schemas of input objects
|
|
"""
|
|
|
|
|
|
__author__ = "@tormakris"
|
|
__copyright__ = "Copyright 2020, Birbnetes Team"
|
|
__module_name__ = "schemas"
|
|
__version__text__ = "1"
|
|
|
|
|
|
class SampleSchema(ma.Schema):
|
|
"""
|
|
Parameters:
|
|
- date (date)
|
|
- device_id (int)
|
|
"""
|
|
|
|
date = fields.DateTime(required=True)
|
|
device_id = fields.Integer(required=True)
|
|
|
|
|
|
class SampleMetadataSchema(ma.SQLAlchemyAutoSchema):
|
|
"""
|
|
Marshmallow schema generated
|
|
"""
|
|
class Meta:
|
|
model = SampleMetadata
|
|
exclude = ('timestamp', 'id', 'device_date')
|
|
date = auto_field("device_date", dump_only=False)
|