mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
operation_ids give us better function names when generating the typescript API from the openapi.json. BaseModel.Config.title does the same for type names. Response models (or 204 status codes) need to be explicit or the API will be declared as returning any.
35 lines
1.0 KiB
Python
35 lines
1.0 KiB
Python
from uuid import UUID
|
|
|
|
from fastapi import APIRouter, Depends
|
|
|
|
from game import Game
|
|
from game.server import GameContext
|
|
from .models import HoldZonesJs, IpZonesJs, JoinZonesJs
|
|
|
|
router: APIRouter = APIRouter(prefix="/debug/waypoint-geometries")
|
|
|
|
|
|
@router.get(
|
|
"/hold/{flight_id}", operation_id="get_debug_hold_zones", response_model=HoldZonesJs
|
|
)
|
|
def hold_zones(
|
|
flight_id: UUID, game: Game = Depends(GameContext.require)
|
|
) -> HoldZonesJs:
|
|
return HoldZonesJs.for_flight(game.db.flights.get(flight_id), game)
|
|
|
|
|
|
@router.get(
|
|
"/ip/{flight_id}", operation_id="get_debug_ip_zones", response_model=IpZonesJs
|
|
)
|
|
def ip_zones(flight_id: UUID, game: Game = Depends(GameContext.require)) -> IpZonesJs:
|
|
return IpZonesJs.for_flight(game.db.flights.get(flight_id), game)
|
|
|
|
|
|
@router.get(
|
|
"/join/{flight_id}", operation_id="get_debug_join_zones", response_model=JoinZonesJs
|
|
)
|
|
def join_zones(
|
|
flight_id: UUID, game: Game = Depends(GameContext.require)
|
|
) -> JoinZonesJs:
|
|
return JoinZonesJs.for_flight(game.db.flights.get(flight_id), game)
|