Untitled

 avatar
unknown
plain_text
5 months ago
50 kB
6
Indexable
enum UserType {
  STUDENT     @map("0")
  TEACHER     @map("1")
  FACILITATOR @map("2")
  ADMIN       @map("10")
}

enum ZoomMeetingURLStatus {
  UPCOMING @map("0")
  LIVE     @map("1")
  ENDED    @map("2")
}

enum meetingPlatform {
  LIVEKIT @map("0")
  ZOOM    @map("1")
  OTHER   @map("2")
}

enum RolloverType {
  ADD      @map("0")
  TRANSFER @map("1")
}

enum RolloverRequestStatus {
  PENDING   @map("0")
  COMPLETED @map("1")
  REJECTED  @map("2")
}

enum PaymentRefundStatus {
  PENDING  @map("0")
  REFUNDED @map("1")
  REJECTED @map("2")
  APPROVED @map("3")
}

enum PointsTransactionType {
  EARNED   @map("0")
  REDEEMED @map("1")
}

enum WorkerQueueStatus {
  PENDING   @map("0")
  COMPLETED @map("1")
  FAILED    @map("2")
  REJECTED  @map("3")
}

enum MeetingAccountType {
  ZOOM    @map("zoom")
  LIVEKIT @map("livekit")
  HMS     @map("hms")
}

enum MeetingAccountCapacity {
  LOW    @map("0")
  MEDIUM @map("1")
  HIGH   @map("2")
}

enum DurationType {
  DAYS   @map("0")
  WEEKS  @map("1")
  MONTHS @map("2")
}

enum FeedbackType {
  BOOTCAMP    @map("0")
  MASTERCLASS @map("1")
}

enum MasterClassDurationType {
  MINUTES @map("0")
  HOURS   @map("1")
}

enum SessionDurationType {
  MINUTES @map("0")
  HOURS   @map("1")
}

enum PaymentIntentStatus {
  PENDING   @map("0")
  COMPLETED @map("1")
  FAILED    @map("2")
  REFUNDED  @map("3")
}

enum LiveclassPaymentStatus {
  NOT_ATTEMPTED  @map("0")
  COMPLETED      @map("1")
  FAILED         @map("2")
  BUTTON_CLICKED @map("3")
  PENDING        @map("4")
}

enum PaymentType {
  ONE_TIME     @map("0")
  SUBSCRIPTION @map("1")
}

enum ClassType {
  MASTERCLASS @map("0")
  BOOTCAMP    @map("1")
}

enum LearningMaterialResourceType {
  FILE @map("0")
  URL  @map("1")
  TEXT @map("2")
}

enum MarketingSource {
  FACEBOOK      @map("facebook")
  GOOGLE        @map("google")
  TWITTER       @map("twitter")
  QUORA         @map("quora")
  PAID_FACEBOOK @map("paid_facebook")
  PAID_GOOGLE   @map("paid_google")
}

enum LearningMaterialUnlockType {
  ALWAYS       @map("0")
  BEFORE_CLASS @map("1")
  AFTER_CLASS  @map("2")
}

enum Lifecycle {
  REGISTRATION
  BOOTCAMP
  BOOTCAMP_COMPLETED
  MASTERCLASS
  MASTERCLASS_COMPLETED
}

enum RewardStatus {
  PENDING   @map("0")
  COMPLETED @map("1")
}

enum LiveclassTypes {
  MASTERCLASS @map("0")
  BOOTCAMP    @map("1")
  STREAM      @map("2")
}

enum LiveclassPollsType {
  MULTI_CHOICE @map("0")
  SHORT_ANSWER @map("1")
}

enum WACampaignStatus {
  SCHEDULED  @map("scheduled")
  COMPLETED  @map("completed")
  TERMINATED @map("terminated")
}

enum TemplateHealth {
  APPROVED @map("approved")
  DISABLED @map("disabled")
  PAUSED   @map("paused")
  UNKNOWN  @map("unknown")
}

enum RetargetingType {
  UNDEFINED @map("undefined")
  WHATSAPP  @map("whatsapp")
  SMS       @map("sms")
  IVR       @map("ivr")
  EMAIL     @map("email")
  PUSH      @map("push")
  CALENDAR  @map("calendar")
}

enum RetargetingChannel {
  AISENSY   @map("aiSensy")
  INTERAKT  @map("interakt")
  EXOTEL    @map("exotel")
  MAILCHIMP @map("mailChimp")
}

enum ConversionPlatform {
  FACEBOOK @map("facebook")
  GOOGLE   @map("google")
}

enum LiveclassRewardType {
  NONE @map("NONE")
  TEXT @map("TEXT")
  LINK @map("LINK")
}

enum AdPlatformType {
  META
  GOOGLE
  NONE
}

enum Astrolearn_KundaliType {
  LAL_KITAB            @map("LAL_KITAB")
  LAL_KITAB_VARSHAPHAL @map("LAL_KITAB_VARSHAPHAL")
}

enum UnlockType {
  LAL_KITAB @map("LAL_KITAB")
}

generator client {
  provider        = "prisma-client-js"
  previewFeatures = ["fullTextSearch"]
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

model Categories {
  id            String        @id @default(cuid())
  name          String
  slug          String        @unique
  createdAt     DateTime      @default(now())
  updatedAt     DateTime      @updatedAt
  teacher       User[]
  teachersCount Int           @default(0)
  hidden        Boolean       @default(false)
  masterclasses MasterClass[]
  bootcamps     Bootcamp[]
  Posts         Posts[]
  Books         Books[]
  parentId      String?
  Blog          Blog[]
  coupons       Coupon[]      @relation("categoryCoupons")
}

model Counter {
  id        String   @id @default(cuid())
  name      String   @unique
  count     Int      @default(0)
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
}

model User {
  id                          String                        @id @default(cuid())
  email                       String?
  name                        String?
  age                         Int?
  bio                         String?
  city                        String?
  referralCode                String?                       @unique
  photo                       String?
  phone                       String                        @unique
  countryCode                 String
  categoryId                  String?
  metaData                    Json?
  isPhoneVerified             Boolean                       @default(false)
  isEmailVerified             Boolean                       @default(false)
  isBanned                    Boolean                       @default(false)
  isVIP                       Boolean                       @default(false)
  vipExpiry                   DateTime?
  isGoogleCalendarEnabled     Boolean                       @default(false)
  isAstroLearnGoldMember      Boolean                       @default(false)
  isTradewiseGoldMember       Boolean                       @default(false)
  category                    Categories?                   @relation(fields: [categoryId], references: [id])
  bankInformationId           String?
  bankInfo                    BankInformation?              @relation(fields: [bankInformationId], references: [id])
  type                        UserType                      @default(STUDENT)
  unlockedFeaturesId          String?
  unlockedFeatures            UnlockedFeatures?
  bootcamps                   Bootcamp[]                    @relation("BootcampUsers")
  masterClasses               MasterClass[]
  lastActive                  DateTime?
  createdAt                   DateTime                      @default(now())
  updatedAt                   DateTime                      @default(now()) @updatedAt
  bootcamp                    Bootcamp[]
  facilitator                 Bootcamp[]                    @relation("Facilitators")
  leads                       Leads[]
  paymentIntents              PaymentIntent[]
  EarnedRewards               EarnedRewards[]
  MasterclassAttendees        MasterclassAttendees[]
  ResourceAccessLogs          ResourceAccessLogs[]
  Files                       Files[]
  Certificates                StudentCertificates[]
  FacebookEvents              FacebookEvents[]
  Posts                       Posts[]
  WorkerQueue                 WorkerQueue[]
  CalendarUserAuthorizedSlots CalendarUserAuthorizedSlots[]
  ZoomMeetingURL              ZoomMeetingURL[]
  LiveclassPollsResponse      LiveclassPollsResponse[]
  Batches                     Batches[]
  RetargetingInteraction      RetargetingInteraction[]
  achievements                String?
  coupons                     Coupon[]                      @relation("userCoupons")
  liveclassRewards            LiveclassReward[]
  UserReferPoints             UserReferPoints[]
  UserPointsTransaction       UserPointsTransaction[]       @relation("TransactionUser")
  UserPointsTransactionJoined UserPointsTransaction[]       @relation("TransactionJoinedUser")
  RolloverRequests            RolloverRequests[]
  paymentRefundsRequested     paymentRefund[]
  Kundalis                    Astro_Kundali[]

  @@unique([phone, countryCode])
}

model ResourceAccessLogs {
  id        String   @id @default(cuid())
  userId    String
  user      User     @relation(fields: [userId], references: [id])
  method    String
  resource  String
  payload   String
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt

  @@index([userId])
}

model Files {
  id             String   @id @default(cuid())
  name           String
  url            String
  userId         String
  uploadedByUser User?    @relation(fields: [userId], references: [id])
  createdAt      DateTime @default(now())
  updatedAt      DateTime @updatedAt
}

// @default(PENDING)
model PaymentIntent {
  id                String              @id @default(cuid())
  amount            String              @default("0")
  discountedAmount  String?             @default("0")
  comment           String?
  currency          String              @default("INR")
  paymentMethod     String?
  paymentMethodType String?
  ip                String?
  status            PaymentIntentStatus @default(PENDING)
  isInternational   Boolean             @default(false)
  bootcamp          Bootcamp?           @relation(fields: [bootcampId], references: [id])
  bootcampId        String?
  masterclass       MasterClass?        @relation(fields: [masterclassId], references: [id])
  masterclassId     String?
  gatewayOrderId    String?             @unique
  user              User?               @relation(fields: [userId], references: [id])
  userId            String?
  type              PaymentType         @default(ONE_TIME)
  metaData          Json?
  isVip             Boolean?            @default(false)
  isPaidMasterclass Boolean?            @default(false)
  isPaidBootcamp    Boolean?            @default(false)
  verified          Boolean?            @default(false)
  createdAt         DateTime            @default(now())
  updatedAt         DateTime            @updatedAt
  Batch             Batches?            @relation(fields: [batchId], references: [id])
  batchId           String?
  couponId          String?
  coupon            Coupon?             @relation(fields: [couponId], references: [id])
  Rollover          Rollover[]
  AdCoversion       AdCoversion[]
  paymentRefund     paymentRefund[]

  @@index([userId])
  @@index([createdAt(sort: Desc)])
}

model paymentRefund {
  id              String              @id @default(cuid())
  paymentIntentId String
  paymentIntent   PaymentIntent       @relation(fields: [paymentIntentId], references: [id])
  refundStatus    PaymentRefundStatus @default(PENDING)
  requestedById   String
  requestedBy     User                @relation(fields: [requestedById], references: [id])
  comments        String?
  createdAt       DateTime            @default(now())
  updatedAt       DateTime            @updatedAt
}

model SalesData {
  id        String   @id @default(cuid())
  type      String   @unique
  value     Float
  count     Int
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt

  @@index([type])
}

model KeyValue {
  id        String   @id @default(cuid())
  key       String   @unique
  value     Json
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt

  @@index([key])
}

model Leads {
  id                        String            @id @default(cuid())
  masterclassSlot           MasterClassSlots? @relation(fields: [masterclassSlotId], references: [id])
  masterclassSlotId         String?
  source                    String
  createdAt                 DateTime          @default(now())
  comment                   String?
  formId                    String?
  payload                   Json?
  waNotificationSent        Boolean?          @default(false) // whatsapp notification sent
  waNotificationLinkClicked Boolean?          @default(false) // whatsapp notification link clicked
  user                      User?             @relation(fields: [userId], references: [id])
  utm                       String?
  userId                    String?
  updatedAt                 DateTime          @updatedAt
  AdCoversion               AdCoversion[]

  @@index([updatedAt(sort: Desc), userId])
  @@index([masterclassSlotId])
  @@index([userId])
}

model Tracking {
  id        String   @id @default(cuid())
  type      String   @unique
  value     String?
  data      Json?
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt

  @@index([type])
}

model Tags {
  id           String         @id @default(cuid())
  name         String?
  image        String?
  BootcampTags BootcampTags[]
  createdAt    DateTime       @default(now())
  updatedAt    DateTime       @updatedAt
}

model BootcampTags {
  id         String   @id @default(cuid())
  bootcamp   Bootcamp @relation(fields: [bootcampId], references: [id])
  bootcampId String
  tag        Tags     @relation(fields: [tagId], references: [id])
  tagId      String
  label      String?
  labelColor String?
  createdAt  DateTime @default(now())
  updatedAt  DateTime @updatedAt

  @@index([bootcampId])
  @@index([tagId])
}

model Bootcamp {
  id                 String             @id @default(cuid())
  title              String
  subHeading         String?
  slug               String             @unique
  description        String
  longDescription    String?
  price              Int
  discountedPrice    Int                @default(0)
  coverImage         String?
  certificateImage   String?
  onboardingFormLink String?
  welcomeKitURL      String?
  duration           Int
  categories         Categories[]
  durationType       DurationType       @default(DAYS)
  teacher            User               @relation(fields: [teacherId], references: [id])
  teacherId          String
  doubtFormLink      String?
  createdAt          DateTime           @default(now())
  updatedAt          DateTime           @updatedAt
  bundleBootcampId   String?
  bundleBootcamp     Bootcamp?          @relation(fields: [bundleBootcampId], references: [id], name: "BundleBootcamp")
  bundleBootcamps    Bootcamp[]         @relation("BundleBootcamp")
  whatsappGroupLink  String
  facilitator        User?              @relation(fields: [facilitatorId], references: [id], name: "Facilitators")
  facilitatorId      String?
  users              User[]             @relation("BootcampUsers")
  hidden             Boolean            @default(false)
  learnings          Json?
  paymentIntents     PaymentIntent[]
  faq                FAQ[]
  sessions           Session[]
  masterClass        MasterClass[]
  metaData           Json?
  lifeCycle          LifeCycle[]
  FeedbackResponse   FeedbackResponse[]
  EarnedRewards      EarnedRewards[]
  BootcampTags       BootcampTags[]
  Batches            Batches[]
  ZoomMeetingURL     ZoomMeetingURL[]
  coupons            Coupon[]           @relation("bootcampCoupons")
  timelineSegments   timelineSegments[]
  LiveclassReward    LiveclassReward[]

  @@index([teacherId])
  @@index([slug])
}

model Session {
  id             String              @id @default(cuid())
  bootcamp       Bootcamp            @relation(fields: [bootcampId], references: [id])
  bootcampId     String
  title          String
  description    String
  startDateTime  DateTime?
  duration       Int
  assignmentLink String?
  durationType   SessionDurationType @default(MINUTES)
  link           String
  password       String
  totalAttendees Int                 @default(0)
  createdAt      DateTime            @default(now())
  updatedAt      DateTime            @updatedAt

  @@index([bootcampId])
}

model MasterclassLearningResource {
  id                            String                       @id @default(cuid())
  name                          String
  type                          LearningMaterialResourceType @default(FILE)
  resource                      String
  createdAt                     DateTime                     @default(now())
  updatedAt                     DateTime                     @updatedAt
  MasterclassLearningMaterial   MasterclassLearningMaterial? @relation(fields: [masterclassLearningMaterialId], references: [id])
  masterclassLearningMaterialId String?
}

model MasterclassLearningMaterial {
  id            String                        @id @default(cuid())
  vip           Boolean                       @default(false)
  title         String
  description   String?
  weight        Int                           @default(0)
  resources     MasterclassLearningResource[]
  unlockType    LearningMaterialUnlockType    @default(ALWAYS)
  createdAt     DateTime                      @default(now())
  updatedAt     DateTime                      @updatedAt
  MasterClass   MasterClass?                  @relation(fields: [masterClassId], references: [id])
  masterClassId String?
}

model MasterClass {
  id                          String                        @id @default(cuid())
  title                       String
  slug                        String?                       @unique
  description                 String?
  bootcamp                    Bootcamp                      @relation(fields: [bootcampId], references: [id])
  bootcampId                  String
  totalAttendees              Int                           @default(0)
  learnings                   String
  duration                    Int
  learningMaterial            MasterclassLearningMaterial[]
  durationType                MasterClassDurationType
  slotIds                     String[]
  slots                       MasterClassSlots[]
  users                       User[]
  ads                         MasterClassAds[]
  hidden                      Boolean                       @default(false)
  metaData                    Json?
  linktreeurl                 String?
  createdAt                   DateTime                      @default(now())
  updatedAt                   DateTime                      @updatedAt
  isPaid                      Boolean                       @default(false)
  price                       Int?
  discountedPrice             Int?
  categories                  Categories[]
  FeedbackResponse            FeedbackResponse[]
  EarnedRewards               EarnedRewards[]
  MasterclassZoomLink         MasterclassZoomLink[]
  MasterclassAttendees        MasterclassAttendees[]
  LeadsCpl                    LeadsCpl[]
  masterClassAdGroupIds       MasterClassAdGroupIds[]
  ZoomMeetingURL              ZoomMeetingURL[]
  MarketingMetrics            MarketingMetrics[]
  CalendarUserAuthorizedSlots CalendarUserAuthorizedSlots[]
  LiveclassPolls              LiveclassPolls[]
  PaymentIntent               PaymentIntent[]
  timelineSegments            timelineSegments[]
  coupons                     Coupon[]                      @relation("masterclassCoupons")
  LiveclassRewards            LiveclassReward[]

  @@index([bootcampId])
  @@index([slug])
}

model StudentCertificates {
  id             String    @id @default(uuid())
  classId        String // This can be either bootcampId or masterclassId
  classType      ClassType @default(MASTERCLASS)
  userId         String
  user           User      @relation(fields: [userId], references: [id])
  certificateUrl String
  createdAt      DateTime  @default(now())
  updatedAt      DateTime  @updatedAt

  @@unique([userId, classId, classType])
  @@index([userId])
}

model MasterClassAds {
  id            String      @id @default(cuid())
  masterClass   MasterClass @relation(fields: [masterClassId], references: [id])
  masterClassId String
  adId          String      @unique
  createdAt     DateTime    @default(now())
  updatedAt     DateTime    @updatedAt

  @@index([masterClassId])
}

model MasterClassAdGroupIds {
  id            String      @id @default(cuid())
  masterClass   MasterClass @relation(fields: [masterClassId], references: [id])
  masterClassId String
  adGroupId     String      @unique
  createdAt     DateTime    @default(now())
  updatedAt     DateTime    @updatedAt

  @@index([masterClassId])
}

model MasterClassSlots {
  id                          String                        @id @default(cuid())
  masterClass                 MasterClass                   @relation(fields: [masterClassId], references: [id])
  masterClassId               String
  leads                       Leads[]
  recordingLink               String?
  active                      Boolean                       @default(false)
  startDateTime               DateTime
  totalLeads                  Int                           @default(0)
  metaData                    Json?
  whatsappGroupLink           String
  MarketingMetrics            MarketingMetrics[]
  CalendarUserAuthorizedSlots CalendarUserAuthorizedSlots[]
  RetargetingInteraction      RetargetingInteraction[]

  @@index([masterClassId])
  @@index([startDateTime])
}

model FAQ {
  id         String   @id @default(cuid())
  question   String
  answer     String
  bootcamp   Bootcamp @relation(fields: [bootcampId], references: [id])
  bootcampId String
  createdAt  DateTime @default(now())
  updatedAt  DateTime @updatedAt

  @@index([bootcampId])
}

model BankInformation {
  id                String   @id @default(cuid())
  pan               String
  accountNo         String
  accountHolderName String
  ifsc              String
  createdAt         DateTime @default(now())
  updatedAt         DateTime @updatedAt
  User              User[]
}

model LifeCycle {
  id        String    @id @default(cuid())
  type      Lifecycle
  metaInfo  String
  createdAt DateTime  @default(now())
  updatedAt DateTime  @updatedAt

  bootcamp   Bootcamp? @relation(fields: [bootcampId], references: [id])
  bootcampId String?
}

model FeedbackResponse {
  id            String       @id @default(cuid())
  name          String
  email         String
  phone         String
  review        String
  rating        Int
  bootcampId    String?
  bootcamp      Bootcamp?    @relation(fields: [bootcampId], references: [id])
  masterclassId String?
  masterclass   MasterClass? @relation(fields: [masterclassId], references: [id])
  type          FeedbackType @default(BOOTCAMP)
  flagged       Boolean      @default(false)
  issue         String?
  subIssues     String[]
  createdAt     DateTime     @default(now())
  updatedAt     DateTime     @updatedAt
}

model ABTestResponse {
  id          String   @id @default(cuid())
  type        String
  category    String
  impressions Int
  conversion  Int
  date        String
  createdAt   DateTime @default(now())
  updatedAt   DateTime @updatedAt

  @@unique([type, category, date])
}

model EarnedRewards {
  id            String       @id @default(cuid())
  user          User         @relation(fields: [userId], references: [id])
  userId        String
  amount        Int
  masterclass   MasterClass? @relation(fields: [masterclassId], references: [id])
  masterclassId String?
  bootcamp      Bootcamp?    @relation(fields: [bootcampId], references: [id])
  bootcampId    String?
  status        RewardStatus @default(PENDING)
  createdAt     DateTime     @default(now())
  updatedAt     DateTime     @updatedAt

  @@unique([userId, masterclassId, bootcampId])
  @@unique([userId, masterclassId])
}

model RedirectionLinkClick {
  id              String          @id @default(cuid())
  redirectionId   String
  redirectionLink RedirectionLink @relation(fields: [redirectionId], references: [id])
  createdAt       DateTime        @default(now())
  updatedAt       DateTime        @updatedAt
}

model RedirectionLinkClickCount {
  id                String           @id @default(cuid())
  value             String           @unique
  count             Int              @default(0)
  redirectionLinkId String?
  RedirectionLink   RedirectionLink? @relation(fields: [redirectionLinkId], references: [id])
  sourcesCount      Json?
  createdAt         DateTime         @default(now())
  updatedAt         DateTime         @updatedAt
}

model RedirectionLink {
  id              String                      @id @default(cuid())
  redirectionLink String
  slug            String                      @unique
  count           RedirectionLinkClickCount[]
  validity        DateTime?
  comments        String?
  clicks          RedirectionLinkClick[]
  createdAt       DateTime                    @default(now())
  updatedAt       DateTime                    @updatedAt

  @@index([slug])
}

model MasterclassZoomLink {
  id            String      @id @default(cuid())
  masterclass   MasterClass @relation(fields: [masterclassId], references: [id])
  masterclassId String
  zoomLink      String
  password      String?
  zoomId        String?
  createdAt     DateTime    @default(now())
  updatedAt     DateTime    @updatedAt

  @@unique([masterclassId, zoomLink])
  @@index([masterclassId])
}

model MasterclassAttendees {
  id                    String                 @id @default(cuid())
  masterclass           MasterClass            @relation(fields: [masterclassId], references: [id])
  meeting               ZoomMeetingURL?        @relation(fields: [meetingId], references: [id])
  meetingId             String?
  masterclassId         String
  ip                    String                 @default("")
  userAgent             String                 @default("")
  user                  User                   @relation(fields: [userId], references: [id])
  userId                String
  joinedAt              DateTime               @default(now())
  token                 String?
  leftAt                DateTime?
  source                String?
  metaData              Json?
  micStatus             Json?
  cameraStatus          Json?
  joiningTimeline       Json?
  rating                Float?                 @default(0)
  signalStrength        Json?
  totalCameraOnDuration Int                    @default(0)
  totalMicOnDuration    Int                    @default(0)
  totalDuration         Int                    @default(0)
  overallSignalStrength Int                    @default(0)
  paymentStatus         LiveclassPaymentStatus @default(NOT_ATTEMPTED)
  comments              String?
  createdAt             DateTime               @default(now())
  updatedAt             DateTime               @updatedAt
  AdCoversion           AdCoversion[]

  @@index([masterclassId])
}

model LeadsCpl {
  id            String      @id @default(uuid())
  cpl           Float
  masterclass   MasterClass @relation(fields: [masterclassId], references: [id])
  masterclassId String      @unique
  createdAt     DateTime    @default(now())
  updatedAt     DateTime    @updatedAt
}

model ZoomMeetingURL {
  id                      String                    @id @default(cuid())
  startUrl                String
  joinUrl                 String
  zoomConfig              ZoomConfig                @relation(fields: [zoomConfigId], references: [id])
  zoomConfigId            String
  meetingId               String
  password                String
  metaData                Json?
  startDateTime           DateTime
  endDateTime             DateTime
  actualStartDateTime     DateTime?
  actualEndDateTime       DateTime?
  type                    LiveclassTypes            @default(MASTERCLASS)
  masterClass             MasterClass?              @relation(fields: [masterClassId], references: [id])
  masterClassId           String?
  bootcamp                Bootcamp?                 @relation(fields: [bootcampId], references: [id])
  bootcampId              String?
  moduleId                String?
  module                  Modules?                  @relation(fields: [moduleId], references: [id])
  status                  ZoomMeetingURLStatus      @default(UPCOMING)
  totalAttendees          Int                       @default(0)
  totalDuration           Int                       @default(0)
  peakAttendees           Int                       @default(0)
  pitchAttendees          Int                       @default(0)
  totalCameraOn           Int                       @default(0)
  totalMicOn              Int                       @default(0)
  createdBy               User?                     @relation(fields: [createdById], references: [id])
  createdById             String?
  createdAt               DateTime                  @default(now())
  updatedAt               DateTime                  @updatedAt
  LiveclassPollsResponse  LiveclassPollsResponse[]
  LiveclassPollsAnalytics LiveclassPollsAnalytics[]
  MasterclassAttendees    MasterclassAttendees[]

  @@index([masterClassId])
}

model ZoomConfig {
  id             String                 @id @default(cuid())
  name           String
  clientId       String
  secret         String
  accountId      String?
  token          String?
  accountType    MeetingAccountType     @default(LIVEKIT)
  connectionURL  String?
  capacity       MeetingAccountCapacity @default(LOW)
  isAvailable    Boolean                @default(true)
  createdAt      DateTime               @default(now())
  updatedAt      DateTime               @updatedAt
  ZoomMeetingURL ZoomMeetingURL[]

  @@unique([clientId, secret, accountId])
}

model FacebookEvents {
  id             String   @id @default(cuid())
  eventName      String
  value          String?
  currency       String   @default("INR")
  facebookLeadId String
  user           User     @relation(fields: [userId], references: [id])
  userId         String
  createdAt      DateTime @default(now())
  updatedAt      DateTime @updatedAt
}

model MarketingMetrics {
  id                String                @id @default(cuid())
  masterclassSlotId String
  masterclassSlot   MasterClassSlots      @relation(fields: [masterclassSlotId], references: [id])
  masterclassId     String?
  masterclass       MasterClass?          @relation(fields: [masterclassId], references: [id])
  sourceInfo        MarketingSourceInfo[]
  updatedAt         DateTime              @updatedAt
  createdAt         DateTime              @default(now())
}

model MarketingSourceInfo {
  id                 String            @id @default(cuid())
  source             MarketingSource   @default(FACEBOOK)
  firstLeadDateTime  DateTime?
  lastLeadDateTime   DateTime?
  totalLeads         Int               @default(0)
  totalSpend         Float             @default(0)
  adsInfo            AdInfo[]
  MarketingMetrics   MarketingMetrics? @relation(fields: [marketingMetricsId], references: [id])
  marketingMetricsId String?
  updatedAt          DateTime          @updatedAt
  createdAt          DateTime          @default(now())
}

model AdInfo {
  id                    String               @id @default(cuid())
  name                  String
  adId                  String?
  adSetId               String?
  adSetName             String?
  campaignId            String?
  campaignName          String?
  leadsCount            Int                  @default(0)
  spend                 Float                @default(0)
  MarketingSourceInfo   MarketingSourceInfo? @relation(fields: [marketingSourceInfoId], references: [id])
  marketingSourceInfoId String?
  createdAt             DateTime             @default(now())
  updatedAt             DateTime             @updatedAt
}

model Posts {
  id               String     @id @default(uuid())
  title            String
  shortDescription String?
  content          String
  slug             String     @unique
  coverImage       String
  readingTime      Int        @default(0)
  views            Int        @default(0)
  source           Json?
  user             User       @relation(fields: [userId], references: [id])
  userId           String
  podCategory      Categories @relation(fields: [podCategoryId], references: [id])
  podCategoryId    String
  createdAt        DateTime   @default(now())
  updatedAt        DateTime   @updatedAt

  @@index([userId])
  @@index([podCategoryId])
}

model Books {
  id               String     @id @default(uuid())
  title            String
  shortDescription String?
  author           String
  readingTime      Int        @default(0)
  podCategory      Categories @relation(fields: [podCategoryId], references: [id])
  podCategoryId    String
  cover            String
  views            Int        @default(0)
  content          String
  createdAt        DateTime   @default(now())
  updatedAt        DateTime   @updatedAt

  @@index([podCategoryId])
}

model WorkerQueue {
  id          String            @id @default(cuid())
  type        String
  data        Json?
  user        User?             @relation(fields: [userId], references: [id])
  userId      String?
  comments    String?
  status      WorkerQueueStatus @default(PENDING)
  triggerTime DateTime?
  createdAt   DateTime          @default(now())
  updatedAt   DateTime          @updatedAt

  @@index([type])
  @@index([type, status])
}

model CalendarUserAuthorizedSlots {
  id                String           @id @default(cuid())
  userId            String
  user              User             @relation(fields: [userId], references: [id])
  masterclassSlotId String
  masterclassSlot   MasterClassSlots @relation(fields: [masterclassSlotId], references: [id])
  masterclassId     String
  masterclass       MasterClass      @relation(fields: [masterclassId], references: [id])
  createdAt         DateTime         @default(now())
  updatedAt         DateTime         @updatedAt

  @@unique([userId, masterclassSlotId])
  @@index([userId])
  @@index([masterclassSlotId])
}

model LiveclassPolls {
  id                     String                   @id @default(cuid())
  title                  String?
  question               String
  type                   LiveclassPollsType       @default(MULTI_CHOICE)
  options                LiveclassPollsOptions[]
  masterclass            MasterClass              @relation(fields: [masterclassId], references: [id])
  masterclassId          String
  totalResponses         Int                      @default(0)
  createdAt              DateTime                 @default(now())
  updatedAt              DateTime                 @updatedAt
  LiveclassPollsResponse LiveclassPollsResponse[]

  @@unique([masterclassId, question])
}

model LiveclassPollsOptions {
  id                     String                   @id @default(cuid())
  option                 String
  poll                   LiveclassPolls           @relation(fields: [pollId], references: [id])
  pollId                 String
  isCorrect              Boolean                  @default(false)
  totalVotes             Int                      @default(0)
  createdAt              DateTime                 @default(now())
  updatedAt              DateTime                 @updatedAt
  LiveclassPollsResponse LiveclassPollsResponse[]

  @@unique([pollId, option])
}

// polls response
model LiveclassPollsResponse {
  id        String                 @id @default(cuid())
  poll      LiveclassPolls         @relation(fields: [pollId], references: [id])
  pollId    String
  option    LiveclassPollsOptions? @relation(fields: [optionId], references: [id])
  optionId  String?
  answer    String?
  user      User                   @relation(fields: [userId], references: [id])
  userId    String
  meeting   ZoomMeetingURL         @relation(fields: [meetingId], references: [id])
  meetingId String
  createdAt DateTime               @default(now())
  updatedAt DateTime               @updatedAt

  @@unique([userId, meetingId, pollId, optionId])
}

model LiveclassPollsAnalytics {
  id        String         @id @default(cuid())
  meeting   ZoomMeetingURL @relation(fields: [meetingId], references: [id])
  meetingId String
  key       String
  value     Int            @default(0)
  createdAt DateTime       @default(now())
  updatedAt DateTime       @updatedAt

  @@unique([meetingId, key])
  @@index([meetingId])
  @@index([key])
}

model DodData {
  id                String   @id @default(cuid())
  dodDate           DateTime @db.Date
  masterclassSlotId String
  masterclassId     String?
  metricsData       Json?
  createdAt         DateTime @default(now())
  updatedAt         DateTime @updatedAt

  @@unique([masterclassSlotId])
  @@index([masterclassSlotId])
}

model WaCampaignData {
  id              String           @id @default(cuid())
  slotId          String
  customFieldId   String?
  campaignId      String?
  targetListId    String?
  templateId      String?
  status          WACampaignStatus @default(SCHEDULED)
  templateHealth  TemplateHealth   @default(UNKNOWN)
  metaData        Json?
  serviceProvider String?
  createdAt       DateTime         @default(now())
  updatedAt       DateTime         @updatedAt

  @@unique([campaignId])
  @@index([campaignId])
}

model marketingSpend {
  id        String   @id @default(cuid())
  slotId    String
  spendInfo Json?
  updatedAt DateTime @updatedAt
  createdAt DateTime @default(now())

  @@unique([slotId])
  @@index([slotId])
}

model Batches {
  id            String          @id @default(cuid())
  Bootcamp      Bootcamp        @relation(fields: [bootcampId], references: [id])
  bootcampId    String
  startDateTime DateTime
  endDateTime   DateTime
  Topics        String[]
  active        Boolean         @default(false)
  metaData      Json?
  PaymentIntent PaymentIntent[]
  User          User[]
  Modules       Modules[]
  brochurePdf   String?
  updatedAt     DateTime        @updatedAt
  createdAt     DateTime        @default(now())

  @@unique([bootcampId, startDateTime])
  @@index([bootcampId, startDateTime])
}

model RolloverRequests {
  id            String                @unique @default(cuid())
  requestedById String
  requestedBy   User                  @relation(fields: [requestedById], references: [id])
  status        RolloverRequestStatus @default(PENDING)
  metaData      Json?
  comments      String?
  updatedAt     DateTime              @updatedAt
  createdAt     DateTime              @default(now())
}

model Rollover {
  id              String         @unique @default(cuid())
  userId          String
  requestTicketId String
  previousBatchId String?
  rolledBatchId   String
  paymentIntent   PaymentIntent? @relation(fields: [paymentIntentId], references: [id])
  paymentIntentId String?
  rolloverType    RolloverType   @default(ADD)
  updatedAt       DateTime       @updatedAt
  createdAt       DateTime       @default(now())

  @@unique([previousBatchId, userId, rolledBatchId])
  @@index([previousBatchId, userId, rolledBatchId])
}

model Modules {
  id                  String               @id @unique @default(cuid())
  batch               Batches              @relation(fields: [batchId], references: [id])
  batchId             String
  startDateTime       DateTime
  title               String?
  description         String?
  meetingId           String?
  meetingPlatform     meetingPlatform      @default(OTHER)
  metaData            Json?
  recordings          String[]
  timelineSegments    timelineSegments[]   @relation("timelineSegmentsModules")
  pollId              String[]
  updatedAt           DateTime             @updatedAt
  createdAt           DateTime             @default(now())
  ModuleAssignments   ModuleAssignment[]
  ModuleResources     ModuleResource[]
  ModuleNotifications ModuleNotification[]
  ZoomMeetingURLs     ZoomMeetingURL[]
}

model RetargetingInteraction {
  id                 String              @id @default(cuid())
  user               User?               @relation(fields: [userId], references: [id])
  userId             String?
  masterclassSlot    MasterClassSlots?   @relation(fields: [masterclassSlotId], references: [id])
  masterclassSlotId  String?
  messageTemplates   String[]
  audienceTag        String?
  retargetingType    RetargetingType?    @default(UNDEFINED)
  retargetingChannel RetargetingChannel? @default(AISENSY)
  createdAt          DateTime            @default(now())
  updatedAt          DateTime            @updatedAt()
}

model dailyTracker_SlotData {
  id                String        @id @default(cuid())
  masterclassSlotId String
  scheduleDate      DateTime
  ClassTitle        String
  Teacher           String
  Category          String
  ClassTiming       String
  facilitator       String
  Support           String
  ZoomOwner         String?
  ClickTracker      Json?
  metaData          Json?
  waOpsData         Json?
  DailyTracker      DailyTracker? @relation(fields: [dailyTrackerId], references: [id])
  dailyTrackerId    String?

  @@unique([masterclassSlotId])
  @@index([masterclassSlotId])
}

model dailyTracker_Retargeting {
  id                String        @id @default(cuid())
  masterclassSlotId String
  leads             Int?
  retSpend          Int?
  smsSpend          Int?
  metaData          Json?
  Category          String?
  DailyTracker      DailyTracker? @relation(fields: [dailyTrackerId], references: [id])
  dailyTrackerId    String?

  @@unique([masterclassSlotId])
  @@index([masterclassSlotId])
}

model dailyTracker_Attendance {
  id                     String        @id @default(cuid())
  masterclassSlotId      String
  pitchAttendance        Int?          @default(0)
  peakAttendance         Int?          @default(0)
  peakAttendanceSources  Json?
  joiningSources         Json?
  zoomClassJoining       Json?
  joiningBifurcationData Json?
  Category               String?
  DailyTracker           DailyTracker? @relation(fields: [dailyTrackerId], references: [id])
  dailyTrackerId         String?

  @@unique([masterclassSlotId])
  @@index([masterclassSlotId])
}

model dailyTracker_Sales {
  id                   String        @id @default(cuid())
  masterclassSlotId    String
  totalSales           Int?          @default(0)
  CTP                  Float?        @default(0.0)
  Revenue              Float?        @default(0.0)
  ActualARPU           Float?        @default(0.0)
  salesBifurcationData Json?
  Category             String?
  DailyTracker         DailyTracker? @relation(fields: [dailyTrackerId], references: [id])
  dailyTrackerId       String?

  @@unique([masterclassSlotId])
  @@index([masterclassSlotId])
}

model DailyTracker {
  id              String                     @id @default(cuid())
  trackerDate     DateTime
  createdAt       DateTime                   @default(now())
  updatedAt       DateTime                   @updatedAt()
  trackerRevenue  Float                      @default(0.0)
  metaData        Json?
  slotsData       dailyTracker_SlotData[]
  retargetingData dailyTracker_Retargeting[]
  attendanceData  dailyTracker_Attendance[]
  salesData       dailyTracker_Sales[]

  @@unique([trackerDate])
  @@index([trackerDate])
}

model Blog {
  id               String     @id @default(cuid())
  createdAt        DateTime   @default(now())
  updatedAt        DateTime   @updatedAt()
  coverImage       String
  title            String
  shortDescription String?
  slug             String     @unique
  content          String
  views            Int        @default(0)
  isDraft          Boolean    @default(true)
  user             String
  categoryId       String
  category         Categories @relation(fields: [categoryId], references: [id])
}

model AdCoversion {
  id                  String                @id @default(cuid())
  platformResponse    Json?
  leadId              String?
  lead                Leads?                @relation(fields: [leadId], references: [id])
  paymentIntentId     String?
  paymentIntent       PaymentIntent?        @relation(fields: [paymentIntentId], references: [id])
  attendeeId          String?
  masterclassAttendee MasterclassAttendees? @relation(fields: [attendeeId], references: [id])
  platform            ConversionPlatform    @default(FACEBOOK)
  createdAt           DateTime              @default(now())
  updatedAt           DateTime              @updatedAt()
}

model Coupon {
  id               String          @id @default(cuid())
  code             String          @unique
  description      String
  isActive         Boolean         @default(false)
  expiry           DateTime
  discountPercent  Int
  maxDiscountPrice Int
  minProductValue  Int
  isGlobal         Boolean         @default(false)
  isPaidMc         Boolean         @default(false)
  isGold           Boolean         @default(false)
  exhaustLimit     Int?
  useCount         Int             @default(0)
  createdBy        String?
  createdAt        DateTime        @default(now())
  updatedAt        DateTime        @updatedAt()
  PaymentIntent    PaymentIntent[]
  bootcamps        Bootcamp[]      @relation("bootcampCoupons")
  masterclasses    MasterClass[]   @relation("masterclassCoupons")
  categories       Categories[]    @relation("categoryCoupons")
  users            User[]          @relation("userCoupons")

  @@index([code])
}

model bxTracker {
  id              String   @unique @default(cuid())
  moduleId        String   @unique
  scheduleDate    DateTime
  title           String
  teacher         String
  category        String
  platform        String?
  freshAttendees  Int      @default(0)
  totalDuration   Int      @default(0)
  averageDuration Int      @default(0)
  dropPercentage  Int      @default(0)
  totalEnrolled   Int      @default(0)
  totalAttendees  Int      @default(0)
  peakAttendance  Int      @default(0)
  metaData        Json?

  @@index([moduleId, scheduleDate])
}

model featureFlag {
  id          String   @unique @default(cuid())
  flag        String   @unique
  description String?
  isActive    Boolean  @default(false)
  createdAt   DateTime @default(now())
  updatedAt   DateTime @updatedAt()

  @@index([flag])
}

model timelineSegments {
  id            String              @id @default(cuid())
  title         String
  description   String
  masterclassId String?
  masterclass   MasterClass?        @relation(fields: [masterclassId], references: [id])
  bootcampId    String?
  bootcamp      Bootcamp?           @relation(fields: [bootcampId], references: [id])
  rewardType    LiveclassRewardType @default(NONE)
  pollId        String?
  weight        Int                 @default(0)
  createdAt     DateTime            @default(now())
  updatedAt     DateTime            @updatedAt()
  body          Json?
  moduleId      String[]
  module        Modules[]           @relation("timelineSegmentsModules")
}

model LiveclassReward {
  id            String              @unique @default(cuid())
  rewardType    LiveclassRewardType
  body          Json
  meetingId     String
  masterclassId String?
  masterclass   MasterClass?        @relation(fields: [masterclassId], references: [id])
  bootcampId    String?
  bootcamp      Bootcamp?           @relation(fields: [bootcampId], references: [id])
  userId        String
  user          User                @relation(fields: [userId], references: [id])
  createdAt     DateTime            @default(now())
  updatedAt     DateTime            @updatedAt()
}

model UserReferPoints {
  id        String   @id @default(cuid())
  userId    String   @unique
  user      User     @relation(fields: [userId], references: [id])
  points    Int      @default(0)
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt

  @@index([userId])
}

model UserPointsTransaction {
  id           String                @id @default(cuid())
  userId       String
  user         User                  @relation("TransactionUser", fields: [userId], references: [id])
  joinedUserId String?
  joinedUser   User?                 @relation("TransactionJoinedUser", fields: [joinedUserId], references: [id])
  points       Int                   @default(0)
  type         PointsTransactionType
  typeEntity   String?
  metaData     Json?
  createdAt    DateTime              @default(now())
  updatedAt    DateTime              @updatedAt

  @@unique([userId, joinedUserId, type])
  @@index([userId])
  @@index([joinedUserId])
}

model AdStats {
  id               String         @id @default(cuid())
  platform         AdPlatformType @default(NONE)
  campaignId       String
  adsetId          String
  adId             String
  campaignName     String
  adsetName        String
  adName           String?
  spend            Float          @default(-1)
  impressions      Int            @default(-1)
  clicks           Int            @default(-1)
  reach            Int?
  inlineLinkClicks Int?
  videoViews       Int?
  videoP50Watched  Int?
  videoP100Watched Int?
  reportDate       DateTime
  createdAt        DateTime       @default(now())
  updatedAt        DateTime       @updatedAt

  @@index([campaignName])
}

model ModuleAssignment {
  id             String   @id @default(cuid())
  moduleId       String
  module         Modules  @relation(fields: [moduleId], references: [id])
  heading        String
  subHeading     String
  content        Json?
  assignmentLink String
  createdAt      DateTime @default(now())
  updatedAt      DateTime @updatedAt
}

model ModuleResource {
  id           String   @id @default(cuid())
  moduleId     String
  module       Modules  @relation(fields: [moduleId], references: [id])
  title        String
  description  String?
  resourceLink String
  metaData     Json?
  createdAt    DateTime @default(now())
  updatedAt    DateTime @updatedAt
}

model ModuleNotification {
  id          String   @id @default(cuid())
  moduleId    String
  module      Modules  @relation(fields: [moduleId], references: [id])
  title       String
  description String?
  isActive    Boolean
  metaData    Json?
  createdAt   DateTime @default(now())
  updatedAt   DateTime @updatedAt
}

model Astro_Kundali {
  id            String                 @id @default(cuid())
  generatedById String
  generatedBy   User                   @relation(fields: [generatedById], references: [id])
  kundaliType   Astrolearn_KundaliType @default(LAL_KITAB)
  userData      Json?
  metaData      Json?
  createdAt     DateTime               @default(now())
  updatedAt     DateTime               @updatedAt
}

model UnlockedFeatures {
  id         String       @id @default(cuid())
  userId     String       @unique
  user       User         @relation(fields: [userId], references: [id])
  unlockType UnlockType[] @default([])
  metaData   Json?
  createdAt  DateTime     @default(now())
  updatedAt  DateTime     @updatedAt

  @@index([userId])
}
Editor is loading...
Leave a Comment