diff --git a/app/api/leantime/tasks/route.ts b/app/api/leantime/tasks/route.ts index 83b1caca..dc04caab 100644 --- a/app/api/leantime/tasks/route.ts +++ b/app/api/leantime/tasks/route.ts @@ -13,7 +13,9 @@ interface Task { details: string | null; createdOn: string; editedOn: string | null; - assignedTo: number[]; + editorId: string; + editorFirstname: string; + editorLastname: string; } async function getLeantimeUserId(email: string): Promise { @@ -152,8 +154,10 @@ export async function GET(request: NextRequest) { const tasks = data.result .filter((task: any) => - // Only include tasks assigned to the user - Array.isArray(task.assignedTo) && task.assignedTo.includes(userId) + // Include tasks where the user is the editor + task.editorId === userId.toString() || + // Or tasks explicitly assigned to the user (if assignedTo exists) + (Array.isArray(task.assignedTo) && task.assignedTo.includes(userId)) ) .map((task: any) => ({ id: task.id.toString(), @@ -166,7 +170,9 @@ export async function GET(request: NextRequest) { details: task.description || null, createdOn: task.dateCreated, editedOn: task.editedOn || null, - assignedTo: Array.isArray(task.assignedTo) ? task.assignedTo : [] + editorId: task.editorId, + editorFirstname: task.editorFirstname, + editorLastname: task.editorLastname })); // Sort tasks by creation date (oldest first) diff --git a/components/flow.tsx b/components/flow.tsx index e70cf53c..8f96b403 100644 --- a/components/flow.tsx +++ b/components/flow.tsx @@ -15,7 +15,6 @@ interface Task { projectName: string; type: string; status: number; - assignedTo: number[]; editorId: string; editorFirstname: string | null; editorLastname: string | null; @@ -103,8 +102,7 @@ export function Flow() { .filter((task: Task) => task.headline && typeof task.headline === 'string' && - task.status !== 5 && // Not done - Array.isArray(task.assignedTo) && task.assignedTo.length > 0 // Has assignments + task.status !== 5 // Not done ) .sort((a: Task, b: Task) => { // First sort by status (new tasks first)