- UpdateTablo SQL: add color = \$4 so color is preserved across title/description edits - GetTabloByID SQL: add AND user_id = \$2 to push ownership enforcement into the DB layer - DeleteTablo SQL: add AND user_id = \$2 to push authorization into the DB layer - sqlc bindings regenerated (UpdateTabloParams+Color, GetTabloByIDParams, DeleteTabloParams) Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
24 lines
755 B
SQL
24 lines
755 B
SQL
-- name: ListTablosByUser :many
|
|
SELECT id, user_id, title, description, color, created_at, updated_at
|
|
FROM tablos
|
|
WHERE user_id = $1
|
|
ORDER BY created_at DESC;
|
|
|
|
-- name: GetTabloByID :one
|
|
SELECT id, user_id, title, description, color, created_at, updated_at
|
|
FROM tablos
|
|
WHERE id = $1 AND user_id = $2;
|
|
|
|
-- name: InsertTablo :one
|
|
INSERT INTO tablos (user_id, title, description, color)
|
|
VALUES ($1, $2, $3, $4)
|
|
RETURNING id, user_id, title, description, color, created_at, updated_at;
|
|
|
|
-- name: UpdateTablo :one
|
|
UPDATE tablos
|
|
SET title = $2, description = $3, color = $4, updated_at = now()
|
|
WHERE id = $1
|
|
RETURNING id, user_id, title, description, color, created_at, updated_at;
|
|
|
|
-- name: DeleteTablo :exec
|
|
DELETE FROM tablos WHERE id = $1 AND user_id = $2;
|