From 903a77102c785afaf072f79abb44fe326a5b6098 Mon Sep 17 00:00:00 2001 From: emmatveev Date: Sun, 24 Nov 2024 21:08:19 +0300 Subject: [PATCH 1/2] fix --- app/routers/fetch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/routers/fetch.py b/app/routers/fetch.py index ee96b69..8dbd552 100644 --- a/app/routers/fetch.py +++ b/app/routers/fetch.py @@ -20,7 +20,7 @@ class PlatformStaff(pydantic.BaseModel): class ResponseBody(pydantic.BaseModel): - configs: dict[str, dict] + configs: dict[str, dict|list] experiments: dict[str, ExperimentData] platform_staff: PlatformStaff -- 2.45.2 From fdb4cc98e8166b7faa835f97377b3f54cf233611 Mon Sep 17 00:00:00 2001 From: emmatveev Date: Sun, 24 Nov 2024 23:10:05 +0300 Subject: [PATCH 2/2] fix --- app/routers/experiments.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/routers/experiments.py b/app/routers/experiments.py index a531114..4dcd35b 100644 --- a/app/routers/experiments.py +++ b/app/routers/experiments.py @@ -1,3 +1,4 @@ +import bson import fastapi 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'}}) 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: raise fastapi.HTTPException(404) @router.delete('/api/v1/experiments', status_code=fastapi.status.HTTP_202_ACCEPTED, responses={404: {'description': 'Not found'}}) async def delete(body: RequestDeleteBody): - changed = await experiments.delete(id=body.id) + changed = await experiments.delete(id=bson.ObjectId(body.id)) if not changed: raise fastapi.HTTPException(404) -- 2.45.2