From 1c33145f9957d4980fc21b5f736683212459e289 Mon Sep 17 00:00:00 2001 From: Pradip-p Date: Thu, 26 Sep 2024 10:13:52 +0545 Subject: [PATCH] feat: added project name list tasks based on user endpoint --- src/backend/app/tasks/task_schemas.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/backend/app/tasks/task_schemas.py b/src/backend/app/tasks/task_schemas.py index 12cba359..596e75b0 100644 --- a/src/backend/app/tasks/task_schemas.py +++ b/src/backend/app/tasks/task_schemas.py @@ -149,6 +149,7 @@ class UserTasksStatsOut(BaseModel): state: str project_id: uuid.UUID project_task_index: int + project_name: str @staticmethod async def get_tasks_by_user( @@ -160,6 +161,7 @@ async def get_tasks_by_user( tasks.id AS task_id, tasks.project_task_index AS project_task_index, task_events.project_id AS project_id, + projects.name AS project_name, ST_Area(ST_Transform(tasks.outline, 3857)) / 1000000 AS task_area, task_events.created_at, CASE @@ -173,6 +175,8 @@ async def get_tasks_by_user( task_events LEFT JOIN tasks ON task_events.task_id = tasks.id + LEFT JOIN + projects ON task_events.project_id = projects.id WHERE ( %(role)s = 'DRONE_PILOT' AND task_events.user_id = %(user_id)s