Fix #10: list_tasks API now accepts project_slug query param (used by Picogent)
Some checks failed
Deploy Tracker / deploy (push) Failing after 4s
Some checks failed
Deploy Tracker / deploy (push) Failing after 4s
This commit is contained in:
parent
5dfd83c28f
commit
b930ca1155
@ -193,6 +193,7 @@ async def _resolve_member(db: AsyncSession, member_id: str) -> Member:
|
|||||||
@router.get("/tasks", response_model=list[TaskOut])
|
@router.get("/tasks", response_model=list[TaskOut])
|
||||||
async def list_tasks(
|
async def list_tasks(
|
||||||
project_id: Optional[str] = Query(None),
|
project_id: Optional[str] = Query(None),
|
||||||
|
project_slug: Optional[str] = Query(None),
|
||||||
status: Optional[str] = Query(None),
|
status: Optional[str] = Query(None),
|
||||||
assignee_id: Optional[str] = Query(None),
|
assignee_id: Optional[str] = Query(None),
|
||||||
label: Optional[str] = Query(None),
|
label: Optional[str] = Query(None),
|
||||||
@ -206,6 +207,11 @@ async def list_tasks(
|
|||||||
)
|
)
|
||||||
if project_id:
|
if project_id:
|
||||||
q = q.where(Task.project_id == uuid.UUID(project_id))
|
q = q.where(Task.project_id == uuid.UUID(project_id))
|
||||||
|
elif project_slug:
|
||||||
|
result = await db.execute(select(Project).where(Project.slug == project_slug))
|
||||||
|
project = result.scalar_one_or_none()
|
||||||
|
if project:
|
||||||
|
q = q.where(Task.project_id == project.id)
|
||||||
if status:
|
if status:
|
||||||
q = q.where(Task.status == status)
|
q = q.where(Task.status == status)
|
||||||
if assignee_id:
|
if assignee_id:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user