core/orm/reaction.py
Untone 9c374d789e
Some checks failed
Deploy on push / deploy (push) Failing after 11s
string_agg
2024-08-07 17:45:22 +03:00

46 lines
1.4 KiB
Python

import time
from enum import Enum as Enumeration
from sqlalchemy import Column, ForeignKey, Integer, String
from services.db import Base
class ReactionKind(Enumeration):
# TYPE = <reaction index> # rating diff
# editor mode
AGREE = "AGREE" # +1
DISAGREE = "DISAGREE" # -1
ASK = "ASK" # +0
PROPOSE = "PROPOSE" # +0
ACCEPT = "ACCEPT" # +1
REJECT = "REJECT" # -1
# expert mode
PROOF = "PROOF" # +1
DISPROOF = "DISPROOF" # -1
# public feed
QUOTE = "QUOTE" # +0 TODO: use to bookmark in collection
COMMENT = "COMMENT" # +0
LIKE = "LIKE" # +1
DISLIKE = "DISLIKE" # -1
class Reaction(Base):
__tablename__ = "reaction"
body = Column(String, default="", comment="Reaction Body")
created_at = Column(Integer, nullable=False, default=lambda: int(time.time()), index=True)
updated_at = Column(Integer, nullable=True, comment="Updated at", index=True)
deleted_at = Column(Integer, nullable=True, comment="Deleted at", index=True)
deleted_by = Column(ForeignKey("author.id"), nullable=True)
reply_to = Column(ForeignKey("reaction.id"), nullable=True)
quote = Column(String, nullable=True, comment="Original quoted text")
shout = Column(ForeignKey("shout.id"), nullable=False, index=True)
created_by = Column(ForeignKey("author.id"), nullable=False)
kind = Column(String, nullable=False, index=True)
oid = Column(String)