Add post video storage (#21)
CI / test (push) Successful in 6m28s

post_images.kind is image or video. A post can keep one video alongside up to four images.

Reviewed-on: #21
Co-authored-by: codegirl-007 <s.raide@gmail.com>
This commit was merged in pull request #21.
This commit is contained in:
2026-08-31 04:37:08 +00:00
committed by codegirl007
parent 2eb8bff1c4
commit 728ae68811
8 changed files with 144 additions and 21 deletions
+4 -3
View File
@@ -63,7 +63,7 @@ WHERE id = sqlc.arg(id);
-- name: CreatePostImage :exec
INSERT INTO post_images (
id, post_id, object_key, public_url, description, position, width, height, created_at
id, post_id, object_key, public_url, description, kind, position, width, height, created_at
)
VALUES (
sqlc.arg(id),
@@ -71,6 +71,7 @@ VALUES (
sqlc.arg(object_key),
sqlc.arg(public_url),
sqlc.arg(description),
sqlc.arg(kind),
sqlc.arg(position),
sqlc.arg(width),
sqlc.arg(height),
@@ -83,7 +84,7 @@ WHERE post_id = sqlc.arg(post_id);
-- name: ListPostImages :many
SELECT
id, post_id, object_key, public_url, description, position, width, height, created_at
id, post_id, object_key, public_url, description, kind, position, width, height, created_at
FROM post_images
WHERE post_id = sqlc.arg(post_id)
ORDER BY position;
@@ -102,7 +103,7 @@ WITH RECURSIVE thread AS (
)
SELECT
images.id, images.post_id, images.object_key, images.public_url,
images.description, images.position, images.width, images.height, images.created_at
images.description, images.kind, images.position, images.width, images.height, images.created_at
FROM post_images images
JOIN thread ON thread.id = images.post_id
ORDER BY images.post_id, images.position;