From fdb4cc98e8166b7faa835f97377b3f54cf233611 Mon Sep 17 00:00:00 2001 From: emmatveev Date: Sun, 24 Nov 2024 23:10:05 +0300 Subject: [PATCH] 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)