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 6db0da68be - Show all commits

View file

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