mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
https://github.com/dcs-liberation/dcs_liberation/issues/2039 Partial fix for https://github.com/dcs-liberation/dcs_liberation/issues/2045 (now works in the new map, old one not fixed yet).
22 lines
573 B
Python
22 lines
573 B
Python
from uuid import UUID
|
|
|
|
from fastapi import APIRouter, Depends
|
|
|
|
from game import Game
|
|
from .models import FrontLineJs
|
|
from ..dependencies import GameContext
|
|
|
|
router: APIRouter = APIRouter(prefix="/front-lines")
|
|
|
|
|
|
@router.get("/")
|
|
def list_front_lines(game: Game = Depends(GameContext.require)) -> list[FrontLineJs]:
|
|
return FrontLineJs.all_in_game(game)
|
|
|
|
|
|
@router.get("/{front_line_id}")
|
|
def get_front_line(
|
|
front_line_id: UUID, game: Game = Depends(GameContext.require)
|
|
) -> FrontLineJs:
|
|
return FrontLineJs.for_front_line(game.db.front_lines.get(front_line_id))
|