bgg_api/src/modules/data_connection.py

32 lines
953 B
Python
Raw Normal View History

from src.modules import bgg_connection, db_connection
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]:
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()
def get_user_wishlist_collection() -> list[boardgame_classes.BoardGame]:
return bgg_connection.get_user_wishlist_collection()
def get_plays() -> list[play_classes.Play]:
return bgg_connection.get_plays()
2024-08-08 16:50:52 +02:00
def delete_database():
db_connection.delete_database()
def create_db_and_tables():
db_connection.create_db_and_tables()