feat: enhance integration setup process with error handling and validation

This commit is contained in:
2026-07-08 09:00:42 -03:00
parent f18fbc8147
commit f23029e785
4 changed files with 66 additions and 15 deletions

View File

@@ -36,12 +36,18 @@ class TenantIntegrationController extends Controller
{
$integration = Integration::where('integration_code', $integrationCode)->firstOrFail();
$tenantIntegration = $this->tenantIntegrationService->updateOrCreateIntegration(
$tenantCode,
$integration,
$request->input('integration_data', [])
);
try {
$tenantIntegration = $this->tenantIntegrationService->updateOrCreateIntegration(
$tenantCode,
$integration,
$request->input('integration_data', [])
);
return response()->json($tenantIntegration);
return response()->json($tenantIntegration);
} catch (\Exception $e) {
return response()->json([
'message' => 'Error validando la configuración: ' . $e->getMessage()
], 400);
}
}
}