import { prisma } from "./db"; import { deleteUploadsForDraft } from "./uploads/deleteUploadedFiles"; /** Remove the signed-in user's in-progress draft and any files still tied to it. */ export async function deleteRuleDraftForUser(userId: string): Promise { const draft = await prisma.ruleDraft.findUnique({ where: { userId }, select: { id: true }, }); if (draft) { await deleteUploadsForDraft(draft.id); } await prisma.ruleDraft.deleteMany({ where: { userId } }); }