lct-38: каталог 209 служб из «СЛУЖБЫ 112» для ручного добавления в карточку
This commit is contained in:
parent
b4420cea16
commit
3ce3e768e1
13 changed files with 1715 additions and 6 deletions
|
|
@ -48,3 +48,14 @@ async def signs(prefix: list[str] = Query(default=[]), group: int | None = None)
|
|||
else None
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
@router.get("/services")
|
||||
async def services() -> dict:
|
||||
"""Каталог служб для ручного добавления в карточку — как окно «Добавьте службы».
|
||||
|
||||
Каталог — справочник боевого АРМ, а не содержимое вызова: отдавать его
|
||||
курсанту так же безопасно, как группы происшествий.
|
||||
"""
|
||||
data = ekp.catalog()
|
||||
return {"source": data.source, "services": [item.model_dump() for item in data.services]}
|
||||
|
|
|
|||
|
|
@ -270,7 +270,16 @@ async def _handle(session_id: UUID, state, event) -> None:
|
|||
|
||||
case "kio.patch":
|
||||
old_code, old_notify = state.kio.incident_code, list(state.kio.notify)
|
||||
state.patch_kio(event.fields)
|
||||
try:
|
||||
state.patch_kio(event.fields)
|
||||
except ValidationError as exc:
|
||||
# Недопустимое значение — отказ курсанту, а не сбой операции:
|
||||
# сбой закрыл бы занятие на этом узле.
|
||||
hub.to_trainee(session_id, ErrorEvent(
|
||||
code=ErrorKind.UNSUPPORTED_EVENT,
|
||||
message=f"Поле карточки не принято: {exc.errors()[0].get('msg', '')}"[:200],
|
||||
))
|
||||
return
|
||||
hub.to_trainee(session_id, KioPatchOut(
|
||||
fields=event.fields, source=PatchSource.OPERATOR,
|
||||
))
|
||||
|
|
|
|||
Loading…
Reference in a new issue