import { listDirectorScripts, updateDirectorScript } from '~/server/utils/directorScripts' export default defineEventHandler(async (event) => { const { owner } = assertLibraryOwner(event) const id = String(getRouterParam(event, 'id') || '') const body = await readBody<{ name?: string; text?: string }>(event).catch(() => ({})) const script = await updateDirectorScript(owner, id, { name: body?.name, text: body?.text }) return { script, scripts: listDirectorScripts(owner) } })