Skip to content

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

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

Purpose ​

ApprovalService — the minister approval queue. Backs api-contracts.md §6 (Approval Workflow). All gated events — member join, spouse add, child add, content publish — share the single ApprovalWorkflow table (ADR 0007). Transitions (all atomic — workflow + side effects share one $transaction): approve(MEMBER_JOIN): - User.status = ACTIVE, User.role = MEMBER - Create a FamilyGroup for the new member and link it (ADR 0007) - Create FamilyGroupMember(PRIMARY) row - Workflow → APPROVED approve(SPOUSE_ADD): - Spouse User.status = ACTIVE, User.role = MEMBER - FamilyGroupMember(SPOUSE) upsert against the existing FamilyGroup - Workflow → APPROVED approve(CONTENT_PUBLISH): - Workflow → APPROVED (announcement service handles the publish step) deny(member-join | spouse-add): - Workflow → REJECTED with minister comments - User.status REMAINS pending_approval (auth-rbac-design says rejected applicants stay PENDING_APPROVAL so they cannot return successfully) Every state transition writes an AuditLog row (best-effort but logged on failure rather than silently swallowed). /

Exports ​

  • export interface QueueParams
  • export interface ApprovalWorkflowItem
  • export interface QueueResult
  • export function toWorkflowItem
  • export class ApprovalService
  • export const approvalService

Imports ​

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

Imported by ​

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