Files
nuzlocke-tracker/backend/src/app/models/boss_pokemon.py
Julian Tabel a6bf8b4af2 Add conditional boss battle teams (variant teams by condition)
Wire up the existing condition_label column on boss_pokemon to support
variant teams throughout the UI. Boss battles can now have multiple team
configurations based on conditions (e.g., starter choice in Gen 1).

- Add condition_label to BossPokemonInput schema (frontend + backend bulk import)
- Rewrite BossTeamEditor with variant tabs (Default + named conditions)
- Add variant pill selector to BossDefeatModal team preview
- Add BossTeamPreview component to RunEncounters boss cards
- Fix MissingGreenlet error in set_boss_team via session.expunge_all()
- Fix PokemonSelector state bleed between tabs via composite React key
- Add Alembic migration for condition_label column

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 21:20:30 +01:00

24 lines
928 B
Python

from sqlalchemy import ForeignKey, SmallInteger, String
from sqlalchemy.orm import Mapped, mapped_column, relationship
from app.core.database import Base
class BossPokemon(Base):
__tablename__ = "boss_pokemon"
id: Mapped[int] = mapped_column(primary_key=True)
boss_battle_id: Mapped[int] = mapped_column(
ForeignKey("boss_battles.id", ondelete="CASCADE"), index=True
)
pokemon_id: Mapped[int] = mapped_column(ForeignKey("pokemon.id"), index=True)
level: Mapped[int] = mapped_column(SmallInteger)
order: Mapped[int] = mapped_column(SmallInteger)
condition_label: Mapped[str | None] = mapped_column(String(100))
boss_battle: Mapped["BossBattle"] = relationship(back_populates="pokemon")
pokemon: Mapped["Pokemon"] = relationship()
def __repr__(self) -> str:
return f"<BossPokemon(id={self.id}, boss_battle_id={self.boss_battle_id}, pokemon_id={self.pokemon_id})>"