added filter task by category name

parent 9cdc64ec
......@@ -17,9 +17,13 @@ ctrl = TaskController()
async def get_tasks(
title: str | None = None,
status: str | None = None,
category: str | None = None,
priority: str | None = None
):
return await ctrl.get_list(title=title, status=status, priority=priority)
return await ctrl.get_list(
title=title, status=status,
category=category, priority=priority
)
@router.get('/{id}')
......
......@@ -61,6 +61,7 @@ class TaskRepository(BaseRepository):
self,
title: str | None = None,
status: str | None = None,
category: str | None = None,
priority: str | None = None
):
query = self.model
......@@ -71,6 +72,9 @@ class TaskRepository(BaseRepository):
if status is not None:
query = query.filter(status__name__icontains=status)
if category is not None:
query = query.filter(category__name__icontains=category)
if priority is not None:
query = query.filter(priority=priority)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment