diff --git a/database.py b/database.py index e8ce88f..d4021d6 100644 --- a/database.py +++ b/database.py @@ -25,10 +25,14 @@ class Database(): self.conn.commit() return self.cur.lastrowid - def subscribe_user(self, user_id: int, feed_id: int): + def subscribe_user(self, user_id: int, feed_id: int) -> None: self.cur.execute('INSERT INTO subscribes (user_id, feed_id) VALUES (?, ?)', (user_id, feed_id)) self.conn.commit() + def unsubscribe_user(self, user_id: int, feed_id: int) -> None: + self.cur.execute('DELETE FROM subscribes WHERE feed_id = ? AND user_id = ?', (feed_id, user_id)) + self.conn.commit() + def delete_feed(self, feed_id: int) -> None: self.cur.execute('DELETE FROM feeds WHERE id = ?', (feed_id,)) self.conn.commit()