chore: remove POST /api/notifications (superseded by /api/emails)

Merged
SW
4mo ago
+1-599

Deletes the POST /api/notifications route as part of the chat#1815 cleanup. Implements the merged-path contract removal in docs#253.

Why

/api/notifications emailed only the account's own address. With to now optional on POST /api/emails (defaulting to the account's own email — api#710), /api/emails fully subsumes it. Keeping both is dead surface area.

What changed (deletion + one comment fix)

  • Deleted app/api/notifications/route.ts.
  • Deleted lib/notifications/* — createNotificationHandler.ts, validateCreateNotificationBody.ts, and both tests (598 deletions).
  • Kept lib/emails/processAndSendEmail.ts (still the shared domain fn for the send_email MCP tool) and updated its stale JSDoc: POST /api/notifications handler → POST /api/emails handler.

Verification

  • grep -rn "api/notifications\|createNotification\|CreateNotification\|NotificationResponse\|lib/notifications" across api (excl. .next/node_modules) → clean.
  • pnpm exec vitest run lib/emails → 126 passed (processAndSendEmail + send_email paths unaffected).

Dependencies / sequencing

  • Sibling: recoupable/cli re-points its notifications command from /api/notifications → /api/emails (self-send). That CLI PR should merge before/with this so the command keeps working.
  • Contract: docs#253.
  • Lands before close of chat#1815, after /api/emails to-optional (api#710) is live.

🤖 Generated with Claude Code


Summary by cubic

Removed the POST /api/notifications endpoint and consolidated email sending on POST /api/emails, which defaults to the account email when to is omitted. Part of chat#1815 cleanup; aligns with docs#253 and api#710.

  • Refactors

    • Deleted app/api/notifications/route.ts and lib/notifications/* (handler, validator, tests).
    • Kept lib/emails/processAndSendEmail.ts; JSDoc now references /api/emails and the send_email MCP tool.
  • Migration

    • Update clients from POST /api/notifications to POST /api/emails; omit to to self-send.
    • Ensure the CLI notifications command targets /api/emails; merge alongside this change.