Daedalus and Talos integration test
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from app.models.ability import Ability
|
||||
from app.models.boss_battle import BossBattle
|
||||
from app.models.boss_pokemon import BossPokemon
|
||||
from app.models.boss_result import BossResult
|
||||
@@ -6,6 +7,8 @@ from app.models.evolution import Evolution
|
||||
from app.models.game import Game
|
||||
from app.models.genlocke import Genlocke, GenlockeLeg
|
||||
from app.models.genlocke_transfer import GenlockeTransfer
|
||||
from app.models.journal_entry import JournalEntry
|
||||
from app.models.move import Move
|
||||
from app.models.nuzlocke_run import NuzlockeRun
|
||||
from app.models.pokemon import Pokemon
|
||||
from app.models.route import Route
|
||||
@@ -13,6 +16,7 @@ from app.models.route_encounter import RouteEncounter
|
||||
from app.models.version_group import VersionGroup
|
||||
|
||||
__all__ = [
|
||||
"Ability",
|
||||
"BossBattle",
|
||||
"BossPokemon",
|
||||
"BossResult",
|
||||
@@ -22,6 +26,8 @@ __all__ = [
|
||||
"Genlocke",
|
||||
"GenlockeLeg",
|
||||
"GenlockeTransfer",
|
||||
"JournalEntry",
|
||||
"Move",
|
||||
"NuzlockeRun",
|
||||
"Pokemon",
|
||||
"Route",
|
||||
|
||||
15
backend/src/app/models/ability.py
Normal file
15
backend/src/app/models/ability.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from sqlalchemy import SmallInteger, String
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from app.core.database import Base
|
||||
|
||||
|
||||
class Ability(Base):
|
||||
__tablename__ = "abilities"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
name: Mapped[str] = mapped_column(String(50), unique=True)
|
||||
introduced_gen: Mapped[int] = mapped_column(SmallInteger)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"<Ability(id={self.id}, name='{self.name}', gen={self.introduced_gen})>"
|
||||
37
backend/src/app/models/journal_entry.py
Normal file
37
backend/src/app/models/journal_entry.py
Normal file
@@ -0,0 +1,37 @@
|
||||
from datetime import datetime
|
||||
from uuid import UUID
|
||||
|
||||
from sqlalchemy import DateTime, ForeignKey, String, Text, func
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from app.core.database import Base
|
||||
|
||||
|
||||
class JournalEntry(Base):
|
||||
__tablename__ = "journal_entries"
|
||||
|
||||
id: Mapped[UUID] = mapped_column(
|
||||
primary_key=True, server_default=func.gen_random_uuid()
|
||||
)
|
||||
run_id: Mapped[int] = mapped_column(
|
||||
ForeignKey("nuzlocke_runs.id", ondelete="CASCADE"), index=True
|
||||
)
|
||||
boss_result_id: Mapped[int | None] = mapped_column(
|
||||
ForeignKey("boss_results.id", ondelete="SET NULL"), index=True
|
||||
)
|
||||
title: Mapped[str] = mapped_column(String(200))
|
||||
body: Mapped[str] = mapped_column(Text)
|
||||
created_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), server_default=func.now()
|
||||
)
|
||||
updated_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), server_default=func.now(), onupdate=func.now()
|
||||
)
|
||||
|
||||
run: Mapped[NuzlockeRun] = relationship(back_populates="journal_entries")
|
||||
boss_result: Mapped[BossResult | None] = relationship()
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return (
|
||||
f"<JournalEntry(id={self.id}, run_id={self.run_id}, title='{self.title}')>"
|
||||
)
|
||||
16
backend/src/app/models/move.py
Normal file
16
backend/src/app/models/move.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from sqlalchemy import SmallInteger, String
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from app.core.database import Base
|
||||
|
||||
|
||||
class Move(Base):
|
||||
__tablename__ = "moves"
|
||||
|
||||
id: Mapped[int] = mapped_column(primary_key=True)
|
||||
name: Mapped[str] = mapped_column(String(50), unique=True)
|
||||
introduced_gen: Mapped[int] = mapped_column(SmallInteger)
|
||||
type: Mapped[str | None] = mapped_column(String(20))
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"<Move(id={self.id}, name='{self.name}', gen={self.introduced_gen})>"
|
||||
@@ -27,6 +27,7 @@ class NuzlockeRun(Base):
|
||||
game: Mapped[Game] = relationship(back_populates="runs")
|
||||
encounters: Mapped[list[Encounter]] = relationship(back_populates="run")
|
||||
boss_results: Mapped[list[BossResult]] = relationship(back_populates="run")
|
||||
journal_entries: Mapped[list[JournalEntry]] = relationship(back_populates="run")
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user