Add boss battles, level caps, and badge tracking
Introduces full boss battle system: data models (BossBattle, BossPokemon, BossResult), API endpoints for CRUD and per-run defeat tracking, and frontend UI including a sticky level cap bar with badge display on the run page, interleaved boss battle cards in the encounter list, and an admin panel section for managing boss battles and their pokemon teams. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
31
backend/src/app/models/boss_battle.py
Normal file
31
backend/src/app/models/boss_battle.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from sqlalchemy import ForeignKey, SmallInteger, String
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from app.core.database import Base
|
||||
|
||||
|
||||
class BossBattle(Base):
|
||||
__tablename__ = "boss_battles"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
game_id: Mapped[int] = mapped_column(ForeignKey("games.id"), index=True)
|
||||
name: Mapped[str] = mapped_column(String(100))
|
||||
boss_type: Mapped[str] = mapped_column(String(20)) # gym_leader, elite_four, champion, rival, evil_team, other
|
||||
badge_name: Mapped[str | None] = mapped_column(String(100))
|
||||
badge_image_url: Mapped[str | None] = mapped_column(String(500))
|
||||
level_cap: Mapped[int] = mapped_column(SmallInteger)
|
||||
order: Mapped[int] = mapped_column(SmallInteger)
|
||||
after_route_id: Mapped[int | None] = mapped_column(
|
||||
ForeignKey("routes.id"), index=True, default=None
|
||||
)
|
||||
location: Mapped[str] = mapped_column(String(200))
|
||||
sprite_url: Mapped[str | None] = mapped_column(String(500))
|
||||
|
||||
game: Mapped["Game"] = relationship(back_populates="boss_battles")
|
||||
after_route: Mapped["Route | None"] = relationship()
|
||||
pokemon: Mapped[list["BossPokemon"]] = relationship(
|
||||
back_populates="boss_battle", cascade="all, delete-orphan"
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"<BossBattle(id={self.id}, name='{self.name}', type='{self.boss_type}')>"
|
||||
Reference in New Issue
Block a user