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,26 @@
|
||||
/**
|
||||
* `forms delete --id <formId>` — hard-delete a form and cascade
|
||||
* its FormSubmission rows. No soft-delete in Phase-1.
|
||||
*/
|
||||
import { defineCommand } from "citty";
|
||||
import consola from "consola";
|
||||
|
||||
export const formsDeleteCommand = defineCommand({
|
||||
meta: { name: "delete", description: "Delete a form (cascade submissions)." },
|
||||
args: {
|
||||
id: { type: "string", required: true, description: "Form ID." },
|
||||
},
|
||||
async run({ args }) {
|
||||
const { getDbClient } = await import("@toolctrl/db/client.server");
|
||||
const prisma = getDbClient();
|
||||
const id = String(args.id);
|
||||
const existing = await prisma.form.findUnique({ where: { id }, select: { id: true, name: true } });
|
||||
if (!existing) {
|
||||
consola.error(`Form ${id} not found.`);
|
||||
process.exitCode = 1;
|
||||
return;
|
||||
}
|
||||
await prisma.form.delete({ where: { id } });
|
||||
consola.success(`Form deleted: ${id} (${existing.name}).`);
|
||||
},
|
||||
});
|
||||
Reference in new issue
Block a user