From ea2eecc43c6b6e23cf420a8e624d6eb58cce6b62 Mon Sep 17 00:00:00 2001 From: Alma Date: Sat, 12 Apr 2025 23:44:44 +0200 Subject: [PATCH] working leantime widget 134 --- app/api/leantime/tasks/route.ts | 14 +++++++------- app/api/users/[userId]/route.ts | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/api/leantime/tasks/route.ts b/app/api/leantime/tasks/route.ts index e248b103..882aaa6c 100644 --- a/app/api/leantime/tasks/route.ts +++ b/app/api/leantime/tasks/route.ts @@ -98,7 +98,7 @@ export async function GET(request: NextRequest) { const userId = await getLeantimeUserId(session.user.email); if (!userId) { - console.error('User not found in Leantime:', session.user.email); + console.error('User not found in Leantime'); return NextResponse.json({ error: "User not found in Leantime" }, { status: 404 }); } @@ -123,13 +123,12 @@ export async function GET(request: NextRequest) { }); const responseText = await response.text(); - console.log('Raw tasks response:', responseText); + console.log('Tasks API response status:', response.status); if (!response.ok) { console.error('Failed to fetch tasks from Leantime:', { status: response.status, - statusText: response.statusText, - headers: Object.fromEntries(response.headers.entries()) + statusText: response.statusText }); throw new Error('Failed to fetch tasks from Leantime'); } @@ -138,7 +137,7 @@ export async function GET(request: NextRequest) { try { data = JSON.parse(responseText); } catch (e) { - console.error('Failed to parse tasks response:', e); + console.error('Failed to parse tasks response'); throw new Error('Invalid response format from Leantime'); } @@ -147,8 +146,9 @@ export async function GET(request: NextRequest) { throw new Error('Invalid response format from Leantime'); } - // Log the first task to see its complete structure - console.log('Sample task structure:', JSON.stringify(data.result[0], null, 2)); + // Log only the number of tasks and their IDs + console.log('Received tasks count:', data.result.length); + console.log('Task IDs:', data.result.map((task: any) => task.id)); const tasks = data.result .filter((task: any) => { diff --git a/app/api/users/[userId]/route.ts b/app/api/users/[userId]/route.ts index fc7b3415..febfabc2 100644 --- a/app/api/users/[userId]/route.ts +++ b/app/api/users/[userId]/route.ts @@ -172,6 +172,7 @@ export async function DELETE( } const userDetails = await userResponse.json(); + console.log('Processing user deletion for ID:', params.userId); // Delete user from Keycloak const deleteResponse = await fetch(