2021-08-19 10:02:28 +00:00
|
|
|
from sqlalchemy import Column, Integer, String, ForeignKey, JSON as JSONType
|
|
|
|
from orm.base import Base
|
|
|
|
|
|
|
|
class Notification(Base):
|
|
|
|
__tablename__ = 'notification'
|
|
|
|
|
2021-08-19 15:33:39 +00:00
|
|
|
kind: str = Column(String, unique = True, primary_key = True)
|
2021-08-19 10:02:28 +00:00
|
|
|
template: str = Column(String, nullable = False)
|
|
|
|
variables: JSONType = Column(JSONType, nullable = True) # [ <var1>, .. ]
|
|
|
|
|
|
|
|
class UserNotification(Base):
|
|
|
|
__tablename__ = 'user_notification'
|
|
|
|
|
|
|
|
id: int = Column(Integer, primary_key = True)
|
2021-08-19 15:33:39 +00:00
|
|
|
user_id: int = Column(Integer, ForeignKey("user.id"))
|
|
|
|
kind: str = Column(String, ForeignKey("notification.kind"))
|
2021-08-19 10:02:28 +00:00
|
|
|
values: JSONType = Column(JSONType, nullable = True) # [ <var1>, .. ]
|