cleanup-orm
Some checks failed
deploy / deploy (push) Failing after 23s

This commit is contained in:
Untone 2023-10-16 18:28:43 +03:00
parent bc08ece4c3
commit 066bf72547
2 changed files with 0 additions and 27 deletions

View File

@ -1,6 +1,5 @@
from services.db import Base, engine
from orm.community import Community
from orm.notification import Notification
from orm.rbac import Operation, Resource, Permission, Role
from orm.reaction import Reaction
from orm.shout import Shout
@ -29,7 +28,6 @@ __all__ = [
"Shout",
"Topic",
"TopicFollower",
"Notification",
"Reaction",
"UserRating",
"init_tables"

View File

@ -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)