Files
mercadodevida/work/artifacts/F-024/implementer.md
2026-08-17 22:23:10 +02:00

1.2 KiB

Implementer — F-024 Notifications: transactional email

Summary

Implemented notifications module with NotificationsService dispatching email through an EmailProvider port. notifications_messages.event_id enforces idempotency. Provider is injected at composition root so swapping providers only touches infrastructure.

Files changed

  • project/migrations/018_notifications.js
  • project/src/modules/notifications/**
  • project/src/app/build-app.ts

Acceptance evidence

  • AC1 dispatch on first event: notifications-service.test.ts confirms first call returns 'sent' and provider.send called once.
  • AC2 replay no duplicate: same test injects findByEventId returning an existing row and asserts 'duplicate' with no second provider call.
  • AC3 provider swap: boundary.test.ts asserts only infrastructure/ references LoggingEmailProvider or emailProvider.send.

Commands run

  • cd project && npm run lint/typecheck/build/test passed
  • cd project && TEST_DATABASE_URL='postgres://mdv:mdv_dev_only@localhost:5432/mdv_test' npm run test:integration -- migrations.itest passed; 14 files, 53 tests
  • ./scripts/verify.sh passed

Notes

  • No new runtime dependency.
  • LoggingEmailProvider writes JSON lines for v1.