Merge pull request 'master' (#14) from master into dev
Reviewed-on: #14
This commit is contained in:
commit
73569e0839
@ -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)
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ class PlatformStaff(pydantic.BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
class ResponseBody(pydantic.BaseModel):
|
class ResponseBody(pydantic.BaseModel):
|
||||||
configs: dict[str, dict]
|
configs: dict[str, dict|list]
|
||||||
experiments: dict[str, ExperimentData]
|
experiments: dict[str, ExperimentData]
|
||||||
platform_staff: PlatformStaff
|
platform_staff: PlatformStaff
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user