Files
nuzlocke-tracker/backend/src/app/models/boss_battle.py

32 lines
1.3 KiB
Python
Raw Normal View History

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}')>"