feat: implement feed agg and browse

This commit is contained in:
Stevan Freeborn
2026-08-03 07:14:33 -05:00
parent f51b1b941a
commit 667f5f112b
12 changed files with 444 additions and 40 deletions
+33
View File
@@ -0,0 +1,33 @@
-- name: CreatePost :one
INSERT INTO posts (id, created_at, updated_at, title, url, description, published_at, feed_id)
VALUES (
$1,
$2,
$3,
$4,
$5,
$6,
$7,
$8
)
RETURNING *;
-- name: GetPostsForUser :many
SELECT
posts.id,
posts.created_at,
posts.updated_at,
posts.title,
posts.url,
posts.description,
posts.published_at,
posts.feed_id,
feeds.name as feed_name
FROM posts
INNER JOIN feeds
ON posts.feed_id = feeds.id
INNER JOIN follows
ON posts.feed_id = follows.feed_id
WHERE follows.user_id = $1
ORDER BY posts.published_at DESC, posts.title ASC
LIMIT $2;