import { d as defineEventHandler, g as getQuery, i as debug, I as findAll } from '../../nitro/nitro.mjs';
import 'node:http';
import 'node:https';
import 'node:crypto';
import 'stream';
import 'events';
import 'http';
import 'crypto';
import 'buffer';
import 'zlib';
import 'https';
import 'net';
import 'tls';
import 'url';
import 'node:events';
import 'node:buffer';
import 'node:fs';
import 'node:path';
import 'vue-router';
import '@prisma/client';
import '@prisma/adapter-better-sqlite3';
import 'fs';
import 'path';
import 'fs/promises';
import 'child_process';
import 'node:child_process';
import 'node:url';

const index_get = defineEventHandler(async (event) => {
  const query = getQuery(event);
  debug("api", "GET /api/issues", { column: query["column"], search: query["search"] });
  const options = { includeColumn: true };
  if (query["column"]) options.columnSlug = query["column"];
  if (query["search"]) options.search = query["search"];
  if (query["limit"]) options.limit = parseInt(query["limit"]);
  const issues = await findAll(options);
  debug("api", "GET /api/issues - result", { count: issues.length });
  return issues.map((issue) => {
    var _a, _b;
    return {
      key: issue.key,
      title: issue.title,
      column_slug: (_b = (_a = issue.column) == null ? void 0 : _a.slug) != null ? _b : "",
      created_at: issue.createdAt.toISOString(),
      updated_at: issue.updatedAt.toISOString(),
      description: issue.description,
      priority: issue.priority,
      parent_key: issue.parentKey,
      acceptance_criteria: issue.acceptanceCriteria.map((c) => c.criterion)
    };
  });
});

export { index_get as default };
//# sourceMappingURL=index.get3.mjs.map
