spb/note-spboucher-ai
Public
1import { handler } from "@/lib/api";2import { indexStats } from "@/lib/search";3import { enqueue, QUEUES } from "@/lib/jobs";4import { audit } from "@/lib/audit";5export const GET = handler(async ({ ws }) => Response.json(await indexStats(ws.id)));6/** POST → rebuild the whole index (re-chunk + re-embed changed content; unchanged hashes are skipped). */7export const POST = handler(async ({ ws, user }) => { await enqueue(QUEUES.reindexAll, { workspaceId: ws.id }); await audit(user.id, "search.reindex"); return Response.json({ ok: true }); });8