import { i as defineEventHandler, y as getRouterParam, e as createError, K as readBody, t as getProvider } from '../../../../nitro/nitro.mjs';
import 'node:path';
import 'node:module';
import 'node:fs';
import 'node:os';
import 'dotenv';
import 'node:http';
import 'node:https';
import 'node:events';
import 'node:buffer';
import 'node:crypto';
import 'node:async_hooks';
import 'node:url';
import 'node:net';
import '@iconify/utils';
import 'consola';

const status_post = defineEventHandler(async (event) => {
  var _a;
  const id = getRouterParam(event, "id");
  if (!id) {
    throw createError({ statusCode: 400, statusMessage: "Missing task id" });
  }
  const body = (_a = await readBody(event)) != null ? _a : {};
  const status = typeof body.status === "string" ? body.status.trim() : "";
  if (!status) {
    throw createError({ statusCode: 400, statusMessage: "Body must include non-empty `status`" });
  }
  const { provider } = getProvider(event);
  await provider.updateStatus(id, status);
  return { ok: true, id, status };
});

export { status_post as default };
//# sourceMappingURL=status.post.mjs.map
