FEAT UPDATE: Updated Utils to use new database. Changed route arguments. Added unfollow feature

This commit is contained in:
JustIceO7
2025-01-31 02:00:31 +00:00
parent be53d4072e
commit 908870f751
9 changed files with 151 additions and 115 deletions

View File

@@ -10,7 +10,7 @@ CREATE TABLE stream_tags
(
stream_id INTEGER NOT NULL,
tag_id INTEGER NOT NULL,
FOREIGN KEY (stream_id) REFERENCES streams(stream_id),
FOREIGN KEY (stream_id) REFERENCES streams(stream_id) ON DELETE CASCADE,
FOREIGN KEY (tag_id) REFERENCES tags(tag_id) ON DELETE CASCADE
);

View File

@@ -58,13 +58,4 @@ CREATE TABLE followed_categories
PRIMARY KEY (user_id, category_id),
FOREIGN KEY(user_id) REFERENCES users(user_id) ON DELETE CASCADE,
FOREIGN KEY(category_id) REFERENCES categories(category_id) ON DELETE CASCADE
);
SELECT s.stream_id, s.title, u.username, s.num_viewers, c.category_name
FROM streams AS s
JOIN users AS u ON u.user_id = s.user_id
JOIN categories AS c ON s.category_id = c.category_id
JOIN followed_categories AS f ON s.category_id = c.category_id
WHERE f.user_id = ?
ORDER BY s.num_viewers DESC
LIMIT 25;
);