Skip to content

Notify admins on loan dispute via email and SSE #806

@davidmaronio

Description

@davidmaronio

Join our community: https://t.me/+DOylgFv1jyJlNzM0

Description

When a borrower contests a default (POST /loans/:id/dispute), the code logs the event but skips admin notification. Disputes require prompt review; the TODO at line 118 of loanController.ts has been open across multiple pulls.

What Needs to Happen

  • Send email to ADMIN_EMAIL (env var) using the existing notification service
  • Push SSE notification to all active admin SSE subscribers
  • Optionally POST to ADMIN_WEBHOOK_URL if configured (Discord/Slack-compatible)
  • Add ADMIN_EMAIL and optional ADMIN_WEBHOOK_URL to .env.example

Files

  • backend/src/controllers/loanController.ts (line 118)

Acceptance Criteria

  • Admin email sent on new dispute
  • Admin SSE subscribers receive real-time push
  • Degrades gracefully when ADMIN_EMAIL is not set

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions