Procházet zdrojové kódy

feat: add alert status update and aggregated health endpoints

master
Blaz Smehov před 1 týdnem
rodič
revize
40d7c8dd73
1 změnil soubory, kde provedl 98 přidání a 2 odebrání
  1. +98
    -2
      api/openapi.yaml

+ 98
- 2
api/openapi.yaml Zobrazit soubor

@@ -543,7 +543,7 @@ paths:

/reslevis/alerts/{id}:
get:
summary: Get alert by ID (or tracker ID depending on usage)
summary: Get alert by ID
operationId: getAlertById
tags: [Alerts]
parameters:
@@ -560,6 +560,32 @@ paths:
'500':
$ref: '#/components/responses/InternalError'

patch:
summary: Update alert status
operationId: updateAlertStatus
tags: [Alerts]
parameters:
- $ref: '#/components/parameters/PathId'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AlertStatusUpdate'
responses:
'200':
description: Alert status updated
content:
application/json:
schema:
$ref: '#/components/schemas/StatusUpdated'
'400':
$ref: '#/components/responses/BadRequest'
'404':
$ref: '#/components/responses/NotFound'
'500':
$ref: '#/components/responses/InternalError'

delete:
summary: Delete alert by ID
operationId: deleteAlert
@@ -576,6 +602,23 @@ paths:
'500':
$ref: '#/components/responses/InternalError'

# --- Aggregated health (location, decoder, bridge, kafka, database) ---
/reslevis/health:
get:
summary: Aggregated health status
description: Returns health from location, decoder, bridge services plus server-checked Kafka and database status.
operationId: getAggregatedHealth
tags: [Health]
responses:
'200':
description: Aggregated health (location, decoder, bridge, kafka, database)
content:
application/json:
schema:
$ref: '#/components/schemas/AggregatedHealth'
'500':
$ref: '#/components/responses/InternalError'

# --- Tracks ---
/reslevis/getTracks/{id}:
get:
@@ -801,7 +844,60 @@ components:
id: { type: string }
tracker_id: { type: string }
type: { type: string }
value: { type: string }
status: { type: string }
timestamp: { type: string, format: date-time }

AlertStatusUpdate:
type: object
required: [status]
properties:
status:
type: string
description: New status (e.g. resolved, acknowledged)

ServiceStatus:
type: object
description: Health of an external service (e.g. Kafka, database)
properties:
status:
type: string
enum: [up, down, unknown]
message:
type: string
description: Error detail when status is down

BaseHealth:
type: object
properties:
uptime: { type: string, description: Duration string }
activeReaders: { type: array, items: { type: string } }
activeWriters: { type: array, items: { type: string } }
activeBeacons: { type: array, items: { type: string } }

LocationHealth:
allOf:
- $ref: '#/components/schemas/BaseHealth'
- type: object
properties:
activeSettings: { type: array, items: { type: object } }

DecoderHealth:
allOf:
- $ref: '#/components/schemas/BaseHealth'

BridgeHealth:
allOf:
- $ref: '#/components/schemas/BaseHealth'

AggregatedHealth:
type: object
description: Health from location, decoder, bridge (via Kafka) plus server-checked Kafka and database
properties:
location: { $ref: '#/components/schemas/LocationHealth' }
decoder: { $ref: '#/components/schemas/DecoderHealth' }
bridge: { $ref: '#/components/schemas/BridgeHealth' }
kafka: { $ref: '#/components/schemas/ServiceStatus' }
database: { $ref: '#/components/schemas/ServiceStatus' }

Track:
type: object


Načítá se…
Zrušit
Uložit