feat: implement feed agg and browse
This commit is contained in:
@@ -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;
|
||||
Reference in New Issue
Block a user