import { auth } from "@/lib/auth"; import { checkIntegration, type IntegrationName } from "@/lib/settings"; const VALID: IntegrationName[] = ["claude", "postiz", "tavily", "gemini", "nextdoor"]; export async function POST(request: Request) { const session = await auth(); if (!session) return new Response("Unauthorized", { status: 401 }); const body = await request.json().catch(() => ({})); const name = body?.integration as IntegrationName | undefined; if (!name || !VALID.includes(name)) { return Response.json({ error: "integration must be one of: " + VALID.join(", ") }, { status: 400 }); } const status = await checkIntegration(name); return Response.json(status); }