add Tournaments and Guest Page, add template for empty sites, extend user and db service

This commit is contained in:
David Rodenkirchen
2024-08-27 23:49:07 +02:00
parent 23070a4f69
commit 093f0d6a94
7 changed files with 186 additions and 3 deletions
@@ -518,3 +518,18 @@ class DatabaseService:
except Exception as e:
logger.warning(f"Error setting user profile picture: {e}")
return None
def get_all_users(self) -> list[User]:
results = []
cursor = self._get_cursor()
try:
cursor.execute("SELECT * FROM users;")
self._connection.commit()
except Exception as e:
logger.warning(f"Error getting all users: {e}")
return results
for user_raw in cursor.fetchall():
results.append(self._map_db_result_to_user(user_raw))
return results
@@ -16,6 +16,9 @@ class UserService:
def __init__(self, db_service: DatabaseService) -> None:
self._db_service = db_service
def get_all_users(self) -> list[User]:
return self._db_service.get_all_users()
def get_user(self, accessor: Optional[Union[str, int]]) -> Optional[User]:
if accessor is None:
return