From 06ace8756c28867f91b9a49861b1f8d4dab553c3 Mon Sep 17 00:00:00 2001 From: Niraj Adhikari Date: Tue, 12 Dec 2023 17:06:46 +0545 Subject: [PATCH 1/2] delete projects api made authenticated --- src/backend/app/projects/project_routes.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/backend/app/projects/project_routes.py b/src/backend/app/projects/project_routes.py index 8522aa3b95..73cf134b72 100644 --- a/src/backend/app/projects/project_routes.py +++ b/src/backend/app/projects/project_routes.py @@ -44,6 +44,7 @@ from shapely.geometry import mapping, shape from shapely.ops import unary_union from sqlalchemy.orm import Session +from app.auth.osm import AuthUser, login_required from ..central import central_crud from ..db import database, db_models @@ -205,7 +206,10 @@ async def read_project(project_id: int, db: Session = Depends(database.get_db)): @router.delete("/delete/{project_id}") -async def delete_project(project_id: int, db: Session = Depends(database.get_db)): +async def delete_project(project_id: int, + db: Session = Depends(database.get_db), + user_data: AuthUser = Depends(login_required) + ): """Delete a project from ODK Central and the local database.""" # FIXME: should check for error From 55f4959de44dcdf69f167e2b5a14a958448c5ac5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 12 Dec 2023 11:28:46 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/backend/app/projects/project_routes.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/backend/app/projects/project_routes.py b/src/backend/app/projects/project_routes.py index 73cf134b72..ccf774cf1c 100644 --- a/src/backend/app/projects/project_routes.py +++ b/src/backend/app/projects/project_routes.py @@ -44,6 +44,7 @@ from shapely.geometry import mapping, shape from shapely.ops import unary_union from sqlalchemy.orm import Session + from app.auth.osm import AuthUser, login_required from ..central import central_crud @@ -206,10 +207,11 @@ async def read_project(project_id: int, db: Session = Depends(database.get_db)): @router.delete("/delete/{project_id}") -async def delete_project(project_id: int, - db: Session = Depends(database.get_db), - user_data: AuthUser = Depends(login_required) - ): +async def delete_project( + project_id: int, + db: Session = Depends(database.get_db), + user_data: AuthUser = Depends(login_required), +): """Delete a project from ODK Central and the local database.""" # FIXME: should check for error