diff --git a/app/models.py b/app/models.py index 46d5ce2..c3fb466 100644 --- a/app/models.py +++ b/app/models.py @@ -54,3 +54,34 @@ class Role(db.Model, RoleMixin): def __repr__(self): return f'' + + +class Event(db.Model): + __tablename__ = 'events' + id = db.Column(db.Integer(), primary_key=True) + + #: The ID of the user who created the event + user_id = db.Column(db.Integer(), db.ForeignKey('users.id'), nullable=False) + + user = db.relationship('User', backref=db.backref('events', lazy='dynamic')) + + #: The title of the event + title = db.Column(db.Unicode(length=200), nullable=False) + + #: The time zone to be used for `start_time` and `end_time` + time_zone = db.Column(db.String(length=80), nullable=False) + + #: The starting timestamp of the event + start_time = db.Column(db.DateTime(), nullable=False) + + #: The ending timestamp of the event + end_time = db.Column(db.DateTime(), nullable=False) + + #: If `True`, the event is a whole-day event + all_day = db.Column(db.Boolean(), default=False) + + #: The description of the event + description = db.Column(db.UnicodeText()) + + def __repr__(self): + return f''