You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The recommendations route returns one night per call. The calendar shows 30 nights at once, and 30 calls per page load is slow and wasteful.
Goal
The same recommendations route returns a range of nights in one call, with what the calendar needs for each night.
Scope
Add a days parameter to GET /hotels/{id}/recommendations (e.g. ?date=2026-11-01&days=30): date is the first night, days defaults to 1, with a sensible maximum (e.g. 60).
The response is a list with one entry per night:
stay date, rate, interval low and high;
change since the previous snapshot (amount, and when the previous one was made);
the names of events on that night;
the manager's own rate, if one is set;
the snapshot id, so the detail view and feedback can refer to it.
Leave the factor breakdown out of this response; it comes from the night detail endpoint.
404 with a clear message when the hotel has no trained model.
Update the route's description and examples in the API docs.
Considerations
This changes the response shape from one object to a list. Update every caller (the frontend, tests) in the same change.
Keep it fast for 30 nights: read saved snapshots rather than recomputing each night on every request.
Nights in the past can be requested too, for feedback after the night.
Acceptance criteria
?date=…&days=30 returns 30 nights in order in one call.
Omitting days returns one night.
Each night includes the change since its previous snapshot, or none if it's the first.
A days above the maximum returns 422.
Tests cover one night, a range, the maximum and no trained model.
Activity