import { NextResponse } from "next/server"; import { acknowledgeLiveRecordingAction } from "../../../channels/[slug]/liveMediaActions"; import { forgetAttention } from "../_attention"; import { ops, opsFail, reqSlug, reqString } from "../_lib"; export const dynamic = "force-dynamic"; // POST { slug, id, startedAt?, by? } | { slug, file, by? } -> { ok: true, acknowledged } // // A PERSON HAS SEEN IT (controller/liveRecordings.ts): every run of the record // that needs a person — failed, interrupted, or recorded from the live edge // with the stream's start lost — or the one run `startedAt` names, is // acknowledged. The rows stay in `get live-recordings`; they no longer count // in /review, the banners or the attention header. /review's Acknowledge. // `file` instead of `id`: a live-recordings.json that did not read and was set // aside under that name (the listing's `files`) has been seen — it stays. export async function POST(request: Request) { return ops(request, ["slug", "id", "file", "startedAt", "by"], async (body) => { const slug = reqSlug(body, "slug"); const file = typeof body.file === "string" && body.file.trim() ? body.file.trim() : undefined; const id = file ? undefined : reqString(body, "id"); const r = await acknowledgeLiveRecordingAction({ slug, ...(id ? { id } : {}), ...(file ? { file } : {}), ...(typeof body.startedAt === "string" ? { startedAt: body.startedAt } : {}), by: typeof body.by === "string" && body.by.trim() ? body.by.trim() : "agent:ops", }); if (!r.ok) return opsFail(r.error); forgetAttention(); return NextResponse.json(r); }); }