Add pokemon evolution support across the full stack
- Evolution model with trigger, level, item, and condition fields
- Encounter.current_pokemon_id tracks evolved species separately
- Alembic migration for evolutions table and current_pokemon_id column
- Seed pipeline loads evolution data with manual overrides
- GET /pokemon/{id}/evolutions and PATCH /encounters/{id} endpoints
- Evolve button in StatusChangeModal with evolution method details
- PokemonCard shows evolved species with "Originally" label
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -18,13 +18,21 @@ class Encounter(Base):
|
||||
catch_level: Mapped[int | None] = mapped_column(SmallInteger)
|
||||
faint_level: Mapped[int | None] = mapped_column(SmallInteger)
|
||||
death_cause: Mapped[str | None] = mapped_column(String(100))
|
||||
current_pokemon_id: Mapped[int | None] = mapped_column(
|
||||
ForeignKey("pokemon.id"), index=True
|
||||
)
|
||||
caught_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), server_default=func.now()
|
||||
)
|
||||
|
||||
run: Mapped["NuzlockeRun"] = relationship(back_populates="encounters")
|
||||
route: Mapped["Route"] = relationship(back_populates="encounters")
|
||||
pokemon: Mapped["Pokemon"] = relationship(back_populates="encounters")
|
||||
pokemon: Mapped["Pokemon"] = relationship(
|
||||
foreign_keys=[pokemon_id], back_populates="encounters"
|
||||
)
|
||||
current_pokemon: Mapped["Pokemon | None"] = relationship(
|
||||
foreign_keys=[current_pokemon_id]
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"<Encounter(id={self.id}, pokemon_id={self.pokemon_id}, status='{self.status}')>"
|
||||
|
||||
Reference in New Issue
Block a user