-
-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #84 from zurdi15/refactor/codebase
Refactor/codebase
- Loading branch information
Showing
22 changed files
with
435 additions
and
388 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,4 +40,7 @@ envs.env | |
mariadb | ||
|
||
# data test | ||
library | ||
library | ||
|
||
# config test | ||
romm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ requests==2.28.2 | |
fastapi==0.92.0 | ||
uvicorn==0.20.0 | ||
mariadb==1.1.6 | ||
SQLAlchemy==2.0.7 | ||
SQLAlchemy==2.0.7 | ||
PyYAML==6.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import os | ||
import pathlib | ||
import yaml | ||
from yaml.loader import SafeLoader | ||
|
||
|
||
# Uvicorn | ||
DEV_PORT: int = 5000 | ||
DEV_HOST: str = "0.0.0.0" | ||
|
||
# PATHS | ||
LIBRARY_BASE_PATH: str = f"{pathlib.Path(__file__).parent.parent.parent.parent.resolve()}/library" | ||
ROMM_USER_CONFIG_PATH: str = f"{pathlib.Path(__file__).parent.parent.parent.parent.resolve()}/romm/config.yml" | ||
|
||
# ROMM RESERVED FOLDERS | ||
RESERVED_FOLDERS: list = ['resources', 'database'] | ||
|
||
# DEFAULT RESOURCES | ||
DEFAULT_URL_COVER_L: str = "https://images.igdb.com/igdb/image/upload/t_cover_big/nocover.png" | ||
DEFAULT_PATH_COVER_L: str = f"/assets/library/resources/default/cover_l.png" | ||
DEFAULT_URL_COVER_S: str = "https://images.igdb.com/igdb/image/upload/t_cover_small/nocover.png" | ||
DEFAULT_PATH_COVER_S: str = f"/assets/library/resources/default/cover_s.png" | ||
|
||
# IGDB | ||
CLIENT_ID: str = os.getenv('CLIENT_ID') | ||
CLIENT_SECRET: str = os.getenv('CLIENT_SECRET') | ||
# STEAMGRIDDB | ||
STEAMGRIDDB_API_KEY: str = os.getenv('STEAMGRIDDB_API_KEY') | ||
|
||
# USER CONFIG | ||
try: | ||
with open(ROMM_USER_CONFIG_PATH) as config: config = yaml.load(config, Loader=SafeLoader) | ||
except FileNotFoundError: | ||
config = None | ||
user_config: dict = {} if not config else config | ||
|
||
# DB DRIVERS | ||
SUPPORTED_DB_DRIVERS: list = ['sqlite', 'mariadb'] | ||
ROMM_DB_DRIVER: str = os.getenv('ROMM_DB_DRIVER', 'sqlite') |
33 changes: 2 additions & 31 deletions
33
backend/src/config/config.py → backend/src/config/config_loader.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
from sqlalchemy import Column, String, Integer, Text | ||
|
||
from config.config import DEFAULT_PATH_LOGO | ||
from config import DEFAULT_PATH_COVER_S | ||
from models.base import BaseModel | ||
|
||
|
||
class Platform(BaseModel): | ||
__tablename__ = 'platforms' | ||
igdb_id = Column(String(length=50), default="") | ||
sgdb_id = Column(String(length=50), default="") | ||
slug = Column(String(length=500), primary_key=True) | ||
name = Column(String(length=500), default="") | ||
path_logo = Column(Text, default=DEFAULT_PATH_LOGO) | ||
igdb_id = Column(String(length=10), default="") | ||
sgdb_id = Column(String(length=10), default="") | ||
|
||
slug = Column(String(length=50), primary_key=True) | ||
name = Column(String(length=400), default="") | ||
|
||
logo_path = Column(String(length=1000), default=DEFAULT_PATH_COVER_S) | ||
|
||
n_roms = Column(Integer, default=0) |
Oops, something went wrong.