PATCH: fixed issues with authentication

This commit is contained in:
white
2025-01-29 11:31:43 +00:00
parent cd1a246483
commit e2070be9f9
9 changed files with 86 additions and 107 deletions

View File

@@ -5,8 +5,8 @@ def categories():
Returns all possible streaming categories
"""
db = Database()
cursor = db.create_connection()
all_categories = cursor.execute("SELECT * FROM categories").fetchall()
db.create_connection()
all_categories = db.fetchall("SELECT * FROM categories")
return all_categories
def tags():
@@ -14,8 +14,8 @@ def tags():
Returns all possible streaming tags
"""
db = Database()
cursor = db.create_connection()
all_tags = cursor.execute("SELECT * FROM tags").fetchall()
db.create_connection()
all_tags = db.fetchall("SELECT * FROM tags")
return all_tags
def most_popular_category():
@@ -23,9 +23,9 @@ def most_popular_category():
Returns the most popular category based on live stream viewers
"""
db = Database()
cursor = db.create_connection()
db.create_connection()
category = cursor.execute("""
category = db.fetchone("""
SELECT categories.category_id, categories.category_name
FROM streams
JOIN categories ON streams.category_id = categories.category_id
@@ -33,7 +33,7 @@ def most_popular_category():
GROUP BY categories.category_name
ORDER BY SUM(streams.num_viewers) DESC
LIMIT 1;
""").fetchone()
""")
return category