From ea96b1d416911e592f14875aecde011b7be2184a Mon Sep 17 00:00:00 2001 From: alma Date: Sat, 24 May 2025 18:11:53 +0200 Subject: [PATCH] W n8n attention vm --- app/api/missions/route.ts | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/app/api/missions/route.ts b/app/api/missions/route.ts index d4719b34..e32340a3 100644 --- a/app/api/missions/route.ts +++ b/app/api/missions/route.ts @@ -231,10 +231,22 @@ export async function POST(request: Request) { // Only create mission in database after n8n succeeds try { + // Log the entire workflow result + console.log('N8N Workflow Result:', JSON.stringify(workflowResult, null, 2)); + + // Extract logo path from workflow result + let logoPath = null; + if (workflowResult.data && Array.isArray(workflowResult.data)) { + const firstResult = workflowResult.data[0]; + if (firstResult && firstResult.logoPath) { + logoPath = firstResult.logoPath; + } + } + console.log('Creating mission with data:', { name: body.name, - logoPath: body.logoPath, - logo: body.logo + logoPath, + workflowResult: workflowResult }); const missionData = { @@ -249,7 +261,7 @@ export async function POST(request: Request) { profils: body.profils, participation: body.participation, creatorId: userId, - logo: body.logoPath ? `missions/${body.logoPath}` : null // Ensure proper path format + logo: logoPath ? `missions/${logoPath}` : null }; console.log('Mission data to be saved:', missionData); @@ -260,7 +272,8 @@ export async function POST(request: Request) { console.log('Mission created with logo:', { missionId: mission.id, - logo: mission.logo + logo: mission.logo, + fullMission: mission }); return NextResponse.json({