diff --git a/app/api/pax8/sync/route.ts b/app/api/pax8/sync/route.ts index 60ae938..94b3a30 100644 --- a/app/api/pax8/sync/route.ts +++ b/app/api/pax8/sync/route.ts @@ -3,6 +3,16 @@ import { getPax8SyncService } from '@/lib/services/pax8-sync-service'; import postgresClient from '@/lib/services/postgres-client'; export async function POST(req: NextRequest) { + const disabledRes = await postgresClient.query<{ disabled: boolean }>( + `SELECT disabled FROM integration_settings WHERE key = 'pax8'` + ); + if (disabledRes.rows[0]?.disabled === true) { + return NextResponse.json( + { error: 'PAX8 is disabled', message: 'PAX8 sync is disabled via /admin/integrations' }, + { status: 403 } + ); + } + const body = await req.json().catch(() => ({})); const triggeredBy = body.triggeredBy || 'manual';