diff --git a/database_interaction.py b/database_interaction.py index 0b7e717..17c1d42 100644 --- a/database_interaction.py +++ b/database_interaction.py @@ -10,17 +10,20 @@ class Database(): def add_user(self, telegram_id: str) -> int: self.cur.execute('INSERT INTO users (telegram_id) VALUES (:telegram_id)', {'telegram_id': telegram_id}) + self.conn.commit() return self.cur.lastrowid def get_user(self, telegram_id: str) -> tuple | None: self.cur.execute('SELECT id FROM users WHERE telegram_id = :telegram_id', {'telegram_id': telegram_id}) - id = self.cur.fetchone() - return id + user_id = self.cur.fetchone() + return user_id - def add_rss_feed(): - pass - - def delete_rss_feed(): + def add_feed(self, link: str) -> int: + self.cur.execute('INSERT INTO feeds (link) VALUES (:link)', {'link': link}) + self.conn.commit() + return self.cur.lastrowid + + def delete_feed(): pass def get_feeds():