Add pokemon status management with death tracking

Implement status change workflow (alive → dead) with confirmation modal,
death cause recording, and visual status indicators on pokemon cards.
Includes backend migration for death_cause field and graveyard view
on the run dashboard.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-05 18:36:08 +01:00
parent 628c621fa9
commit a911259ef5
12 changed files with 462 additions and 53 deletions

View File

@@ -0,0 +1,26 @@
"""add death_cause to encounters
Revision ID: a1b2c3d4e5f6
Revises: 9afcbafe9888
Create Date: 2026-02-05 17:00:00.000000
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = 'a1b2c3d4e5f6'
down_revision: Union[str, Sequence[str], None] = '9afcbafe9888'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
op.add_column('encounters', sa.Column('death_cause', sa.String(100), nullable=True))
def downgrade() -> None:
op.drop_column('encounters', 'death_cause')

View File

@@ -17,6 +17,7 @@ class Encounter(Base):
status: Mapped[str] = mapped_column(String(20)) # caught, fainted, missed
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))
caught_at: Mapped[datetime] = mapped_column(
DateTime(timezone=True), server_default=func.now()
)

View File

@@ -17,6 +17,7 @@ class EncounterUpdate(CamelModel):
nickname: str | None = None
status: str | None = None
faint_level: int | None = None
death_cause: str | None = None
class EncounterResponse(CamelModel):
@@ -28,6 +29,7 @@ class EncounterResponse(CamelModel):
status: str
catch_level: int | None
faint_level: int | None
death_cause: str | None
caught_at: datetime