#!/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 class DeviceSchema(ma.SQLAlchemyAutoSchema): """ Device schema autogenerated """ sensors = fields.Nested(SensorSchema, many=True) class Meta: model = models.Device include_relationships = True exclude = ('lastupdate',)