mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Add an endpoint for listing all control points.
This commit is contained in:
15
game/server/controlpoints/routes.py
Normal file
15
game/server/controlpoints/routes.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from fastapi import APIRouter, Depends
|
||||
|
||||
from game import Game
|
||||
from .models import ControlPointJs
|
||||
from ..dependencies import GameContext
|
||||
|
||||
router: APIRouter = APIRouter(prefix="/control-points")
|
||||
|
||||
|
||||
@router.get("/")
|
||||
def list_control_points(game: Game = Depends(GameContext.get)) -> list[ControlPointJs]:
|
||||
control_points = []
|
||||
for control_point in game.theater.controlpoints:
|
||||
control_points.append(ControlPointJs.for_control_point(control_point))
|
||||
return control_points
|
||||
Reference in New Issue
Block a user