Skip to content

feat: add message history, detail, recipient, and preview query services#109

Merged
kevinrutledge merged 1 commit intodevelopfrom
feat/message-query-services
Apr 5, 2026
Merged

feat: add message history, detail, recipient, and preview query services#109
kevinrutledge merged 1 commit intodevelopfrom
feat/message-query-services

Conversation

@kevinrutledge
Copy link
Copy Markdown
Collaborator

Developer

Kevin Rutledge

What changed?

Added query services, server actions, and tests for the message history and compose pages.

  1. Four new service functions in message.ts - getAllMessageHistory() lists messages across all groups with optional senderId/channel filters and pagination. getMessageById() returns a single message with group name. getMessageRecipients() returns per-recipient delivery status with member names resolved via member API. previewRecipientCounts() returns email/SMS eligible and ineligible counts for a group before sending.

  2. Three new server actions in contact-group.ts - fetchMessageHistory() shows all messages for admin, filtered to own messages for members. fetchMessageDetail() returns message + recipients with authorization (sender or admin only). fetchRecipientPreview() returns eligible counts with authorization (group owner or admin only).

  3. SMS body length validation - added refine() to BaseMessageSchema that rejects body over 160 characters when sendSms is true. Enforces SMS segment limits at the Zod validation boundary.

  4. New types - MessageHistoryItem, MessageDetail, RecipientStatus, and RecipientCounts exported from message.ts for frontend consumption.

How to test

  1. Run npm test - 303 tests pass (31 new)
  2. Run npm run build - succeeds
  3. Run npm run lint - no errors

Checklist

@kevinrutledge kevinrutledge self-assigned this Apr 5, 2026
@kevinrutledge kevinrutledge merged commit f0ae622 into develop Apr 5, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant