import { guard } from '@/lib/auth/guard'; import { syncHolidays } from '@/lib/holidays/sync'; export const dynamic = 'force-dynamic'; /** * Manual trigger for the holiday sync, as the spec asks for. * * Behind /api/admin, so the middleware requires a session and refuses a write * from a read-only account; the guard repeats both checks inside the handler. */ export async function POST(request: Request) { const gate = await guard(request); if ('response' in gate) { return gate.response; } const result = await syncHolidays(); return Response.json(result, { status: result.ok ? 200 : 502 }); }