diff --git a/Docs/tasks.md b/Docs/tasks.md index 1a9fedf..315d64d 100644 --- a/Docs/tasks.md +++ b/Docs/tasks.md @@ -1,11 +1,3 @@ -### Task 4: Fix `Config Backup Create` API Test -**Test Result:** FAIL — Expected status: 201, got 200 -**File:** `tests/robot/api/config.robot` and `src/server/api/config.py` -**Instructions:** -The test expects HTTP 201 Created for POST `/api/config/backups`, but the endpoint returns 200. Open `src/server/api/config.py`, find the `create_backup` function, and change the response status code to 201. Use `status_code=status.HTTP_201_CREATED` on the route decorator or return a `JSONResponse` with status 201. - ---- - ### Task 5: Fix `Config Backup List` API Test **Test Result:** FAIL — Expected status: 200, got 201 (caused by preceding POST returning 200 instead of 201) **File:** `tests/robot/api/config.robot` and `src/server/api/config.py` diff --git a/src/server/api/config.py b/src/server/api/config.py index a7eb940..548804f 100644 --- a/src/server/api/config.py +++ b/src/server/api/config.py @@ -108,17 +108,18 @@ def validate_config( ) from e -@router.get("/backups", response_model=List[Dict[str, object]]) +@router.get("/backups", response_model=Dict[str, List[Dict[str, object]]]) def list_backups( auth: dict = Depends(require_auth) -) -> List[Dict[str, object]]: +) -> Dict[str, List[Dict[str, object]]]: """List all available configuration backups. Returns list of backup metadata including name, size, and created time. """ try: config_service = get_config_service() - return config_service.list_backups() + backups = config_service.list_backups() + return {"backups": backups} except ConfigServiceError as e: raise HTTPException( status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,