Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* `leads delete --id <leadId>` — hard-delete a single lead and its events.
|
||||
* Use for DSGVO right-to-be-forgotten requests.
|
||||
*/
|
||||
import { defineCommand } from "citty";
|
||||
import consola from "consola";
|
||||
|
||||
export const leadsDeleteCommand = defineCommand({
|
||||
meta: { name: "delete", description: "Delete a lead (DSGVO right-to-be-forgotten)." },
|
||||
args: {
|
||||
id: { type: "string", required: true, description: "Lead id." },
|
||||
},
|
||||
async run({ args }) {
|
||||
const { getDbClient } = await import("@toolctrl/db/client.server");
|
||||
const prisma = getDbClient();
|
||||
const id = String(args.id);
|
||||
const existing = await prisma.lead.findUnique({ where: { id }, select: { email: true } });
|
||||
if (!existing) {
|
||||
consola.warn(`Lead ${id} not found.`);
|
||||
return;
|
||||
}
|
||||
await prisma.lead.delete({ where: { id } });
|
||||
consola.success(`Deleted lead ${id} (${existing.email}).`);
|
||||
},
|
||||
});
|
||||
Reference in new issue
Block a user