From 7a5e68f0c889c785bf0bcaaaf50a5ee6a5ecc206 Mon Sep 17 00:00:00 2001 From: alma Date: Fri, 23 May 2025 17:21:18 +0200 Subject: [PATCH] W n8n --- app/api/missions/route.ts | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/app/api/missions/route.ts b/app/api/missions/route.ts index a0b520f2..f168f513 100644 --- a/app/api/missions/route.ts +++ b/app/api/missions/route.ts @@ -296,7 +296,44 @@ export async function POST(request: Request) { }, { status: 500 }); } - return NextResponse.json(workflowResult); + // Process the workflow result + const results = workflowResult.results || {}; + return NextResponse.json({ + success: true, + status: 'success', + message: 'Mission created successfully', + mission: { + name: n8nData.name, + oddScope: n8nData.oddScope, + niveau: n8nData.niveau, + intention: n8nData.intention, + missionType: n8nData.missionType, + donneurDOrdre: n8nData.donneurDOrdre, + projection: n8nData.projection, + services: n8nData.services, + profils: n8nData.profils, + participation: n8nData.participation, + creatorId: n8nData.creatorId, + logo: n8nData.logo, + leantimeProjectId: results.leantimeProjectId, + outlineCollectionId: results.outlineCollectionId, + rocketChatChannelId: results.rocketChatChannelId, + giteaRepositoryUrl: results.giteaRepositoryUrl, + penpotProjectId: results.penpotProjectId + }, + integrationStatus: { + gitRepo: !!results.giteaRepositoryUrl, + leantimeProject: !!results.leantimeProjectId, + docCollection: !!results.outlineCollectionId, + rocketChatChannel: !!results.rocketChatChannelId + }, + resourceStatus: { + gitRepo: !!results.giteaRepositoryUrl, + leantimeProject: !!results.leantimeProjectId, + docCollection: !!results.outlineCollectionId, + rocketChatChannel: !!results.rocketChatChannelId + } + }); } catch (error) { console.error('Error triggering n8n workflow:', error);