import type { VodRecord } from "@futureporn/types"; import { configs } from "../config.ts"; export default async function patchVodInDatabase(vod_id: string, payload: Partial): Promise { const url = `${configs.postgrestUrl}/vods?id=eq.${vod_id}` const fetchOptions = { method: 'PATCH', headers: { 'Authorization': `Bearer ${configs.automationUserJwt}`, 'Content-Type': 'application/json', 'Prefer': 'return=headers-only' }, body: JSON.stringify(payload) } const res = await fetch(url, fetchOptions) if (!res.ok) { const body = await res.json() throw new Error(`Problem during patchVodInDatabase. res.status=${res.status}, res.statusText=${res.statusText}`) } return }