import { NextResponse } from "next/server"; import { reverifyLiveRecordingAction } from "../../../channels/[slug]/liveMediaActions"; import { forgetAttention } from "../_attention"; import { ops, opsFail, reqSlug, reqString } from "../_lib"; export const dynamic = "force-dynamic"; // POST { slug, id, startedAt? } -> { ok: true, verified, why?, removed } // // THE LANDING'S CHECK, AGAIN (controller/recordLive.ts reverifyLiveLanding): // a recording whose landed file is `failed` or `pending` against the stream // files it was made from is checked once more. Verified, and the stream // confirmed done, those stream files, their state and fragments go; else the // row says why and nothing is removed. The row's Verify button. export async function POST(request: Request) { return ops(request, ["slug", "id", "startedAt"], async (body) => { const slug = reqSlug(body, "slug"); const id = reqString(body, "id"); const r = await reverifyLiveRecordingAction({ slug, id, ...(typeof body.startedAt === "string" ? { startedAt: body.startedAt } : {}) }); if (!r.ok) return opsFail(r.error); forgetAttention(); return NextResponse.json(r); }); }