20 lines
571 B
SQL
20 lines
571 B
SQL
-- name: ListGalleryPhotos :many
|
|
SELECT id, image_url, caption, created_at, show_on_home
|
|
FROM gallery_photos
|
|
ORDER BY created_at DESC;
|
|
|
|
-- name: ListHomeCarouselPhotos :many
|
|
SELECT id, image_url, caption, created_at, show_on_home
|
|
FROM gallery_photos
|
|
WHERE show_on_home = true
|
|
ORDER BY created_at DESC;
|
|
|
|
-- name: CreateGalleryPhoto :one
|
|
INSERT INTO gallery_photos (image_url, caption, created_at, show_on_home)
|
|
VALUES ($1, $2, $3, $4)
|
|
RETURNING id, image_url, caption, created_at, show_on_home;
|
|
|
|
-- name: DeleteGalleryPhoto :exec
|
|
DELETE FROM gallery_photos
|
|
WHERE id = $1;
|