2024-08-03 15:42:19 +02:00
|
|
|
from src.modules import bgg_connection, db_connection
|
2024-08-03 10:44:52 +02:00
|
|
|
from src.classes import boardgame_classes, play_classes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_boardgame(boardgame_id: int) -> boardgame_classes.BoardGame:
|
|
|
|
|
#Will check if it already exists in db, then it will get it from there
|
|
|
|
|
|
|
|
|
|
return bgg_connection.get_boardgame(boardgame_id)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_user_owned_collection() -> list[boardgame_classes.BoardGame]:
|
2024-08-08 17:13:29 +02:00
|
|
|
owned_boardgames_from_db = db_connection.get_all_owned_boardgames()
|
|
|
|
|
|
|
|
|
|
if len(owned_boardgames_from_db) != 0:
|
|
|
|
|
return owned_boardgames_from_db
|
|
|
|
|
else:
|
|
|
|
|
return bgg_connection.get_user_owned_collection()
|
2024-08-03 10:44:52 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_user_wishlist_collection() -> list[boardgame_classes.BoardGame]:
|
|
|
|
|
|
|
|
|
|
return bgg_connection.get_user_wishlist_collection()
|
|
|
|
|
|
|
|
|
|
def get_plays() -> list[play_classes.Play]:
|
2024-08-03 15:42:19 +02:00
|
|
|
return bgg_connection.get_plays()
|
|
|
|
|
|
2024-08-08 16:50:52 +02:00
|
|
|
def delete_database():
|
|
|
|
|
db_connection.delete_database()
|
2024-08-03 15:42:19 +02:00
|
|
|
|
|
|
|
|
def create_db_and_tables():
|
|
|
|
|
db_connection.create_db_and_tables()
|