Add GET /api/v1/dinners/{id} dinner detail
CI / ci (push) Successful in 6m25s
CI / ci (pull_request) Successful in 5m12s

Returns a dinner with its recipe for the recipe detail screen and
Kitchen reading mode: photo URLs at both cached sizes (400/1200) or
null, ingredients and steps in recipe position order, the source page
for a fetched recipe, grounding status and error, and why_picked, the
reason of the suggestion that created the dinner (null when none).
Unknown and archived dinners are 404. Read in one transaction.

Adds the GetDinnerSuggestionReason query (sqlc regenerated). The
dinners test env now serves photos from the grounder's own store and
data directory so photo URLs can be fetched in tests.

Maestro task 099e9952-7f98-4700-8369-241c589a1e9d.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 18:50:18 -04:00
co-authored by Claude Opus 5.5
parent cb451baed4
commit 2217f4e5ad
10 changed files with 441 additions and 4 deletions
+13
View File
@@ -204,6 +204,19 @@ automatic** (D-021).
sets status `archived` and keeps the row; `POST
/api/v1/dinners/{id}/favorite` toggles `is_favorite`. Every write records
the session's subject as `updated_by`; an unknown id is 404.
`GET /api/v1/dinners/{id}` returns the dinner with its recipe, read in
one transaction: `{id, name, status, origin, method, minutes_total,
difficulty, cuisine, is_favorite, photo_urls, ingredients, steps,
source, grounding_status, grounding_error, why_picked}`. `photo_urls` is
`{"400": url, "1200": url}` (`/media/photos/{photo_id}-{size}.jpg`) or
null with no photo; `ingredients` is `[{name, qty, unit, note,
raw_text}]` and `steps` the step texts, both in recipe position order and
empty (`[]`) with no recipe, as for a dinner whose grounding is
`pending` or `failed`; a recipe entered by hand has only `raw_text`.
`source` is `{url, site_name}` of the page the recipe was fetched from,
null for a manual recipe or none; `why_picked` is the reason of the
suggestion that created the dinner (its earliest), null for one no
suggestion created. An unknown or archived dinner is 404.
- Dinner grounding. `POST /api/v1/dinners` also enqueues a `ground_dinner`
job and answers with its `grounding_job_id` without waiting for it
(`GET /api/v1/jobs/{id}` reports it); if the job cannot be enqueued it