import { execute } from '../../../utils/db' import { requireAuth } from '../../../utils/session' interface DiscardBody { reason?: string } /** * TODO 폐기 처리 * PUT /api/todo/[id]/discard */ export default defineEventHandler(async (event) => { await requireAuth(event) const todoId = parseInt(event.context.params?.id || '0') const body = await readBody(event) if (!todoId) { throw createError({ statusCode: 400, message: 'TODO ID가 필요합니다.' }) } await execute(` UPDATE wr_todo SET status = 'DISCARDED', discard_reason = $1, updated_at = NOW() WHERE todo_id = $2 `, [body.reason || null, todoId]) return { success: true, message: '폐기 처리되었습니다.' } })