Added client arg to PATCH /devices/{name}
This commit is contained in:
parent
14d1ba9fa7
commit
30f11a7c83
@ -68,7 +68,7 @@ async def devices_post(name: str, os: str, client: str, apikey: APIKey = Depends
|
|||||||
return Response(status_code=HTTP_204_NO_CONTENT)
|
return Response(status_code=HTTP_204_NO_CONTENT)
|
||||||
|
|
||||||
@app.patch("/devices/{name}", description="Update name of the existing device")
|
@app.patch("/devices/{name}", description="Update name of the existing device")
|
||||||
async def devices_patch(name: str, new_name: str, os: str, apikey: APIKey = Depends(get_api_key)):
|
async def devices_patch(name: str, new_name: str, os: str, client: str, apikey: APIKey = Depends(get_api_key)):
|
||||||
|
|
||||||
user = user_by_key(apikey)
|
user = user_by_key(apikey)
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ async def devices_patch(name: str, new_name: str, os: str, apikey: APIKey = Depe
|
|||||||
if col_devices.find_one({"user": user, "name": new_name}) is not None:
|
if col_devices.find_one({"user": user, "name": new_name}) is not None:
|
||||||
raise HTTPException(HTTP_409_CONFLICT, detail="Device with this name already exists.")
|
raise HTTPException(HTTP_409_CONFLICT, detail="Device with this name already exists.")
|
||||||
|
|
||||||
col_devices.find_one_and_update({"user": user, "name": name}, {"$set": {"name": new_name, "os": os}})
|
col_devices.find_one_and_update({"user": user, "name": name}, {"$set": {"name": new_name, "os": os, "client": client}})
|
||||||
col_saves.update_many({"user": user, "device": name}, {"$set": {"device": new_name}})
|
col_saves.update_many({"user": user, "device": name}, {"$set": {"device": new_name}})
|
||||||
|
|
||||||
return Response(status_code=HTTP_204_NO_CONTENT)
|
return Response(status_code=HTTP_204_NO_CONTENT)
|
Loading…
Reference in New Issue
Block a user