add unsubscribe_user method
This commit is contained in:
parent
319a21472f
commit
1c105e6ba0
|
@ -25,10 +25,14 @@ class Database():
|
||||||
self.conn.commit()
|
self.conn.commit()
|
||||||
return self.cur.lastrowid
|
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.cur.execute('INSERT INTO subscribes (user_id, feed_id) VALUES (?, ?)', (user_id, feed_id))
|
||||||
self.conn.commit()
|
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:
|
def delete_feed(self, feed_id: int) -> None:
|
||||||
self.cur.execute('DELETE FROM feeds WHERE id = ?', (feed_id,))
|
self.cur.execute('DELETE FROM feeds WHERE id = ?', (feed_id,))
|
||||||
self.conn.commit()
|
self.conn.commit()
|
||||||
|
|
Loading…
Reference in a new issue