Skip to content

apps/api/src/features/announcements/announcements.service.ts ​

Auto-generated by scripts/generate-file-docs.ts. Do not edit — overwritten on every run.

Purpose ​

AnnouncementsService — drafting, approval, publishing, member-side reads, and read-receipt recording for the one-way announcements feature. Authority model (ADR 0012, ADR 0023, AB#3362): - DRAFT authoring is open to comms_author, group_leader, ministry_leader, and admin. comms_author may ONLY target audiences that intersect their UserCommunicationsScope rows (server-side enforced). - submitForApproval() may only be called by the author. - approve() / reject() require ministry_leader or higher AND the approver must be a different user than the author. - withdraw() is admin-only (per rbac-comms-author.md). Member visibility (read paths): - PUBLISHED announcements are visible only when: (audienceRole IS NULL OR audienceRole = caller.role) AND (audienceGroupId IS NULL OR audienceGroupId = caller.familyGroupId OR caller is a member of that group) - All other statuses are visible only to ministry_leader and admin. Body sanitization: - create() and update() pass body through sanitizeRichText() before writing to the database. Read receipts: - markRead() upserts an AnnouncementReceipts row for the caller + announcement, setting readAt = now. /

Exports ​

  • export interface ListAnnouncementsParams
  • export interface ListAnnouncementsResult
  • export class AnnouncementsService
  • export const announcementsService

Imports ​

  • ../../adapters/db
  • ../../lib/errors
  • ../../lib/logger
  • ../../lib/pagination
  • ../../lib/sanitize
  • ../../middleware/requireAuth
  • @prisma/client

Imported by ​

Heritage Community Hub — Internal. Access restricted via Cloudflare Access + Entra ID.