mirror of
https://github.com/OpenSquawk/OpenSquawk
synced 2026-05-13 18:25:56 +08:00
20 lines
652 B
TypeScript
20 lines
652 B
TypeScript
import { readBody } from 'h3'
|
|
import { requireAdmin } from '../../../utils/auth'
|
|
import { importATCDecisionTree } from '../../../services/decisionImportService'
|
|
|
|
export default defineEventHandler(async (event) => {
|
|
await requireAdmin(event)
|
|
const body = await readBody<Record<string, any> | undefined>(event)
|
|
|
|
const { flow, importedStates } = await importATCDecisionTree({
|
|
slug: typeof body?.slug === 'string' ? body.slug : undefined,
|
|
name: typeof body?.name === 'string' ? body.name : undefined,
|
|
description: typeof body?.description === 'string' ? body.description : undefined,
|
|
})
|
|
|
|
return {
|
|
flow,
|
|
importedStates,
|
|
}
|
|
})
|