Referral Repository
Component Detail
Data Layer
low complexity
backend
0
Dependencies
2
Dependents
1
Entities
0
Integrations
Description
Data access layer for the recruitment_referrals table, managing persistence of referral tokens, referring user associations, and conversion outcomes. Provides query methods for coordinator-level recruitment activity visibility.
referral-repository
Responsibilities
- Create and persist referral token records linked to peer mentors
- Record conversion events when referred users complete registration
- Query referral counts and conversion outcomes per peer mentor
- Support coordinator queries for team-level recruitment activity
Interfaces
createReferral(referrerId: string, organizationId: string, token: string): Promise<Referral>
findReferralByToken(token: string): Promise<Referral | null>
markReferralConverted(token: string, newUserId: string): Promise<void>
getReferralsByUser(userId: string): Promise<Referral[]>
getReferralCountByUser(userId: string): Promise<number>
getReferralsByOrganization(organizationId: string): Promise<Referral[]>
Relationships
Dependents (2)
Components that depend on this component
Related Data Entities (1)
Data entities managed by this component