Add the dinners API for Regulars
CI / ci (push) Successful in 2m11s
CI / ci (pull_request) Successful in 2m12s

POST /api/v1/dinners adds a Regular from a name or a recipe link
(status and origin regular, grounding_status pending), refusing a name
harness.Similar to an unarchived dinner, or a known link, with 409.
GET /dinners?status=regular|quest_log lists dinners with photo URLs and
grounding status; PATCH /dinners/{id} edits name, method, minutes and
difficulty; DELETE archives the row; POST /dinners/{id}/favorite toggles
is_favorite. Every write records the session subject as updated_by.

Migration 0008 adds dinners.recipe_url so a pasted link is kept until
grounding resolves it.

Maestro task 28d3cb4b-83d1-40e8-991f-d88f0f64d270.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-06 15:46:33 -04:00
co-authored by Claude Opus 5.5
parent 0c89eef577
commit 9ba9b1d089
22 changed files with 1347 additions and 34 deletions
+18 -3
View File
@@ -1,12 +1,12 @@
-- name: CreateDinner :one
INSERT INTO dinners (
id, name, normalized_name, status, origin, method, minutes_total,
difficulty, cuisine, is_favorite, recipe_id, photo_id, grounding_status,
updated_by, created_at, updated_at
difficulty, cuisine, is_favorite, recipe_id, recipe_url, photo_id,
grounding_status, updated_by, created_at, updated_at
) VALUES (
?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?,
?, ?, ?
?, ?, ?, ?
)
RETURNING *;
@@ -19,6 +19,12 @@ SELECT * FROM dinners
WHERE status = ?
ORDER BY normalized_name, id;
-- name: ListUnarchivedDinners :many
-- Every dinner a new or renamed dinner must not repeat.
SELECT * FROM dinners
WHERE status <> 'archived'
ORDER BY id;
-- name: UpdateDinner :one
-- An unknown id returns sql.ErrNoRows.
UPDATE dinners
@@ -55,3 +61,12 @@ SET is_favorite = ?,
updated_at = ?
WHERE id = ?
RETURNING *;
-- name: ToggleDinnerFavorite :one
-- An unknown id returns sql.ErrNoRows.
UPDATE dinners
SET is_favorite = 1 - is_favorite,
updated_by = ?,
updated_at = ?
WHERE id = ?
RETURNING *;