import { SESSION_COOKIE } from "@autoscholar/auth"; import { logout } from "@autoscholar/core"; import { cookies } from "next/headers"; import { handler, json } from "@/lib/server/api"; import { db } from "@/lib/server/db"; import { requireAdmin } from "@/lib/server/session"; export const runtime = "nodejs"; export const POST = handler(async (req) => { await requireAdmin(req, { mutation: true, allowPendingRotation: true }); const jar = await cookies(); const token = jar.get(SESSION_COOKIE)?.value; if (token) await logout(db(), token); jar.set(SESSION_COOKIE, "", { httpOnly: true, path: "/", maxAge: 0 }); return json({ ok: true }); });