import { C as error } from '../../../../chunks/utils.js-mIi_c4Oz.js';
import { a as hasRole } from '../../../../chunks/auth.js-D502gejJ.js';
import { b as backupToBuffer } from '../../../../chunks/db.js-le-jjQPv.js';
import '../../../../chunks/utils2.js-BQzn9ikS.js';
import 'node:crypto';
import 'node:sqlite';
import 'node:fs';
import 'node:path';
import 'node:os';

const GET = async ({ locals }) => {
  if (!hasRole(locals.user, "admin")) throw error(403, "Solo administración.");
  const buf = backupToBuffer();
  const date = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
  return new Response(buf, {
    headers: {
      "Content-Type": "application/octet-stream",
      "Content-Disposition": `attachment; filename="inventario-edumind-${date}.db"`
    }
  });
};

export { GET };
//# sourceMappingURL=_server.ts.js-V2-l_zpY.js.map
