From 74232d36327660e0feede7ba50c8f8be1fcd23c9 Mon Sep 17 00:00:00 2001 From: Taylor Grafft Date: Wed, 29 Nov 2023 09:57:27 -0600 Subject: [PATCH 1/3] adding addtional logging for project uuid upon deletion --- geoapi/routes/projects.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/geoapi/routes/projects.py b/geoapi/routes/projects.py index 379fe576..72d99812 100644 --- a/geoapi/routes/projects.py +++ b/geoapi/routes/projects.py @@ -208,9 +208,15 @@ def get(self, projectId: int): @project_admin_or_creator_permissions def delete(self, projectId: int): u = request.current_user - logger.info("Delete project:{} for user:{}".format(projectId, - u.username)) - return ProjectsService.delete(db_session, u, projectId) + # Retrieve the project using the projectId to get its UUID + project = ProjectsService.get(db_session, project_id=projectId, user=u) + # Check if the project exists and log the information including the UUID + if project: + logger.info("Delete project:{} with UUID:{} for user:{}".format( + projectId, project.uuid, u.username)) + return ProjectsService.delete(db_session, u, projectId) + else: + abort(404, "Project not found") @api.doc(id="updateProject", description="Update metadata about a project") From 73cadc860beff23a532c4424d0569deddea0a41a Mon Sep 17 00:00:00 2001 From: Taylor Grafft Date: Wed, 29 Nov 2023 10:23:45 -0600 Subject: [PATCH 2/3] fixing linting issue --- geoapi/routes/projects.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/geoapi/routes/projects.py b/geoapi/routes/projects.py index 72d99812..66103d75 100644 --- a/geoapi/routes/projects.py +++ b/geoapi/routes/projects.py @@ -213,7 +213,7 @@ def delete(self, projectId: int): # Check if the project exists and log the information including the UUID if project: logger.info("Delete project:{} with UUID:{} for user:{}".format( - projectId, project.uuid, u.username)) + projectId, project.uuid, u.username)) return ProjectsService.delete(db_session, u, projectId) else: abort(404, "Project not found") From 580e3d50a93c74f4119b45866b7bf3e36ebc5000 Mon Sep 17 00:00:00 2001 From: Taylor Grafft Date: Thu, 30 Nov 2023 11:54:30 -0600 Subject: [PATCH 3/3] changing logging message from UUID to project_uuid and removing 404 check --- geoapi/routes/projects.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/geoapi/routes/projects.py b/geoapi/routes/projects.py index 66103d75..09b68486 100644 --- a/geoapi/routes/projects.py +++ b/geoapi/routes/projects.py @@ -210,13 +210,9 @@ def delete(self, projectId: int): u = request.current_user # Retrieve the project using the projectId to get its UUID project = ProjectsService.get(db_session, project_id=projectId, user=u) - # Check if the project exists and log the information including the UUID - if project: - logger.info("Delete project:{} with UUID:{} for user:{}".format( + logger.info("Delete project:{} with project_uuid:{} for user:{}".format( projectId, project.uuid, u.username)) - return ProjectsService.delete(db_session, u, projectId) - else: - abort(404, "Project not found") + return ProjectsService.delete(db_session, u, projectId) @api.doc(id="updateProject", description="Update metadata about a project")