Data Layer low complexity backend
0
Dependencies
1
Dependents
0
Entities
0
Integrations

Description

PostgreSQL table that persists referral records containing referrer_user_id, nullable invitee_user_id (populated when sign-up completes), signed token, created_at, and redeemed_at. Supports attribution of successful volunteer sign-ups back to the originating peer mentor and drives Bufdir reporting metrics on volunteer recruitment.

Feature: Invite Link & QR Sharing

referrals-table

Responsibilities

  • Persist referral records with referrer_user_id and signed token
  • Track invitee_user_id and redeemed_at timestamp on sign-up completion
  • Enforce token uniqueness and support expiry-based queries
  • Support aggregated referral count queries per user and per organization

Interfaces

insert(referral: Referral): Future<void>
findByToken(token: String): Future<Referral?>
findByReferrer(userId: String): Future<List<Referral>>
markRedeemed(token: String, inviteeId: String, redeemedAt: DateTime): Future<void>
countRedeemedByReferrer(userId: String): Future<int>

Relationships

Dependents (1)

Components that depend on this component