Add member email history and record transactional emails#33
Merged
Conversation
Surface every email a member has received on their admin detail page.
Adds a GET /members/{id}/emails endpoint that lists the SentEmail records
the member was a recipient of (newest first), with the delivery status
specific to that member, and an 'Email history' card on MemberDetail that
links each entry through to the full sent-email view.
Route every transactional email (password reset, membership welcome, bed assignment, bed-application and contact-form notifications) through a new TransactionalEmailSender that sends via Resend and records a SentEmail + SentEmailRecipient, mirroring how the newsletter sender already does it. Member-directed emails carry the recipient's UserId, so they now appear in the member detail page's email history; all transactional emails also show in the admin Email list. Delivery failures are recorded with their error and never thrown, preserving the previous fire-and-forget behaviour. Test-tool preview emails are intentionally left unrecorded.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a history of every email a member has received to the admin member-detail page, and records all transactional emails (not just newsletters) in the shared sent-email history so they show up there.
Member email history
GET /api/admin/members/{id}/emailsendpoint (ListMemberEmailsEndpoint) listing theSentEmailrecords a member was a recipient of, newest first, with the delivery status specific to that member.MemberDetail, each row linking through to the full sent-email view.Record transactional emails
TransactionalEmailSenderthat sends a single email via Resend and writes aSentEmail+SentEmailRecipient, mirroring the newsletter sender.IdentityEmailSender) → memberMembershipActivationService) → memberLeasedBedNotifications) → memberUserId, so they appear in the member's email history; all transactional emails also appear in the admin Email list.Notes
🤖 Generated with Claude Code
Generated by Claude Code