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):
|
||||
__tablename__ = "notification"
|
||||
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)
|
||||
data: Any = db.Column(db.PickleType(protocol=4))
|
||||
time: datetime = db.Column(UtcDateTime, nullable=False, default=UtcDateTime.current_utc)
|
||||
|
|
|
@ -102,9 +102,10 @@ class Plugin:
|
|||
db.session.commit()
|
||||
|
||||
def notify(self, user, text: str, data=None):
|
||||
n = Notification(text=text, data=data, plugin=self.id, user_=user)
|
||||
db.session.add(n)
|
||||
db.session.commit()
|
||||
if not user.deleted:
|
||||
n = Notification(text=text, data=data, plugin=self.id, user_=user)
|
||||
db.session.add(n)
|
||||
db.session.commit()
|
||||
|
||||
def serialize(self):
|
||||
"""Serialize a plugin into a dict
|
||||
|
|
Loading…
Reference in New Issue