идентификаторы удалений, заготовки

This commit is contained in:
2026-08-20 13:51:51 +03:00
parent 9422719ea6
commit d90c4500ad
4 changed files with 166 additions and 25 deletions

View File

@@ -3906,12 +3906,9 @@ def create_hockey_agent_router(
async def mapping_data_catalog(payload: MappingDataContextPayload, user: HockeyUser = Depends(auth_dependency)) -> dict[str, Any]:
return hub.mapping_data.data_catalog(user, payload.context)
@router.post("/api/hockey/context/{key}")
async def hockey_context_set(key: str, payload: ContextValuePayload, user: HockeyUser = Depends(auth_dependency)) -> dict[str, Any]:
result = hub.mapping_data.set_context_value(key, payload.value, user, payload.context)
result["mapping_apply"] = await hub.apply_mapping_for_user(user, reason=f"context_changed:{key}")
return result
# BUILD86: static context routes MUST be registered before /{key}.
# Starlette matches routes in registration order; the old order treated the
# literal word "batch" (and "resolve") as a context variable key.
@router.post("/api/hockey/context/batch")
async def hockey_context_batch(payload: ContextValuesPayload, user: HockeyUser = Depends(auth_dependency)) -> dict[str, Any]:
if len(payload.values) > 32:
@@ -3934,6 +3931,12 @@ def create_hockey_agent_router(
context, variables = hub.mapping_data.resolve_context(user, payload.context)
return {"context": context, "variables": variables}
@router.post("/api/hockey/context/{key}")
async def hockey_context_set(key: str, payload: ContextValuePayload, user: HockeyUser = Depends(auth_dependency)) -> dict[str, Any]:
result = hub.mapping_data.set_context_value(key, payload.value, user, payload.context)
result["mapping_apply"] = await hub.apply_mapping_for_user(user, reason=f"context_changed:{key}")
return result
@router.websocket("/ws/hockey-agent")
async def agent_socket(websocket: WebSocket) -> None:
await websocket.accept()