import { checkClipWindowsAction } from "../../../storage/actions"; import { jobResponse, ops, optBool, optString, reqVideoId } from "../_lib"; export const dynamic = "force-dynamic"; // POST { slug?: string, video?: string, dryRun?: boolean } // -> { ok: true, jobId } // // AN ADAPTER onto the action the /storage button posts: probe every fetched // clip window in one video (`video`, within `slug`), one channel or the // corpus, and set aside the ones whose picture runs off their sound as // `-.desynced.` — never deleted. `dryRun` only lists them. See // lib/clipWindowSync.ts for the rule and its measured numbers. export async function POST(request: Request) { return ops(request, ["slug", "video", "dryRun"], async (body) => { const slug = optString(body, "slug"); const video = body.video === undefined ? undefined : reqVideoId(body, "video"); const dryRun = optBool(body, "dryRun"); return jobResponse( await checkClipWindowsAction({ ...(slug ? { slug } : {}), ...(video ? { video } : {}), ...(dryRun ? { dryRun: true } : {}), }), ); }); }