Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

846 B
Raw Blame
enum ReferralTrack {
  AFFILIATE
  PARTNER_DISCOUNT
}

model ReferralInvite {
  id String @id @default(cuid())
  userId String
  user   User   @relation(fields: [userId], references: [id], onDelete: Cascade)
  teamId String?
  team   Team?   @relation(fields: [teamId], references: [id], onDelete: Cascade)
  /**
   * Whose cap and discount this invite counts against — the fund's team, or the
   * sender alone. One non-null key rather than a pair of nullable ones: on a
   * nullable teamId every personal invite is distinct to Postgres, so the two
   * keys guarded different scopes and a member could not invite a company both
   * for their fund and for themselves.
   */
  scopeId String
  email String
  referralLink String?
  sentAt       DateTime @default(now())

  @@unique([scopeId, email])
  @@index([userId])
  @@index([teamId])
}