mirror of
https://github.com/simple-login/app.git
synced 2025-02-23 23:34:05 +08:00
Add Notification model
This commit is contained in:
parent
dfb427e6da
commit
a2e7de0bab
2 changed files with 13 additions and 0 deletions
|
@ -1417,3 +1417,11 @@ class RecoveryCode(db.Model, ModelMixin):
|
|||
"""Delete all recovery codes for user"""
|
||||
cls.query.filter_by(user_id=user.id).delete()
|
||||
db.session.commit()
|
||||
|
||||
|
||||
class Notification(db.Model, ModelMixin):
|
||||
user_id = db.Column(db.ForeignKey(User.id, ondelete="cascade"), nullable=False)
|
||||
message = db.Column(db.Text, nullable=False)
|
||||
|
||||
# whether user has marked the notification as read
|
||||
read = db.Column(db.Boolean, nullable=False, default=False)
|
||||
|
|
|
@ -53,6 +53,7 @@ from app.models import (
|
|||
EmailLog,
|
||||
Referral,
|
||||
AliasMailbox,
|
||||
Notification,
|
||||
)
|
||||
from app.monitor.base import monitor_bp
|
||||
from app.oauth.base import oauth_bp
|
||||
|
@ -247,6 +248,10 @@ def fake_data():
|
|||
referral = Referral.create(user_id=user.id, code="REFCODE", name="First referral")
|
||||
db.session.commit()
|
||||
|
||||
for i in range(6):
|
||||
Notification.create(user_id=user.id, message=f"""Hey hey <b>{i}</b> """ * 10)
|
||||
db.session.commit()
|
||||
|
||||
User.create(
|
||||
email="winston@continental.com",
|
||||
name="Winston",
|
||||
|
|
Loading…
Reference in a new issue