notifier-integration
Some checks failed
Deploy on push / deploy (push) Failing after 19s

This commit is contained in:
2024-03-04 10:35:33 +03:00
parent ad0dc98bc9
commit 3016a75332
8 changed files with 386 additions and 0 deletions

41
orm/notification.py Normal file
View File

@@ -0,0 +1,41 @@
import time
from enum import Enum as Enumeration
from sqlalchemy import JSON, Column, ForeignKey, Integer, String
from sqlalchemy.orm import relationship
from orm.author import Author
from services.db import Base
class NotificationEntity(Enumeration):
REACTION = 'reaction'
SHOUT = 'shout'
FOLLOWER = 'follower'
class NotificationAction(Enumeration):
CREATE = 'create'
UPDATE = 'update'
DELETE = 'delete'
SEEN = 'seen'
FOLLOW = 'follow'
UNFOLLOW = 'unfollow'
class NotificationSeen(Base):
__tablename__ = 'notification_seen'
viewer = Column(ForeignKey('author.id'))
notification = Column(ForeignKey('notification.id'))
class Notification(Base):
__tablename__ = 'notification'
created_at = Column(Integer, server_default=str(int(time.time())))
entity = Column(String, nullable=False)
action = Column(String, nullable=False)
payload = Column(JSON, nullable=True)
seen = relationship(lambda: Author, secondary='notification_seen')