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: add contributor, task state, and outline to project detail API #76

Merged
merged 1 commit into from
Jul 18, 2024

Conversation

Pradip-p
Copy link
Collaborator

Description

This PR adds the following to the project detail API:

  • Contributor information
  • Task state
  • Outline of each task
  • Also remove short description

Changes

  • Updated @router.get("/{project_id}", tags=["Projects"], response_model=project_schemas.ProjectOut) to include the new fields.
  • Updated schemas and relevant logic to handle the new data.

state: Optional[State] = None
contributor: Optional[str] = None

@validator("state", pre=True, always=True)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you get the State ?
state of the tasks are in task_events table.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nrjadkry To get the state, I am joining the tasks table with the task_events table, where the state of the tasks is stored.

    SELECT
        tasks.id AS id,
        tasks.project_task_index AS project_task_index,
        tasks.outline AS outline,
        task_events.state AS state,
        users.name AS contributor
    FROM tasks
    LEFT JOIN task_events ON tasks.id = task_events.task_id
    LEFT JOIN users ON task_events.user_id = users.id
    WHERE tasks.project_id = :project_id;
"""

@nrjadkry nrjadkry merged commit 66583a4 into main Jul 18, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants