Added search by device
This commit is contained in:
parent
e9e9e3784a
commit
1beca94cc0
@ -46,9 +46,10 @@ def zipfiles(filenames, save_name: str) -> Response:
|
|||||||
|
|
||||||
|
|
||||||
@app.get("/saves", response_class=UJSONResponse, response_model=Dict[str, StardewSave], description="Get all available game saves")
|
@app.get("/saves", response_class=UJSONResponse, response_model=Dict[str, StardewSave], description="Get all available game saves")
|
||||||
async def saves_get(apikey: APIKey = Depends(get_api_key)):
|
async def saves_get(device: Union[str, None] = None, apikey: APIKey = Depends(get_api_key)):
|
||||||
|
|
||||||
saves_entries = list(col_saves.find({"user": user_by_key(apikey)}))
|
user = user_by_key(apikey)
|
||||||
|
saves_entries = list(col_saves.find({"user": user})) if device is None else list(col_saves.find({"user": user_by_key(apikey), "user": user}))
|
||||||
|
|
||||||
if len(saves_entries) == 0:
|
if len(saves_entries) == 0:
|
||||||
raise HTTPException(HTTP_404_NOT_FOUND, detail="Could not find any saves.")
|
raise HTTPException(HTTP_404_NOT_FOUND, detail="Could not find any saves.")
|
||||||
|
Loading…
Reference in New Issue
Block a user