Skip to content

Commit aead9a7

Browse files
committed
Fix of the other fix
1 parent 6c59363 commit aead9a7

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/api/api.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,13 +223,14 @@ async def get_camera(camera_id: int):
223223
@self.app.put("/cameras/{camera_id}")
224224
async def update_camera(camera_id: int, updated_fields: Request):
225225
try:
226+
updated_fields = await updated_fields.json()
227+
226228
if not isinstance(updated_fields, dict):
227229
raise HTTPException(
228230
status_code=400,
229231
detail="Request body must be a JSON dict"
230232
)
231-
232-
updated_fields = await updated_fields.json()
233+
233234
camera = self.db_manager.update_camera(camera_id, updated_fields)
234235

235236
if camera is None:
@@ -251,13 +252,14 @@ async def update_camera(camera_id: int, updated_fields: Request):
251252
@self.app.put("/zones/{zone_id}")
252253
async def update_zone(zone_id: int, updated_fields: Request):
253254
try:
255+
updated_fields = await updated_fields.json()
256+
254257
if not isinstance(updated_fields, dict):
255258
raise HTTPException(
256259
status_code=400,
257260
detail="Request body must be a JSON dict"
258261
)
259262

260-
updated_fields = await updated_fields.json()
261263
zone = self.db_manager.update_zone(zone_id, updated_fields)
262264

263265
if zone is None:

0 commit comments

Comments
 (0)