Remove the level input from the boss defeat modal since the app doesn't track levels elsewhere. Team selection is now just checkboxes without requiring level entry. - Remove level input UI from BossDefeatModal.tsx - Add alembic migration to make boss_result_team.level nullable - Update model and schemas to make level optional (defaults to null) - Conditionally render level in boss result display Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
27 lines
930 B
Python
27 lines
930 B
Python
from sqlalchemy import ForeignKey, SmallInteger
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
|
|
from app.core.database import Base
|
|
|
|
|
|
class BossResultTeam(Base):
|
|
__tablename__ = "boss_result_team"
|
|
|
|
id: Mapped[int] = mapped_column(primary_key=True)
|
|
boss_result_id: Mapped[int] = mapped_column(
|
|
ForeignKey("boss_results.id", ondelete="CASCADE"), index=True
|
|
)
|
|
encounter_id: Mapped[int] = mapped_column(
|
|
ForeignKey("encounters.id", ondelete="CASCADE"), index=True
|
|
)
|
|
level: Mapped[int | None] = mapped_column(SmallInteger, nullable=True)
|
|
|
|
boss_result: Mapped[BossResult] = relationship(back_populates="team")
|
|
encounter: Mapped[Encounter] = relationship()
|
|
|
|
def __repr__(self) -> str:
|
|
return (
|
|
f"<BossResultTeam(id={self.id}, boss_result_id={self.boss_result_id}, "
|
|
f"encounter_id={self.encounter_id}, level={self.level})>"
|
|
)
|