import { fetchPostsAction } from "../../../channels/[slug]/socialActions"; import { jobResponse, ops, optPositiveInt, optString, reqSlug } from "../_lib"; export const dynamic = "force-dynamic"; // POST { slug, limit?, queueKey? } -> { ok: true, jobId } // // RESUME BACKFILL (lib/timelineWalk.ts): a social channel's unfinished // full-history timeline walk, continued from its saved resume point // (posts-state.json's `backfill`) with no watermark — the channel page's // Resume backfill button, and fetch-posts `"backfill": true` by its own name. // Its counterpart, SYNC NEW, is a plain fetch-posts: from the top down to the // newest archived post, never touching this point. // // Refused before any job: no backfill part-way, a forum thread (its catch-up // always comes first, then its history), an X search channel (one walk), a // channel that is not a social one. On the platform's queue, as fetch-posts. export async function POST(request: Request) { return ops(request, ["slug", "limit", "queueKey"], async (body) => { const slug = reqSlug(body, "slug"); return jobResponse( await fetchPostsAction( slug, optString(body, "queueKey"), undefined, optPositiveInt(body, "limit"), undefined, undefined, undefined, undefined, undefined, undefined, true, ), ); }); }