From 40d7c8dd73863b3411bc7d9c881d19b81d240133 Mon Sep 17 00:00:00 2001 From: blazSmehov Date: Fri, 13 Mar 2026 15:23:13 +0100 Subject: [PATCH] feat: add alert status update and aggregated health endpoints --- api/openapi.yaml | 100 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 98 insertions(+), 2 deletions(-) diff --git a/api/openapi.yaml b/api/openapi.yaml index fd3fa75..863f56f 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -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