Daedalus and Talos integration test
All checks were successful
CI / backend-tests (push) Successful in 26s
CI / frontend-tests (push) Successful in 29s

This commit is contained in:
Julian Tabel
2026-03-20 16:31:19 +01:00
parent 5106e57685
commit c9d42b091f
44 changed files with 8345 additions and 31 deletions

View File

@@ -4,11 +4,13 @@ from sqlalchemy import delete, select, update
from sqlalchemy.dialects.postgresql import insert
from sqlalchemy.ext.asyncio import AsyncSession
from app.models.ability import Ability
from app.models.boss_battle import BossBattle
from app.models.boss_pokemon import BossPokemon
from app.models.encounter import Encounter
from app.models.evolution import Evolution
from app.models.game import Game
from app.models.move import Move
from app.models.pokemon import Pokemon
from app.models.route import Route
from app.models.route_encounter import RouteEncounter
@@ -484,3 +486,59 @@ async def upsert_evolutions(
await session.flush()
return count
async def upsert_moves(
session: AsyncSession,
moves: list[dict],
) -> int:
"""Upsert move records, return count of upserted rows."""
count = 0
for move in moves:
stmt = (
insert(Move)
.values(
name=move["name"],
introduced_gen=move["introduced_gen"],
type=move.get("type"),
)
.on_conflict_do_update(
index_elements=["name"],
set_={
"introduced_gen": move["introduced_gen"],
"type": move.get("type"),
},
)
)
await session.execute(stmt)
count += 1
await session.flush()
return count
async def upsert_abilities(
session: AsyncSession,
abilities: list[dict],
) -> int:
"""Upsert ability records, return count of upserted rows."""
count = 0
for ability in abilities:
stmt = (
insert(Ability)
.values(
name=ability["name"],
introduced_gen=ability["introduced_gen"],
)
.on_conflict_do_update(
index_elements=["name"],
set_={
"introduced_gen": ability["introduced_gen"],
},
)
)
await session.execute(stmt)
count += 1
await session.flush()
return count