add add_feed method

This commit is contained in:
mitsuha_s 2022-05-22 22:02:17 +00:00
parent 91e84bfd67
commit 6db0da68be

View file

@ -10,17 +10,20 @@ class Database():
def add_user(self, telegram_id: str) -> int: def add_user(self, telegram_id: str) -> int:
self.cur.execute('INSERT INTO users (telegram_id) VALUES (:telegram_id)', {'telegram_id': telegram_id}) self.cur.execute('INSERT INTO users (telegram_id) VALUES (:telegram_id)', {'telegram_id': telegram_id})
self.conn.commit()
return self.cur.lastrowid return self.cur.lastrowid
def get_user(self, telegram_id: str) -> tuple | None: 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}) self.cur.execute('SELECT id FROM users WHERE telegram_id = :telegram_id', {'telegram_id': telegram_id})
id = self.cur.fetchone() user_id = self.cur.fetchone()
return id return user_id
def add_rss_feed(): def add_feed(self, link: str) -> int:
pass self.cur.execute('INSERT INTO feeds (link) VALUES (:link)', {'link': link})
self.conn.commit()
def delete_rss_feed(): return self.cur.lastrowid
def delete_feed():
pass pass
def get_feeds(): def get_feeds():