user model upgrade, rating, notificaiton

This commit is contained in:
2021-08-19 13:02:28 +03:00
parent 5bb4553360
commit 0cb0b85bce
6 changed files with 82 additions and 17 deletions

17
orm/notification.py Normal file
View File

@@ -0,0 +1,17 @@
from sqlalchemy import Column, Integer, String, ForeignKey, JSON as JSONType
from orm.base import Base
class Notification(Base):
__tablename__ = 'notification'
kind: str = Column(String, primary_key = True)
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)
user: int = Column(ForeignKey("user.id"))
kind: int = Column(ForeignKey("notification.kind"), nullable = False)
values: JSONType = Column(JSONType, nullable = True) # [ <var1>, .. ]