Skip to content

Commit

Permalink
refactor(backend): improve error message if no project submissions pr…
Browse files Browse the repository at this point in the history
…esent (#1696)

* refactor: update create_project endpoints to hyphen create-project

* refactor: more informative error message if no project submissions
  • Loading branch information
spwoodcock authored Jul 23, 2024
1 parent 264fc14 commit 565749f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/backend/app/central/central_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ async def convert_odk_submission_json_to_geojson(
if not submission_json:
raise HTTPException(
status_code=HTTPStatus.UNPROCESSABLE_ENTITY,
detail="Loading JSON submission failed",
detail="Project contains no submissions yet",
)

all_features = []
Expand Down
2 changes: 1 addition & 1 deletion src/backend/app/projects/project_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ async def delete_project(
return Response(status_code=HTTPStatus.NO_CONTENT)


@router.post("/create_project", response_model=project_schemas.ProjectOut)
@router.post("/create-project", response_model=project_schemas.ProjectOut)
async def create_project(
project_info: project_schemas.ProjectUpload,
org_user_dict: OrgUserDict = Depends(org_admin),
Expand Down
2 changes: 1 addition & 1 deletion src/backend/tests/test_projects_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ async def test_create_project(client, admin_user, organisation):
project_data.update(**odk_creds_models.model_dump())

response = client.post(
f"/projects/create_project?org_id={organisation.id}", json=project_data
f"/projects/create-project?org_id={organisation.id}", json=project_data
)

if response.status_code != 200:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const SplitTasks = ({ flag, geojsonFile, setGeojsonFile, customDataExtractUpload

dispatch(
CreateProjectService(
`${import.meta.env.VITE_API_URL}/projects/create_project?org_id=${projectDetails.organisation_id}`,
`${import.meta.env.VITE_API_URL}/projects/create-project?org_id=${projectDetails.organisation_id}`,
projectData,
taskAreaGeojsonFile,
customFormFile,
Expand Down

0 comments on commit 565749f

Please sign in to comment.