From 756b66b31fd02215fc2d8a30ae263a3bf08a90a6 Mon Sep 17 00:00:00 2001
From: nsfisis <nsfisis@gmail.com>
Date: Sat, 12 Jul 2025 23:58:57 +0900
Subject: feat(backend,frontend): add feature to unsubscribe feed

---
 backend/db/queries/feeds.sql | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

(limited to 'backend/db/queries/feeds.sql')

diff --git a/backend/db/queries/feeds.sql b/backend/db/queries/feeds.sql
index 6d4d172..8445532 100644
--- a/backend/db/queries/feeds.sql
+++ b/backend/db/queries/feeds.sql
@@ -1,11 +1,12 @@
 -- name: GetFeed :one
-SELECT id, url, title, fetched_at
+SELECT id, url, title, fetched_at, is_subscribed
 FROM feeds
 WHERE id = ?;
 
 -- name: GetFeeds :many
-SELECT id, url, title, fetched_at
+SELECT id, url, title, fetched_at, is_subscribed
 FROM feeds
+WHERE is_subscribed = 1
 ORDER BY id;
 
 -- name: CreateFeed :one
@@ -23,10 +24,16 @@ DELETE FROM feeds
 WHERE id = ?;
 
 -- name: GetFeedByURL :one
-SELECT id, url, title, fetched_at
+SELECT id, url, title, fetched_at, is_subscribed
 FROM feeds
 WHERE url = ?;
 
 -- name: GetFeedsToFetch :many
 SELECT id, url, fetched_at
-FROM feeds;
+FROM feeds
+WHERE is_subscribed = 1;
+
+-- name: UnsubscribeFeed :exec
+UPDATE feeds
+SET is_subscribed = 0
+WHERE id = ?;
-- 
cgit v1.2.3-70-g09d2

