Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added project name to the user tasks query #238

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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