status update consumption done
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
35
src/schemas.py
Normal file
35
src/schemas.py
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/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',)
|
||||
Reference in New Issue
Block a user