fmt2
This commit is contained in:
@@ -1,42 +1,41 @@
|
||||
import time
|
||||
from enum import Enum as Enumeration
|
||||
|
||||
from sqlalchemy import JSON as JSONType, func, cast
|
||||
from sqlalchemy import Column, Enum, ForeignKey, Integer, String
|
||||
from sqlalchemy import JSON, Column, ForeignKey, Integer, String
|
||||
from sqlalchemy.orm import relationship
|
||||
from sqlalchemy.orm.session import engine
|
||||
|
||||
from orm.author import Author
|
||||
from services.db import Base
|
||||
import time
|
||||
|
||||
|
||||
class NotificationEntity(Enumeration):
|
||||
REACTION = "reaction"
|
||||
SHOUT = "shout"
|
||||
FOLLOWER = "follower"
|
||||
REACTION = 'reaction'
|
||||
SHOUT = 'shout'
|
||||
FOLLOWER = 'follower'
|
||||
|
||||
|
||||
class NotificationAction(Enumeration):
|
||||
CREATE = "create"
|
||||
UPDATE = "update"
|
||||
DELETE = "delete"
|
||||
SEEN = "seen"
|
||||
FOLLOW = "follow"
|
||||
UNFOLLOW = "unfollow"
|
||||
CREATE = 'create'
|
||||
UPDATE = 'update'
|
||||
DELETE = 'delete'
|
||||
SEEN = 'seen'
|
||||
FOLLOW = 'follow'
|
||||
UNFOLLOW = 'unfollow'
|
||||
|
||||
|
||||
class NotificationSeen(Base):
|
||||
__tablename__ = "notification_seen"
|
||||
__tablename__ = 'notification_seen'
|
||||
|
||||
viewer = Column(ForeignKey("author.id"))
|
||||
notification = Column(ForeignKey("notification.id"))
|
||||
viewer = Column(ForeignKey('author.id'))
|
||||
notification = Column(ForeignKey('notification.id'))
|
||||
|
||||
|
||||
class Notification(Base):
|
||||
__tablename__ = "notification"
|
||||
__tablename__ = 'notification'
|
||||
|
||||
created_at = Column(Integer, server_default=str(int(time.time())))
|
||||
entity = Column(String, nullable=False)
|
||||
action = Column(String, nullable=False)
|
||||
payload = Column(JSONType, nullable=True)
|
||||
payload = Column(JSON, nullable=True)
|
||||
|
||||
seen = relationship(lambda: Author, secondary="notification_seen")
|
||||
seen = relationship(lambda: Author, secondary='notification_seen')
|
||||
|
Reference in New Issue
Block a user