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
+14
View File
@@ -70,6 +70,20 @@ func getDinners(logger *slog.Logger, svc *dinners.Service) http.HandlerFunc {
}
}
// getDinner answers GET /dinners/{id} with the dinner, its recipe and the
// reason it was suggested. An archived dinner is 404, like an unknown one,
// not a 200 with its status: it has no detail to show.
func getDinner(logger *slog.Logger, svc *dinners.Service) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
d, err := svc.Get(r.Context(), chi.URLParam(r, "id"))
if err != nil {
writeDinnerError(w, r, logger, "get dinner", err)
return
}
writeJSON(w, r, logger, http.StatusOK, d)
}
}
// postDinner adds a Regular, recording the session's actor as updated_by,
// and answers 201 with it and its grounding_job_id without waiting for the
// job. When the job cannot be enqueued it still answers 201, with the dinner