database_module #17

Merged
Miroslavsckaya merged 20 commits from database_interaction into master 2022-05-29 20:19:18 +00:00
Showing only changes of commit 1c105e6ba0 - Show all commits

View file

@ -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()