mirror of
https://github.com/Sosokker/go-chi-oapi-codegen-todolist.git
synced 2025-12-19 05:54:07 +01:00
17 lines
478 B
SQL
17 lines
478 B
SQL
-- name: CreateAttachment :one
|
|
INSERT INTO attachments (todo_id, user_id, file_name, storage_path, content_type, size)
|
|
VALUES ($1, $2, $3, $4, $5, $6)
|
|
RETURNING *;
|
|
|
|
-- name: GetAttachmentByID :one
|
|
SELECT * FROM attachments
|
|
WHERE id = $1 AND user_id = $2 LIMIT 1;
|
|
|
|
-- name: ListAttachmentsForTodo :many
|
|
SELECT * FROM attachments
|
|
WHERE todo_id = $1 AND user_id = $2
|
|
ORDER BY uploaded_at ASC;
|
|
|
|
-- name: DeleteAttachment :exec
|
|
DELETE FROM attachments
|
|
WHERE id = $1 AND user_id = $2; |