mirror of
https://github.com/rommapp/romm.git
synced 2026-02-18 00:27:41 +01:00
Merge pull request #2862 from rommapp/romm-2856
[ROMM-2856] Use platform slug to fetch feed games
This commit is contained in:
@@ -162,7 +162,7 @@ async def tinfoil_index_feed(
|
||||
Returns:
|
||||
TinfoilFeedSchema: Tinfoil feed object schema
|
||||
"""
|
||||
switch = db_platform_handler.get_platform_by_fs_slug(slug)
|
||||
switch = db_platform_handler.get_platform_by_slug(slug)
|
||||
if not switch:
|
||||
return TinfoilFeedSchema(
|
||||
files=[],
|
||||
@@ -282,7 +282,7 @@ def pkgi_ps3_feed(
|
||||
Returns:
|
||||
Response: txt file with PKGi PS3 database format
|
||||
"""
|
||||
ps3_platform = db_platform_handler.get_platform_by_fs_slug(UPS.PS3)
|
||||
ps3_platform = db_platform_handler.get_platform_by_slug(UPS.PS3)
|
||||
if not ps3_platform:
|
||||
raise HTTPException(status_code=404, detail="PlayStation 3 platform not found")
|
||||
|
||||
@@ -352,7 +352,7 @@ def pkgi_psvita_feed(
|
||||
Returns:
|
||||
Response: txt file with PKGi PS Vita database format
|
||||
"""
|
||||
psvita_platform = db_platform_handler.get_platform_by_fs_slug(UPS.PSVITA)
|
||||
psvita_platform = db_platform_handler.get_platform_by_slug(UPS.PSVITA)
|
||||
if not psvita_platform:
|
||||
raise HTTPException(
|
||||
status_code=404, detail="PlayStation Vita platform not found"
|
||||
@@ -422,7 +422,7 @@ def pkgi_psp_feed(
|
||||
Returns:
|
||||
Response: txt file with PKGi PSP database format
|
||||
"""
|
||||
psp_platform = db_platform_handler.get_platform_by_fs_slug(UPS.PSP)
|
||||
psp_platform = db_platform_handler.get_platform_by_slug(UPS.PSP)
|
||||
if not psp_platform:
|
||||
raise HTTPException(
|
||||
status_code=404, detail="PlayStation Portable platform not found"
|
||||
@@ -499,7 +499,7 @@ def fpkgi_feed(request: Request, platform_slug: str) -> Response:
|
||||
Returns:
|
||||
Response: JSON file in FPKGi format
|
||||
"""
|
||||
platform = db_platform_handler.get_platform_by_fs_slug(platform_slug)
|
||||
platform = db_platform_handler.get_platform_by_slug(platform_slug)
|
||||
if not platform:
|
||||
raise HTTPException(
|
||||
status_code=404, detail=f"Platform {platform_slug} not found"
|
||||
@@ -545,7 +545,7 @@ def kekatsu_ds_feed(request: Request, platform_slug: str) -> Response:
|
||||
Returns:
|
||||
Response: Text file with Kekatsu DS database format
|
||||
"""
|
||||
platform = db_platform_handler.get_platform_by_fs_slug(platform_slug)
|
||||
platform = db_platform_handler.get_platform_by_slug(platform_slug)
|
||||
if not platform:
|
||||
raise HTTPException(
|
||||
status_code=404, detail=f"Platform {platform_slug} not found"
|
||||
|
||||
@@ -80,6 +80,16 @@ class DBPlatformsHandler(DBBaseHandler):
|
||||
) -> Platform | None:
|
||||
return session.scalar(query.filter_by(fs_slug=fs_slug).limit(1))
|
||||
|
||||
@begin_session
|
||||
@with_firmware
|
||||
def get_platform_by_slug(
|
||||
self,
|
||||
slug: str,
|
||||
query: Query = None, # type: ignore
|
||||
session: Session = None, # type: ignore
|
||||
) -> Platform | None:
|
||||
return session.scalar(query.filter_by(slug=slug).limit(1))
|
||||
|
||||
@begin_session
|
||||
def delete_platform(
|
||||
self,
|
||||
|
||||
Reference in New Issue
Block a user