Add unit tests for department weather API: cache helpers, fallback behavior, timeline range handling, and schema conformance. Enhance route logic with custom date ranges, cache support, and fallback handling. Update OpenAPI spec and schema mappings.
This commit is contained in:
+12
-6
@@ -7798,7 +7798,7 @@ paths:
|
||||
tags:
|
||||
- Departments
|
||||
summary: Get department weather timeline
|
||||
description: Returns 48 hourly entries with weather, washes, Workfeed employee-hours, and productivity status aggregated across selected departments (server local time). Default range is start of yesterday (`00:00`) to end of today (`23:00`). Use `date` (`YYYY-MM-DD`) to override the anchor day and get start of previous day to end of selected day.
|
||||
description: Returns hourly weather, washes, Workfeed employee-hours, and productivity status aggregated across selected departments (server local time). Default range is start of yesterday (`00:00`) to end of today (`23:00`). Use `date_from` and `date_to` (`YYYY-MM-DD`) together to override the range. If department coordinates are missing/invalid or WeatherAPI cannot resolve the location, weather data falls back silently and timeline slots default to `mostly_clear`.
|
||||
operationId: getDepartmentWeatherTimeline
|
||||
parameters:
|
||||
- name: id
|
||||
@@ -7821,14 +7821,22 @@ paths:
|
||||
type: string
|
||||
example: '1,2,3'
|
||||
description: Optional CSV alternative for department IDs. Merged with `id` if both are provided. At least one of `id` or `ids` must be provided.
|
||||
- name: date
|
||||
- name: date_from
|
||||
in: query
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
format: date
|
||||
example: '2026-03-23'
|
||||
description: Optional range start date (`YYYY-MM-DD`). Must be used together with `date_to`.
|
||||
- name: date_to
|
||||
in: query
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
format: date
|
||||
example: '2026-03-24'
|
||||
description: Optional date override (`YYYY-MM-DD`). Range becomes start of previous day to end of this date.
|
||||
description: Optional range end date (`YYYY-MM-DD`, inclusive). Must be used together with `date_from`.
|
||||
responses:
|
||||
'200':
|
||||
description: Department weather timeline retrieved successfully
|
||||
@@ -10651,9 +10659,7 @@ components:
|
||||
properties:
|
||||
data:
|
||||
type: array
|
||||
minItems: 48
|
||||
maxItems: 48
|
||||
description: 48 contiguous hourly slots from start of previous day (`00:00`) to end of anchor day (`23:00`). Anchor day is today unless `date` is provided.
|
||||
description: Hourly contiguous slots from start of range (`00:00`) to end of range (`23:00`, inclusive). Defaults to yesterday+today (48 entries) when date_from/date_to are not provided.
|
||||
items:
|
||||
$ref: '#/components/schemas/DepartmentWeatherTimelineEntry'
|
||||
required: [data]
|
||||
|
||||
Reference in New Issue
Block a user