2020-03-31 17:32:04 +02:00
|
|
|
#!/usr/bin/env python3
|
2020-10-03 12:47:44 +02:00
|
|
|
from flask_marshmallow.sqla import auto_field
|
|
|
|
|
2020-04-29 22:24:32 +02:00
|
|
|
from models import SampleMetadata
|
|
|
|
from marshm import ma
|
|
|
|
from marshmallow import fields
|
2020-03-31 17:32:04 +02:00
|
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
Schemas of input objects
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
__author__ = "@tormakris"
|
|
|
|
__copyright__ = "Copyright 2020, Birbnetes Team"
|
|
|
|
__module_name__ = "schemas"
|
|
|
|
__version__text__ = "1"
|
|
|
|
|
|
|
|
|
2020-04-29 22:24:32 +02:00
|
|
|
class SampleSchema(ma.Schema):
|
2020-04-27 12:42:46 +02:00
|
|
|
"""
|
2020-03-31 17:32:04 +02:00
|
|
|
Parameters:
|
|
|
|
- date (date)
|
2020-10-19 22:34:41 +02:00
|
|
|
- device_id (int)
|
2020-03-31 17:32:04 +02:00
|
|
|
"""
|
|
|
|
|
2020-04-29 22:24:32 +02:00
|
|
|
date = fields.DateTime(required=True)
|
2020-10-19 22:34:41 +02:00
|
|
|
device_id = fields.Integer(required=True)
|
2020-04-29 22:24:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
class SampleMetadataSchema(ma.SQLAlchemyAutoSchema):
|
|
|
|
"""
|
|
|
|
Marshmallow schema generated
|
|
|
|
"""
|
|
|
|
class Meta:
|
|
|
|
model = SampleMetadata
|
2021-07-26 12:32:36 +02:00
|
|
|
exclude = ('timestamp', 'id', 'device_date')
|
2020-10-03 12:47:44 +02:00
|
|
|
date = auto_field("device_date", dump_only=False)
|