import { getDb } from '../../../../utils/db' export default defineEventHandler(async (event) => { const db = getDb() const id = getRouterParam(event, 'id') const body = await readBody(event) const { name, url, is_active } = body if (!name || !url) { throw createError({ statusCode: 400, message: 'name과 url은 필수입니다' }) } db.prepare(` UPDATE pubnet_targets SET name = ?, url = ?, is_active = ?, updated_at = datetime('now', 'localtime') WHERE id = ? `).run(name, url, is_active ? 1 : 0, id) return { id: Number(id), name, url, is_active: is_active ? 1 : 0 } })