diff --git a/scraper.go b/scraper.go index 95c22ea..0dfc29b 100644 --- a/scraper.go +++ b/scraper.go @@ -10,8 +10,6 @@ import ( "strings" "sync" "time" - - "github.com/bootdotdev/projects/posts/internal/database" "github.com/google/uuid" ) diff --git a/sql/queries/posts.sql b/sql/queries/posts.sql index c046fed..9e6ad87 100644 --- a/sql/queries/posts.sql +++ b/sql/queries/posts.sql @@ -1,5 +1,13 @@ -- name: CreatePost :one - -INSERT INTO users (id, created_at, updated_at, title, url, feed_id,published_at,description) +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 *; \ No newline at end of file +RETURNING *; +-- + +-- name: GetPostsForUser :many +SELECT posts.* FROM posts +JOIN feed_follows ON feed_follows.feed_id = posts.feed_id +WHERE feed_follows.user_id = $1 +ORDER BY posts.published_at DESC +LIMIT $2; +-- \ No newline at end of file