diff --git a/app/api/missions/[missionId]/route.ts b/app/api/missions/[missionId]/route.ts index 6d0cb256..1e72168d 100644 --- a/app/api/missions/[missionId]/route.ts +++ b/app/api/missions/[missionId]/route.ts @@ -4,7 +4,6 @@ import { authOptions } from "@/app/api/auth/options"; import { prisma } from '@/lib/prisma'; import { deleteMissionLogo } from '@/lib/mission-uploads'; import { getPublicUrl, S3_CONFIG } from '@/lib/s3'; -import { IntegrationService } from '@/lib/services/integration-service'; // Helper function to check authentication async function checkAuth(request: Request) { @@ -282,38 +281,6 @@ export async function DELETE(request: Request, props: { params: Promise<{ missio return NextResponse.json({ error: 'Mission not found or not authorized to delete' }, { status: 404 }); } - // Initialize integration service to clean up external resources - const integrationService = new IntegrationService(); - - // Extract integration IDs - const leantimeProjectId = mission.leantimeProjectId ? parseInt(mission.leantimeProjectId) : undefined; - const outlineCollectionId = mission.outlineCollectionId || undefined; - const rocketChatChannelId = mission.rocketChatChannelId || undefined; - const giteaRepositoryUrl = mission.giteaRepositoryUrl || undefined; - - // Log the external resources being cleaned up - console.log('Cleaning up external resources for mission:', { - missionId, - leantimeProjectId, - outlineCollectionId, - rocketChatChannelId, - giteaRepositoryUrl - }); - - try { - // Perform rollback of all external integrations - await integrationService.rollbackIntegrations( - leantimeProjectId, - outlineCollectionId, - rocketChatChannelId, - giteaRepositoryUrl - ); - console.log('Successfully cleaned up external resources for mission:', missionId); - } catch (integrationError) { - console.error('Error cleaning up external integrations:', integrationError); - // Continue with mission deletion even if integration cleanup fails - } - // Delete logo if exists if (mission.logo) { try {