fix(tasks): support status query param in list API and use it in today-tasks widget

The dashboard widget was filtering with a broken filter=status!=done query
param that the list API never interpreted, so completed tasks could appear.
Add a status= todo,in_progress filter to GET /api/tasks and update the widget
to use it (also fix domain badge to use domainId).
This commit is contained in:
2026-08-06 13:53:29 +00:00
parent affdf1661d
commit 2bb28fe65f
2 changed files with 9 additions and 3 deletions
+5
View File
@@ -34,6 +34,7 @@ export const GET = withAuth(async (request: NextRequest, _user) => {
const page = Math.max(1, parseInt(searchParams.get('page') || '1'));
const perPage = Math.min(100, Math.max(1, parseInt(searchParams.get('perPage') || '50')));
const filter = searchParams.get('filter') || undefined;
const status = searchParams.get('status');
const sort = searchParams.get('sort') || '-created';
const domainId = searchParams.get('domain') || undefined;
@@ -54,6 +55,10 @@ export const GET = withAuth(async (request: NextRequest, _user) => {
const conditions: any[] = [isNull(tasks.deletedAt)];
if (domainId) conditions.push(eq(tasks.domainId, domainId));
if (status) {
const statuses = status.split(',');
conditions.push(inArray(tasks.status, statuses as any));
}
if (filter) {
conditions.push(
or(