Files
aigen/server/api/queues/[id]/process.post.ts
T

11 lines
481 B
TypeScript

import { startQueueBurst } from '~/server/utils/videoChain'
export default defineEventHandler(async (event) => {
const { owner } = assertLibraryOwner(event)
const id = String(getRouterParam(event, 'id') || '')
const body = await readBody<{ count?: number | 'all' }>().catch(() => ({}))
const raw = body?.count
const count = raw === 'all' || raw === 'remaining' ? 'all' as const : Math.max(1, Math.min(50, Number(raw) || 1))
return startQueueBurst(owner, id, count)
})