aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/db/queries
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-11-02 00:00:35 +0900
committernsfisis <nsfisis@gmail.com>2025-11-02 00:00:35 +0900
commit104341ddc4add57f83c58cb3fabb23b6fbfdd3e4 (patch)
tree862b109fe257e6170a88929729dae3bddfb6eb49 /backend/db/queries
parentba1e0c904f810193f25d4f88cc2bb168f1d625fe (diff)
downloadfeedaka-104341ddc4add57f83c58cb3fabb23b6fbfdd3e4.tar.gz
feedaka-104341ddc4add57f83c58cb3fabb23b6fbfdd3e4.tar.zst
feedaka-104341ddc4add57f83c58cb3fabb23b6fbfdd3e4.zip
Diffstat (limited to 'backend/db/queries')
-rw-r--r--backend/db/queries/articles.sql6
-rw-r--r--backend/db/queries/feeds.sql6
2 files changed, 6 insertions, 6 deletions
diff --git a/backend/db/queries/articles.sql b/backend/db/queries/articles.sql
index c1feaae..b910fcf 100644
--- a/backend/db/queries/articles.sql
+++ b/backend/db/queries/articles.sql
@@ -4,7 +4,7 @@ SELECT
f.id as feed_id_2, f.url as feed_url, f.title as feed_title, f.is_subscribed as feed_is_subscribed
FROM articles AS a
INNER JOIN feeds AS f ON a.feed_id = f.id
-WHERE a.id = ?;
+WHERE a.id = ? AND f.user_id = ?;
-- name: GetUnreadArticles :many
SELECT
@@ -12,7 +12,7 @@ SELECT
f.id as feed_id_2, f.url as feed_url, f.title as feed_title, f.is_subscribed as feed_is_subscribed
FROM articles AS a
INNER JOIN feeds AS f ON a.feed_id = f.id
-WHERE a.is_read = 0 AND f.is_subscribed = 1
+WHERE a.is_read = 0 AND f.is_subscribed = 1 AND f.user_id = ?
ORDER BY a.id DESC
LIMIT 100;
@@ -22,7 +22,7 @@ SELECT
f.id as feed_id_2, f.url as feed_url, f.title as feed_title, f.is_subscribed as feed_is_subscribed
FROM articles AS a
INNER JOIN feeds AS f ON a.feed_id = f.id
-WHERE a.is_read = 1 AND f.is_subscribed = 1
+WHERE a.is_read = 1 AND f.is_subscribed = 1 AND f.user_id = ?
ORDER BY a.id DESC
LIMIT 100;
diff --git a/backend/db/queries/feeds.sql b/backend/db/queries/feeds.sql
index 9725252..9b0b8f7 100644
--- a/backend/db/queries/feeds.sql
+++ b/backend/db/queries/feeds.sql
@@ -1,12 +1,12 @@
-- name: GetFeed :one
SELECT id, url, title, fetched_at, is_subscribed, user_id
FROM feeds
-WHERE id = ?;
+WHERE id = ? AND user_id = ?;
-- name: GetFeeds :many
SELECT id, url, title, fetched_at, is_subscribed, user_id
FROM feeds
-WHERE is_subscribed = 1
+WHERE is_subscribed = 1 AND user_id = ?
ORDER BY id;
-- name: CreateFeed :one
@@ -26,7 +26,7 @@ WHERE id = ?;
-- name: GetFeedByURL :one
SELECT id, url, title, fetched_at, is_subscribed, user_id
FROM feeds
-WHERE url = ?;
+WHERE url = ? AND user_id = ?;
-- name: GetFeedsToFetch :many
SELECT id, url, fetched_at, user_id