Skip to content

Commit

Permalink
Merge pull request #238 from hotosm/feat/add-project-name
Browse files Browse the repository at this point in the history
feat: added project name to the user tasks query
  • Loading branch information
nrjadkry authored Sep 26, 2024
2 parents d73e32c + 1c33145 commit 179770c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/backend/app/tasks/task_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 179770c

Please sign in to comment.