import { i as debug, p as prisma } from '../nitro/nitro.mjs';

async function findByIssue(issueKey) {
  debug("comments", "findByIssue", { issueKey });
  return prisma.comment.findMany({
    where: { issueKey },
    orderBy: { createdAt: "desc" }
  });
}
async function create(issueKey, data) {
  const id = String(Date.now());
  debug("comments", "create", { issueKey, author: data.author, contentLength: data.content.length });
  const comment = await prisma.comment.create({
    data: {
      id,
      issueKey,
      content: data.content,
      author: data.author
    }
  });
  debug("comments", "created", { id: comment.id, issueKey });
  return comment;
}

export { create as c, findByIssue as f };
//# sourceMappingURL=comments.service.mjs.map
