fix
This commit is contained in:
parent
903a77102c
commit
fdb4cc98e8
@ -1,3 +1,4 @@
|
|||||||
|
import bson
|
||||||
import fastapi
|
import fastapi
|
||||||
import pydantic
|
import pydantic
|
||||||
|
|
||||||
@ -37,14 +38,14 @@ async def post(body: RequestPostBody):
|
|||||||
|
|
||||||
@router.put('/api/v1/experiments', status_code=fastapi.status.HTTP_202_ACCEPTED, responses={404: {'description': 'Not found'}})
|
@router.put('/api/v1/experiments', status_code=fastapi.status.HTTP_202_ACCEPTED, responses={404: {'description': 'Not found'}})
|
||||||
async def put(body: RequestPutBody):
|
async def put(body: RequestPutBody):
|
||||||
changed = await experiments.update(id=body.id, enabled=body.enabled, condition=body.condition)
|
changed = await experiments.update(id=bson.ObjectId(body.id), enabled=body.enabled, condition=body.condition)
|
||||||
if not changed:
|
if not changed:
|
||||||
raise fastapi.HTTPException(404)
|
raise fastapi.HTTPException(404)
|
||||||
|
|
||||||
|
|
||||||
@router.delete('/api/v1/experiments', status_code=fastapi.status.HTTP_202_ACCEPTED, responses={404: {'description': 'Not found'}})
|
@router.delete('/api/v1/experiments', status_code=fastapi.status.HTTP_202_ACCEPTED, responses={404: {'description': 'Not found'}})
|
||||||
async def delete(body: RequestDeleteBody):
|
async def delete(body: RequestDeleteBody):
|
||||||
changed = await experiments.delete(id=body.id)
|
changed = await experiments.delete(id=bson.ObjectId(body.id))
|
||||||
if not changed:
|
if not changed:
|
||||||
raise fastapi.HTTPException(404)
|
raise fastapi.HTTPException(404)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user