import { NextResponse } from "next/server"; import { toggleDoNotCleanAction } from "../../../channels/[slug]/videos/[id]/videoActions"; import { ops, opsFail, optBool, reqSlug, reqVideoId } from "../_lib"; export const dynamic = "force-dynamic"; // POST { slug, id, keep?: boolean } // // One video's "Do not clean" marker (do-not-clean.json), set to the value // given — `keep` defaults to true; false removes it. Set, not toggled: a retry // of the same body is the same answer. The cleanup sweeps skip a marked // video's audio. `keep-videos` is the bulk form, by title/description match. export async function POST(request: Request) { return ops(request, ["slug", "id", "keep"], async (body) => { const res = await toggleDoNotCleanAction( reqSlug(body, "slug"), reqVideoId(body, "id"), optBool(body, "keep") ?? true, ); if (!res.ok) return opsFail(res.error); return NextResponse.json({ ok: true }); }); }