Service Layer low complexity backend
0
Dependencies
0
Dependents
2
Entities
0
Integrations

Description

Aggregates referral invite outcomes (sent, accepted, pending, expired) per referrer by joining referral_invites against user registration events. Exposes a dedicated API endpoint consumed by the coordinator team report screen and the peer mentor personal statistics dashboard. Enforces org-tenant scoping to prevent cross-organization data leakage and applies GDPR-compliant anonymization so only aggregate counts are visible, never identifying information about who followed a link.

Feature: Recruitment Tracking

referral-stats-service

Sources & reasoning

The feature's core function is closing the referral feedback loop for peer mentors and coordinators. A dedicated aggregation service is required to join invite state transitions into per-referrer counts, enforce tenant isolation, and expose a stable read endpoint consumed by two independent screens (coordinator team reports and personal statistics). GDPR anonymization logic belongs here rather than scattered across consumers.

No source references — this artifact was included based on reasoning alone (see above).

Responsibilities

  • Compute sent, accepted, pending, and expired invite counts per referrer within an org tenant
  • Expose a read-only API endpoint returning referral stats for a given user or org scope
  • Anonymize referral metadata on user deletion (GDPR compliance)
  • Ensure org-tenant isolation so cross-org stats leakage is structurally impossible
  • Provide referral count aggregates to the annual summary wrapped pipeline

Interfaces

getReferralStats(userId, orgId): ReferralStatsSummary
getOrgReferralStats(orgId): OrgReferralStats[]
anonymizeReferrerData(userId): void

Related Data Entities (2)

Data entities managed by this component