class Alert(db.Model): id = db.Column(db.Integer, primary_key=True) event_type = db.Column(db.String(200)) event_start = db.Column(db.DateTime, default=datetime.utcnow()) location = db.Column(db.String(200)) alert_msg = db.Column(db.String(400)) @property def serialize(self): return { 'event_type': self.event_type, 'event_start': dump_datetime(self.event_start), 'location': self.location, 'alert_msg': self.alert_msg }
class Address(db.Model): id = db.Column(db.Integer, primary_key=True) town = db.Column(db.String(100)) street = db.Column(db.String(200)) flat_number = db.Column(db.Integer) longitude = db.Column(db.REAL) latitude = db.Column(db.REAL) user_id = db.Column(db.Integer, db.ForeignKey(User.id))
class Event(db.Model): id = db.Column(db.Integer, primary_key=True) event_start = db.Column(db.DateTime) event_duration = db.Column(db.Integer) flow = db.Column(db.Float) price = db.Column(db.Float) event_type = db.Column(db.String(100))
class GroupUsers(db.Model): id = db.Column(db.Integer, primary_key=True) user_id = db.Column(db.Integer, db.ForeignKey(User.id)), group_id = db.Column(db.Integer, db.ForeignKey(Group.id))
class Group(db.Model): id = db.Column(db.Integer, primary_key=True) group_name = db.Column(db.String(100)) group_description = db.Column(db.String(200))