cnc-service/src/schemas.py
Torma Kristóf 422a7efa6f
All checks were successful
continuous-integration/drone/push Build is passing
flask endpoints done
2020-07-20 18:19:31 +02:00

37 lines
717 B
Python

#!/usr/bin/env python3
import models
from marshm import ma
from marshmallow import fields
"""
Schemas of SQLAlchemy objects
"""
__author__ = "@tormakris"
__copyright__ = "Copyright 2020, Birbnetes Team"
__module_name__ = "schemas"
__version__text__ = "1"
class SensorSchema(ma.SQLAlchemyAutoSchema):
"""
Sensor schema autogenerated
"""
class Meta:
model = models.Sensor
include_fk = True
exclude = ('id',)
class DeviceSchema(ma.SQLAlchemyAutoSchema):
"""
Device schema autogenerated
"""
sensors = fields.Nested(SensorSchema, many=True)
class Meta:
model = models.Device
include_relationships = True
exclude = ('lastupdate',)