Added device arg into search by both ID

This commit is contained in:
Profitroll 2023-01-18 14:30:14 +01:00
parent 1beca94cc0
commit 335a497991

View File

@ -87,8 +87,8 @@ async def saves_get_by_id(id: int, device: Union[str, None] = None, apikey: APIK
@app.get("/saves/{id}/{save_date}", response_class=UJSONResponse, response_model=List[StardewSave], description="Get game saves by name")
async def saves_get_by_both_ids(id: int, save_date: int, apikey: APIKey = Depends(get_api_key)):
saves_entry = col_saves.find_one({"user": user_by_key(apikey), "id": id, "date": save_date})
async def saves_get_by_both_ids(id: int, save_date: int, device: Union[str, None] = None, apikey: APIKey = Depends(get_api_key)):
saves_entry = col_saves.find_one({"user": user_by_key(apikey), "id": id, "date": save_date}) if device is None else col_saves.find_one({"user": user_by_key(apikey), "id": id, "device": device, "date": save_date})
if saves_entry is not None:
del saves_entry["_id"]
del saves_entry["files"]