UNPKG

nitropage

Version:

A free and open source, extensible visual page builder based on SolidStart.

34 lines (29 loc) 652 B
import { useFilesystemDriver } from "../filesystem"; import { useDatabase } from "../prisma"; import { fontPath } from "./util"; export * from "./update"; export * from "./upload"; export const deleteFont = async function (id: string) { const prisma = useDatabase(); const font = await prisma.nitroFont.findUniqueOrThrow({ where: { id, }, }); const fs = useFilesystemDriver(font.driver); await fs.deleteDir({ name: fontPath(font), }); await prisma.nitroFontFace.deleteMany({ where: { font: { id, }, }, }); return await prisma.nitroFont.delete({ where: { id, }, }); };