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

async function findByIssue(issueKey) {
  return prisma.attachment.findMany({
    where: { issueKey },
    orderBy: { createdAt: "desc" }
  });
}
async function findById(id) {
  return prisma.attachment.findUnique({
    where: { id }
  });
}
async function create(issueKey, data) {
  var _a, _b;
  return prisma.attachment.create({
    data: {
      issueKey,
      filename: data.filename,
      filepath: data.filepath,
      mimetype: (_a = data.mimetype) != null ? _a : null,
      size: (_b = data.size) != null ? _b : null
    }
  });
}
async function remove(id) {
  await prisma.attachment.delete({
    where: { id }
  });
}

export { findById as a, create as c, findByIssue as f, remove as r };
//# sourceMappingURL=attachments.service.mjs.map
