/* SPDX-FileCopyrightText: © 2025 Hornwitser SPDX-License-Identifier: AGPL-3.0-or-later */ import { readNextSessionId, readNextUserId, readSchedule, readSessions, readSubscriptions, readUsers } from "~/server/database"; export default defineEventHandler(async (event) => { await requireServerSessionWithAdmin(event); setHeader(event, "Content-Disposition", 'attachment; filename="database-dump.json"'); setHeader(event, "Content-Type", "application/json; charset=utf-8"); return { nextUserId: await readNextUserId(), users: await readUsers(), nextSessionId: await readNextSessionId(), sessions: await readSessions(), subscriptions: await readSubscriptions(), schedule: await readSchedule(), }; })