WIP checkpoint: T1: Moderation data model + Alembic migration
This commit is contained in:
@@ -22,13 +22,6 @@ from app.database import Base
|
||||
class Appeal(Base):
|
||||
__tablename__ = "appeals"
|
||||
|
||||
# Status values
|
||||
APPEAL_STATUS = Enum(
|
||||
"pending", "approved", "rejected",
|
||||
name="appeal_status",
|
||||
create_type=False,
|
||||
)
|
||||
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
moderation_action_id = Column(
|
||||
Integer,
|
||||
@@ -42,9 +35,9 @@ class Appeal(Base):
|
||||
)
|
||||
reason = Column(Text, nullable=False)
|
||||
status = Column(
|
||||
APPEAL_STATUS,
|
||||
Enum("pending", "approved", "rejected", name="appeal_status", create_type=False),
|
||||
nullable=False,
|
||||
default=APPEAL_STATUS.PENDING,
|
||||
default="pending",
|
||||
)
|
||||
reviewed_by = Column(
|
||||
Integer,
|
||||
@@ -63,7 +56,7 @@ class Appeal(Base):
|
||||
reviewer = relationship(
|
||||
"User",
|
||||
foreign_keys=[reviewed_by],
|
||||
backref="reviewed_appeals",
|
||||
back_populates="reviewed_appeals",
|
||||
)
|
||||
|
||||
__table_args__ = (
|
||||
|
||||
@@ -111,3 +111,8 @@ class ModerationAction(Base):
|
||||
back_populates="moderation_actions_received",
|
||||
)
|
||||
report = relationship("Report", back_populates="moderation_actions")
|
||||
appeals = relationship(
|
||||
"Appeal",
|
||||
back_populates="moderation_action",
|
||||
cascade="all, delete-orphan",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user