UNPKG

@npio/internals

Version:

A free visual website editor, powered with your own SolidJS components.

33 lines (28 loc) 626 B
import { useFilesystemDriver } from "../filesystem"; import { useDatabase } from "../prisma"; import { fontPath } from "./util"; 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, }, }); };