Compare commits
2 Commits
5b3f63cd0a
...
239faac7dd
Author | SHA1 | Date |
---|---|---|
Ferdinand Thiessen | 239faac7dd | |
Ferdinand Thiessen | 5819a0637f |
|
@ -10,7 +10,7 @@ from .user import User
|
||||||
class Notification(db.Model, ModelSerializeMixin):
|
class Notification(db.Model, ModelSerializeMixin):
|
||||||
__tablename__ = "notification"
|
__tablename__ = "notification"
|
||||||
id: int = db.Column("id", Serial, primary_key=True)
|
id: int = db.Column("id", Serial, primary_key=True)
|
||||||
plugin: str = db.Column(db.String(30), nullable=False)
|
plugin: str = db.Column(db.String(127), nullable=False)
|
||||||
text: str = db.Column(db.Text)
|
text: str = db.Column(db.Text)
|
||||||
data: Any = db.Column(db.PickleType(protocol=4))
|
data: Any = db.Column(db.PickleType(protocol=4))
|
||||||
time: datetime = db.Column(UtcDateTime, nullable=False, default=UtcDateTime.current_utc)
|
time: datetime = db.Column(UtcDateTime, nullable=False, default=UtcDateTime.current_utc)
|
||||||
|
|
|
@ -102,6 +102,7 @@ class Plugin:
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
def notify(self, user, text: str, data=None):
|
def notify(self, user, text: str, data=None):
|
||||||
|
if not user.deleted:
|
||||||
n = Notification(text=text, data=data, plugin=self.id, user_=user)
|
n = Notification(text=text, data=data, plugin=self.id, user_=user)
|
||||||
db.session.add(n)
|
db.session.add(n)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
Loading…
Reference in New Issue