import { defineEventHandler } from "h3"; import { database } from "~/server/utils/database"; import { createError } from "#imports"; export default defineEventHandler(async (e) => { const id = e.context.params?.id as string; try { await database.client.delete({ where: { id: BigInt(id), }, }); } catch (e) { // FIXME: should be 500 on errors other than "RecordNotFound" throw createError({ statusCode: 404 }); } return null; });