From 2be19ea579bcd19896cdf8508a0a8bcf6cc53003 Mon Sep 17 00:00:00 2001 From: alma Date: Fri, 23 May 2025 17:24:58 +0200 Subject: [PATCH] W n8n --- app/api/missions/route.ts | 7 +++++-- lib/services/n8n-service.ts | 22 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/app/api/missions/route.ts b/app/api/missions/route.ts index f168f513..8231504c 100644 --- a/app/api/missions/route.ts +++ b/app/api/missions/route.ts @@ -469,11 +469,14 @@ export async function POST(request: Request) { rocketChatChannel: !!missionResponse.rocketChatChannelId }, resourceStatus: { - gitRepo: true, + gitRepo: false, leantimeProject: true, docCollection: true, rocketChatChannel: true - } + }, + errors: [ + 'Git repository creation failed: Unknown error' + ] }); } catch (error) { console.error('Error creating mission:', error); diff --git a/lib/services/n8n-service.ts b/lib/services/n8n-service.ts index d814fe07..f657dc84 100644 --- a/lib/services/n8n-service.ts +++ b/lib/services/n8n-service.ts @@ -93,6 +93,28 @@ export class N8nService { try { const result = JSON.parse(responseText); console.log('Parsed workflow result:', JSON.stringify(result, null, 2)); + + // Check if the response contains error information + if (result.error || result.message?.includes('failed')) { + // Extract which services failed from the error message + const errorMessage = result.message || result.error; + const failedServices = { + gitRepo: errorMessage.includes('Git repository creation failed'), + leantimeProject: errorMessage.includes('Leantime project creation failed'), + docCollection: errorMessage.includes('Documentation collection creation failed'), + rocketChatChannel: errorMessage.includes('RocketChat channel creation failed') + }; + + // Return success with partial results + return { + success: true, + results: { + ...result, + failedServices + } + }; + } + return { success: true, results: result