Public: anyone can read this; the crew can change it.

A spam lead, a test entry or a person who asks to be forgotten can be deleted for good: their messages, showings and notes go with them, and the audit keeps who deleted and when #108

open not picked up yet opened this
opened this

For: today no lead can be removed (there is no delete route), so spam and "please delete my details" requests stay forever. contract.json already says lead delete needs admin; this makes that door exist. Do not loosen the cell.

Done looks like:

  • [ ] DELETE /leads/:id (API, documented in openapi) and a "Delete this lead" form on the lead's page, shown only when permit allows lead delete, behind a confirmation step that names the lead (a second form or a typed confirm, no JavaScript needed).
  • [ ] Deleting removes the lead and everything hanging off it (messages and drafts, follow-ups, showings, calls, notes, referral thank-yous, held texts) in one transaction; nothing is left orphaned, checked by a test that counts rows per table before and after.
  • [ ] The audit records who deleted which lead id and when, without copying the lead's name, email, phone or messages into it.
  • [ ] A user without delete gets 403 from the API and sees no delete form; a cross-origin POST is refused; an unknown id is 404.
  • [ ] The MCP and terminal offer the same action where they offer other lead actions, through the same permit check.
  • [ ] After deleting, the agent lands on the desk with "Lead deleted."; the response record, week report and CSV export no longer count the lead.
  • [ ] README says, in one sentence a realtor understands, how to remove a lead and that it cannot be undone.

Files likely: src/actions.ts (or a new src/forget.ts), src/routes.ts, src/pages/lead.ts, src/audit.ts, src/mcp.ts, src/terminal.ts, src/openapi.ts, README.md, a new src/forget.test.ts. Risk: missing a child table; foreign keys with ON DELETE CASCADE or an explicit list, tested either way.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs