Turn a saved draft into the finished Rule, and greet with congratulations.

This commit is contained in:
adilallo committed 2026-11-22 18:01:56 -07:00
1 parent a2815ae05f
commit 851133e56d
11 files changed
+150 -23

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
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<void> {
const draft = await prisma.ruleDraft.findUnique({
where: { userId },
select: { id: true },
});
if (draft) {
await deleteUploadsForDraft(draft.id);
}
await prisma.ruleDraft.deleteMany({ where: { userId } });
}