This commit is contained in:
parent
bc08ece4c3
commit
066bf72547
|
@ -1,6 +1,5 @@
|
||||||
from services.db import Base, engine
|
from services.db import Base, engine
|
||||||
from orm.community import Community
|
from orm.community import Community
|
||||||
from orm.notification import Notification
|
|
||||||
from orm.rbac import Operation, Resource, Permission, Role
|
from orm.rbac import Operation, Resource, Permission, Role
|
||||||
from orm.reaction import Reaction
|
from orm.reaction import Reaction
|
||||||
from orm.shout import Shout
|
from orm.shout import Shout
|
||||||
|
@ -29,7 +28,6 @@ __all__ = [
|
||||||
"Shout",
|
"Shout",
|
||||||
"Topic",
|
"Topic",
|
||||||
"TopicFollower",
|
"TopicFollower",
|
||||||
"Notification",
|
|
||||||
"Reaction",
|
"Reaction",
|
||||||
"UserRating",
|
"UserRating",
|
||||||
"init_tables"
|
"init_tables"
|
||||||
|
|
|
@ -1,25 +0,0 @@
|
||||||
from datetime import datetime
|
|
||||||
from sqlalchemy import Column, Enum, ForeignKey, DateTime, Boolean, Integer
|
|
||||||
from sqlalchemy.dialects.postgresql import JSONB
|
|
||||||
|
|
||||||
from services.db import Base
|
|
||||||
from enum import Enum as Enumeration
|
|
||||||
|
|
||||||
|
|
||||||
class NotificationType(Enumeration):
|
|
||||||
NEW_REACTION = 1
|
|
||||||
NEW_SHOUT = 2
|
|
||||||
NEW_FOLLOWER = 3
|
|
||||||
|
|
||||||
|
|
||||||
class Notification(Base):
|
|
||||||
__tablename__ = "notification"
|
|
||||||
|
|
||||||
shout = Column(ForeignKey("shout.id"), index=True)
|
|
||||||
reaction = Column(ForeignKey("reaction.id"), index=True)
|
|
||||||
user = Column(ForeignKey("user.id"), index=True)
|
|
||||||
createdAt = Column(DateTime, nullable=False, default=datetime.now, index=True)
|
|
||||||
seen = Column(Boolean, nullable=False, default=False, index=True)
|
|
||||||
type = Column(Enum(NotificationType), nullable=False)
|
|
||||||
data = Column(JSONB, nullable=True)
|
|
||||||
occurrences = Column(Integer, default=1)
|
|
Loading…
Reference in New Issue
Block a user