Merge pull request #26 from zurdi15/feature/fetching_order

Feature/fetching order
This commit is contained in:
Zurdi
2023-03-28 12:30:22 +02:00
committed by GitHub
2 changed files with 3 additions and 2 deletions

View File

@@ -3,6 +3,7 @@ RomM v1.2
- SQLite support added
- SQLite is now the database by default if ROMM_DB_DRIVER is not set
- Dreamcast support added (https://github.com/zurdi15/romm#platforms-support)
- Platforms and games are now shown by alphabetical order
RomM v1.1
-----------------------

View File

@@ -36,7 +36,7 @@ class DBHandler:
def get_platforms(self) -> list[Platform]:
try:
with Session.begin() as session:
return session.scalars(select(Platform)).all()
return session.scalars(select(Platform).order_by(Platform.slug.asc())).all()
except ProgrammingError as e:
raise HTTPException(status_code=404, detail=f"Platforms table not found: {e}")
@@ -51,7 +51,7 @@ class DBHandler:
def get_roms(self, p_slug: str) -> list[Rom]:
with Session.begin() as session:
return session.scalars(select(Rom).filter_by(p_slug=p_slug)).all()
return session.scalars(select(Rom).filter_by(p_slug=p_slug).order_by(Rom.filename.asc())).all()
def get_rom(self, p_slug: str, filename: str) -> Rom: