diff --git a/backend/internal/db/queries/tablos.sql b/backend/internal/db/queries/tablos.sql index b2bb6f2..606e8a3 100644 --- a/backend/internal/db/queries/tablos.sql +++ b/backend/internal/db/queries/tablos.sql @@ -7,7 +7,7 @@ ORDER BY created_at DESC; -- name: GetTabloByID :one SELECT id, user_id, title, description, color, created_at, updated_at FROM tablos -WHERE id = $1; +WHERE id = $1 AND user_id = $2; -- name: InsertTablo :one INSERT INTO tablos (user_id, title, description, color) @@ -16,9 +16,9 @@ RETURNING id, user_id, title, description, color, created_at, updated_at; -- name: UpdateTablo :one UPDATE tablos -SET title = $2, description = $3, updated_at = now() +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; +DELETE FROM tablos WHERE id = $1 AND user_id = $2;