feat: Email ingestion notifications and error emails (#149) #159
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Relates to #149
Scope
Implement all notification paths for the email ingestion flow.
Email Templates (content)
Define template content for the 3 templates created in migration sub-issue:
In-App Notifications
user_notificationwith type='email_ingestion', title='Receipt Processed', message with details, referenceType='fuel_log' or 'maintenance_record', referenceId=created record ID, vehicleIdError Reply Emails
Notification Logging
notification_logswith reference_type='email_ingestion'Files
backend/src/features/email-ingestion/domain/notification-handler.tsAcceptance Criteria
Milestone: Implementation Complete
Phase: Execution | Agent: Developer | Status: PASS
Changes Made
New file:
notification-handler.tsEmailIngestionNotificationHandlerclass encapsulating all notification logicnotifyReceiptProcessed,notifyPendingVehicleSelection,notifyUnregisteredSender,notifyNoVehicles,notifyNoValidAttachments,notifyOcrFailure,notifyProcessingFailurenotification_logsviainsertNotificationLog(both success and failure)user_notificationcreated for all scenarios (success, pending vehicle, all error types)Updated:
email-ingestion.service.tsEmailIngestionNotificationHandleruserId/userNameto notification handler for in-app notificationsnickname || year make model(nonamefield on Vehicle type)sendConfirmationEmail,sendFailureEmail,sendNoVehiclesEmail,sendPendingVehicleEmailUpdated:
002_create_email_templates.sqlreceipt_processed: AddedmerchantName, renamedreceiptDate->date,amount->totalAmountreceipt_failed: ReplacedemailSubjectwithguidancevariable, updated HTML to show guidance sectionreceipt_pending_vehicle: AddedmerchantName,totalAmount,datevariablesUpdated:
notifications.service.tsreceipt_processed,receipt_failed,receipt_pending_vehiclein test email flowAcceptance Criteria
Validation
Verdict: PASS | Next: Quality review