Pause the queue after the current clip for real, and carry global locks plus labeled permanence stills through generate and shot prompts.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
export default defineEventHandler(async (event) => {
|
||||
const { owner } = assertLibraryOwner(event)
|
||||
const id = String(getRouterParam(event, 'id') || '')
|
||||
const body = await readBody<{ folderId?: string; name?: string; family?: boolean }>(event).catch(() => ({} as { folderId?: string; name?: string; family?: boolean }))
|
||||
const body = await readBody<{ folderId?: string; name?: string; family?: boolean; globalLocks?: string; permanenceRefs?: unknown }>(event).catch(() => ({} as { folderId?: string; name?: string; family?: boolean; globalLocks?: string; permanenceRefs?: unknown }))
|
||||
const folderId = String(body?.folderId || '')
|
||||
const hasName = typeof body?.name === 'string'
|
||||
const family = body?.family === true
|
||||
if (!folderId && !hasName) {
|
||||
const hasLocks = typeof body?.globalLocks === 'string'
|
||||
const hasRefs = Array.isArray(body?.permanenceRefs)
|
||||
if (!folderId && !hasName && !hasLocks && !hasRefs) {
|
||||
throw createError({ statusCode: 400, statusMessage: 'Choose a library folder or a new name' })
|
||||
}
|
||||
const clip = getClip(owner, id)
|
||||
@@ -19,5 +21,12 @@ export default defineEventHandler(async (event) => {
|
||||
if (family) await renameClipFamily(owner, id, body.name || '')
|
||||
else await renameClip(owner, id, body.name || '')
|
||||
}
|
||||
if (hasLocks || hasRefs) {
|
||||
await patchClipMeta(owner, id, {
|
||||
globalLocks: hasLocks ? body.globalLocks : undefined,
|
||||
permanenceRefs: hasRefs ? body.permanenceRefs as import('~/utils/globalLocks').PermanenceRef[] : undefined,
|
||||
family: family || hasLocks
|
||||
})
|
||||
}
|
||||
return publicLibrary(event)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user