teljes backend_mentés

This commit is contained in:
Roo
2026-03-22 18:59:27 +00:00
parent 5d44339f21
commit 5d96b00f81
34 changed files with 2575 additions and 977 deletions

View File

@@ -25,9 +25,10 @@ class LevelConfig(Base):
__table_args__ = {"schema": "gamification", "extend_existing": True}
id: Mapped[int] = mapped_column(Integer, primary_key=True, index=True)
level_number: Mapped[int] = mapped_column(Integer, unique=True)
min_points: Mapped[int] = mapped_column(Integer)
level_number: Mapped[int] = mapped_column(Integer, unique=True) # Pozitív: normál szintek, Negatív: büntető szintek (-1, -2, -3)
min_points: Mapped[int] = mapped_column(Integer) # XP küszöb pozitív szinteknél, büntetőpont küszöb negatív szinteknél
rank_name: Mapped[str] = mapped_column(String)
is_penalty: Mapped[bool] = mapped_column(Boolean, default=False, index=True) # True ha büntető szint
class PointsLedger(Base):
__tablename__ = "points_ledger"
@@ -141,4 +142,24 @@ class Season(Base):
start_date: Mapped[date] = mapped_column(Date, nullable=False)
end_date: Mapped[date] = mapped_column(Date, nullable=False)
is_active: Mapped[bool] = mapped_column(Boolean, default=False)
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
class SeasonalCompetitions(Base):
""" Szezonális versenyek és kihívások tárolása. """
__tablename__ = "seasonal_competitions"
__table_args__ = {"schema": "gamification"}
id: Mapped[int] = mapped_column(Integer, primary_key=True, index=True)
name: Mapped[str] = mapped_column(String(200), nullable=False)
description: Mapped[Optional[str]] = mapped_column(Text)
season_id: Mapped[int] = mapped_column(Integer, ForeignKey("gamification.seasons.id"), nullable=False, index=True)
start_date: Mapped[date] = mapped_column(Date, nullable=False)
end_date: Mapped[date] = mapped_column(Date, nullable=False)
rules: Mapped[Optional[dict]] = mapped_column(JSONB, nullable=True) # JSON szabályok
status: Mapped[str] = mapped_column(String(20), default="draft", index=True) # draft, active, completed, cancelled
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
updated_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now(), onupdate=func.now())
# Relationships
season: Mapped["Season"] = relationship("Season")