import { organisePress } from "@/lib/library/presses.mjs"; import { ask, press } from "@/lib/library/route"; import { mergeSeen } from "@/lib/library/seen.mjs"; import { REPORTS_ROOT } from "@/lib/paths.mjs"; export const dynamic = "force-dynamic"; // POST { lib, op: "rename", topic, title } -> { topic, title, was, changed, sentence } // POST { lib, op: "move", to, ids | thread, create? } -> { to, moved, skipped, sentence } // POST { lib, op: "merge", into, from: [topic, …] } -> { into, merged, posts, pages, watch, sentence, seen? } // // THE POSTS LIBRARY PAGE'S ORGANISING (lane x-trending-publish): the editor's // `organise-trending`, written as the OPERATOR's (the page's press only: // lib/library/route.ts). umtool writes no file of the library. A merge cannot // be undone; after one, umtool's own Mark seen state follows it (the earliest // of the merged topics' marks stands: lib/library/seen.mjs mergeSeen). export async function POST(request: Request) { return press(request, (body) => organisePress(ask, body, { mergeSeen: (lib: string, into: string, from: string[]) => mergeSeen(REPORTS_ROOT, { slug: lib, into, from }) })); }