23 lines
851 B
Python
23 lines
851 B
Python
|
|
from sqlalchemy import ForeignKey, SmallInteger
|
||
|
|
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)
|
||
|
|
|
||
|
|
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})>"
|