mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Update the react map for some new events.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from fastapi import APIRouter, Depends
|
||||
from fastapi import APIRouter, Depends, HTTPException, status
|
||||
|
||||
from game import Game
|
||||
from .models import ControlPointJs
|
||||
@@ -13,3 +13,16 @@ def list_control_points(game: Game = Depends(GameContext.get)) -> list[ControlPo
|
||||
for control_point in game.theater.controlpoints:
|
||||
control_points.append(ControlPointJs.for_control_point(control_point))
|
||||
return control_points
|
||||
|
||||
|
||||
@router.get("/{cp_id}")
|
||||
def get_control_point(
|
||||
cp_id: int, game: Game = Depends(GameContext.get)
|
||||
) -> ControlPointJs:
|
||||
cp = game.theater.find_control_point_by_id(cp_id)
|
||||
if cp is None:
|
||||
raise HTTPException(
|
||||
status.HTTP_404_NOT_FOUND,
|
||||
detail=f"Game has no control point with ID {cp_id}",
|
||||
)
|
||||
return ControlPointJs.for_control_point(cp)
|
||||
|
||||
Reference in New Issue
Block a user