tg_rss_bot/database_interaction.py

29 lines
987 B
Python
Raw Normal View History

2022-05-19 21:12:43 +00:00
import sqlite3
class Database():
2022-05-19 22:46:55 +00:00
def __init__(self, path):
self.conn = sqlite3.connect(path)
2022-05-19 21:12:43 +00:00
self.cur = self.conn.cursor()
2022-05-19 22:46:55 +00:00
self.cur.execute('CREATE TABLE IF NOT EXISTS users (id INTEGER, telegram_id NUMERIC, PRIMARY KEY(id))')
self.cur.execute('CREATE TABLE IF NOT EXISTS feeds (id INTEGER, link TEXT, PRIMARY KEY(id))')
self.cur.execute('CREATE TABLE IF NOT EXISTS subscribes (user_id INTEGER, feed_id INTEGER, FOREIGN KEY(user_id) REFERENCES users(id), FOREIGN KEY(feed_id) REFERENCES feeds(id))')
self.cur.execute('CREATE TABLE IF NOT EXISTS feeds_last_items (feed_id INTEGER, link TEXT, title TEXT, description TEXT, date NUMERIC, FOREIGN KEY(feed_id) REFERENCES feeds(id))')
2022-05-19 21:12:43 +00:00
def add_rss_feed():
pass
def delete_rss_feed():
pass
def get_feeds():
pass
def get_users_subscribes():
pass
def get_feed_items():
pass
def storing_feed_content():
pass