Reorganize repo structure and standards references
This commit is contained in:
1 parent
3cb93a81be
commit
be2054274d
5885 files changed
+2588
-195
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