Turn a saved draft into the finished Rule, and greet with congratulations.
This commit is contained in:
1 parent
a2815ae05f
commit
851133e56d
11 files changed
+150
-23
No files matched your search
@@ -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 } });
|
||||
}
|
||||
Reference in new issue
Block a user