Add challenges promotion
This commit is contained in:
@@ -29,6 +29,12 @@ class ProofType(str, Enum):
|
||||
STEAM = "steam"
|
||||
|
||||
|
||||
class ChallengeStatus(str, Enum):
|
||||
PENDING = "pending"
|
||||
APPROVED = "approved"
|
||||
REJECTED = "rejected"
|
||||
|
||||
|
||||
class Challenge(Base):
|
||||
__tablename__ = "challenges"
|
||||
|
||||
@@ -45,8 +51,13 @@ class Challenge(Base):
|
||||
is_generated: Mapped[bool] = mapped_column(Boolean, default=True)
|
||||
created_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow)
|
||||
|
||||
# Proposed challenges support
|
||||
proposed_by_id: Mapped[int | None] = mapped_column(ForeignKey("users.id"), nullable=True)
|
||||
status: Mapped[str] = mapped_column(String(20), default="approved") # pending, approved, rejected
|
||||
|
||||
# Relationships
|
||||
game: Mapped["Game"] = relationship("Game", back_populates="challenges")
|
||||
proposed_by: Mapped["User"] = relationship("User", foreign_keys=[proposed_by_id])
|
||||
assignments: Mapped[list["Assignment"]] = relationship(
|
||||
"Assignment",
|
||||
back_populates="challenge"
|
||||
|
||||
Reference in New Issue
Block a user