feat(fleet): replace onboard computer without replacing apparatus
This commit is contained in:
@@ -48,6 +48,12 @@ class AddRequest(BaseModel):
|
||||
platform: str = Field(pattern="^(ugv|uav|stationary|other)$")
|
||||
|
||||
|
||||
class AttachBoardRequest(BaseModel):
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
preview_id: str = Field(min_length=43, max_length=43)
|
||||
expected_revision: int = Field(ge=1, strict=True)
|
||||
|
||||
|
||||
router = APIRouter(prefix="/api/v1/fleet", tags=["fleet"])
|
||||
|
||||
|
||||
@@ -165,6 +171,17 @@ def fleet_revoke(vehicle_id: str, fleet: Annotated[FleetRegistry, Depends(local_
|
||||
raise HTTPException(404, str(error)) from None
|
||||
|
||||
|
||||
@router.post("/{vehicle_id}/computer")
|
||||
def fleet_attach_board(vehicle_id: str, body: AttachBoardRequest, response: Response,
|
||||
fleet: Annotated[FleetRegistry, Depends(local_operator)]):
|
||||
response.headers["Cache-Control"] = "no-store"
|
||||
try:
|
||||
return fleet.add(body.preview_id, "", "", vehicle_id=vehicle_id,
|
||||
expected_revision=body.expected_revision)
|
||||
except PairingError as error:
|
||||
raise HTTPException(409, str(error)) from None
|
||||
|
||||
|
||||
@router.post("/{vehicle_id}/devices/operations")
|
||||
def sensor_command(
|
||||
vehicle_id: str, body: dict, fleet: Annotated[FleetRegistry, Depends(local_operator)]
|
||||
|
||||
Reference in New Issue
Block a user