@creator.co/creatorco-prisma-client 1.0.15 → 1.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/schema.prisma CHANGED
@@ -32,7 +32,7 @@ model User {
32
32
  email String? @unique
33
33
  password String?
34
34
  registered DateTime @default(now())
35
- lastLoginDate DateTime?
35
+ lastLoginDate DateTime?
36
36
  firstName String?
37
37
  lastName String?
38
38
  phone String?
@@ -43,7 +43,7 @@ model User {
43
43
  affiliateSlug String? @unique
44
44
  closed DateTime?
45
45
  closedReason String?
46
- usercomLastSynced DateTime?
46
+ usercomLastSynced DateTime? @default(now())
47
47
  extraData Json @default("{}")
48
48
 
49
49
  referrerId Int?
@@ -299,6 +299,9 @@ model BrandUserProfile {
299
299
  user User @relation(fields: [userId], references: [id], onDelete: Cascade)
300
300
  brand Brand @relation(fields: [brandId], references: [id], onDelete: Cascade)
301
301
 
302
+ @@index([userId])
303
+ @@index([brandId])
304
+
302
305
  @@map("branduserprofile")
303
306
  }
304
307
 
@@ -338,11 +341,11 @@ model Brand {
338
341
  sequences Sequence[]
339
342
  impactRadiusEvents ImpactRadiusEvent[]
340
343
 
341
- // for agencies
344
+ // for agencies
342
345
  parentBrandId Int?
343
346
  parentBrand Brand? @relation("ChildBrands", fields: [parentBrandId], references: [id])
344
347
  childBrands Brand[] @relation("ChildBrands")
345
- // generated (for search)
348
+ // generated (for search)
346
349
  searchName String? @default(dbgenerated())
347
350
 
348
351
  @@map("brand")
@@ -393,6 +396,7 @@ model BrandToImage {
393
396
 
394
397
  sizes BrandImage[]
395
398
 
399
+ @@index([brandId])
396
400
  @@map("brandtoimage")
397
401
  }
398
402
 
@@ -446,6 +450,7 @@ model Message {
446
450
  user User? @relation(fields: [userId], references: [id])
447
451
  chat Chat @relation(fields: [chatId], references: [id], onDelete: Cascade)
448
452
 
453
+ @@index([chatId])
449
454
  @@map("message")
450
455
  }
451
456
 
@@ -518,6 +523,7 @@ model Campaign {
518
523
  optInViews OptInView[]
519
524
  sequences Sequence[]
520
525
 
526
+ @@index([brandId])
521
527
  @@map("campaign")
522
528
  }
523
529
 
@@ -531,6 +537,8 @@ model CampaignPin {
531
537
  user User @relation(fields: [userId], references: [id], onDelete: Cascade)
532
538
  campaign Campaign @relation(fields: [campaignId], references: [id], onDelete: Cascade)
533
539
 
540
+ @@index([userId])
541
+
534
542
  @@map("campaignpin")
535
543
  }
536
544
 
@@ -625,6 +633,8 @@ model CampaignStep {
625
633
 
626
634
  optInSteps OptInStep[]
627
635
 
636
+ @@index([campaignId])
637
+
628
638
  @@map("campaignstep")
629
639
  }
630
640
 
@@ -640,6 +650,8 @@ model OptInStep {
640
650
  optIn OptIn @relation(fields: [optInId], references: [id], onDelete: Cascade)
641
651
  campaignStep CampaignStep @relation(fields: [campaignStepId], references: [id], onDelete: Cascade)
642
652
 
653
+ @@index([optInId])
654
+ @@index([campaignStepId])
643
655
  @@map("optinstep")
644
656
  }
645
657
 
@@ -668,7 +680,7 @@ model OptIn {
668
680
  seen Boolean @default(false)
669
681
  instructions String? @db.Text
670
682
  paymentAmount Float?
671
- paymentStatus String @default("pending")
683
+ paymentStatus String @default("pending") // depracated -- refer to trolley payment table
672
684
  extraData Json @default("{}")
673
685
 
674
686
  userId Int
@@ -683,10 +695,41 @@ model OptIn {
683
695
  optInSteps OptInStep[]
684
696
  chat Chat?
685
697
  campaignInvites CampaignInvite[]
698
+ trolleyPayments TrolleyPayment[]
686
699
 
700
+ @@index([userId])
701
+ @@index([campaignId])
687
702
  @@map("optin")
688
703
  }
689
704
 
705
+ model TrolleyPayment {
706
+ id Int @id @default(autoincrement())
707
+ paymentId String @unique
708
+ type trolleyPaymentType?
709
+ status trolleyPaymentStatus @default(created)
710
+ optInId Int
711
+ paymentAmount Int
712
+ metaData Json @default("{}")
713
+
714
+ optIn OptIn @relation(fields: [optInId], references:[id])
715
+ }
716
+
717
+ enum trolleyPaymentType {
718
+ optIn
719
+ tip
720
+ affiliate
721
+ }
722
+
723
+ enum trolleyPaymentStatus {
724
+ created
725
+ updated
726
+ deleted
727
+ processed
728
+ failed
729
+ returned
730
+ }
731
+
732
+
690
733
  model OptInVariable {
691
734
  id Int @id @default(autoincrement())
692
735
 
@@ -697,6 +740,8 @@ model OptInVariable {
697
740
  optIn OptIn @relation(fields: [optInId], references: [id], onDelete: Cascade)
698
741
  variable Variable @relation(fields: [variableId], references: [id], onDelete: Cascade)
699
742
  selectedOption VariableOption @relation(fields: [selectedOptionId], references: [id], onDelete: Cascade)
743
+
744
+ @@index([optInId])
700
745
  }
701
746
 
702
747
  model SocialPost {
@@ -706,7 +751,6 @@ model SocialPost {
706
751
  data Json @default("{}") // DEPRECATED, USE metaData instead, seems to be an error when attempting to remove this field, proabably due to table size
707
752
  lastFetched DateTime?
708
753
  lastWebhook DateTime?
709
- isStale Boolean? // TODO: this field is here because prisma doesn't support comparing one column to another, ideally we could just check if lastFetched > lastWebhook but for now we need to control/check this field
710
754
 
711
755
  // BASIC INFO
712
756
  posted DateTime?
@@ -746,7 +790,10 @@ model SocialPost {
746
790
 
747
791
  socialPostTags SocialPostTag[]
748
792
 
749
- @@index(isStale)
793
+ @@index(campaignId)
794
+ @@index(userId)
795
+ @@index(posted)
796
+
750
797
  @@map("socialpost")
751
798
  }
752
799
 
@@ -781,6 +828,8 @@ model BrandImage {
781
828
  brandImageId Int
782
829
 
783
830
  brandImage BrandToImage @relation(fields: [brandImageId], references: [id], onDelete: Cascade)
831
+
832
+ @@index([brandImageId])
784
833
  @@map("brandimage")
785
834
  }
786
835
 
@@ -825,6 +874,8 @@ model PaymentTransaction {
825
874
  creator User? @relation(fields: [creatorId], references: [id])
826
875
  prevTransaction PaymentTransaction? @relation("TransactionHistory", fields: [prevTransactionId], references: [id])
827
876
  nextTransaction PaymentTransaction? @relation("TransactionHistory")
877
+
878
+ @@index([accountId])
828
879
  }
829
880
 
830
881
  model BrandAffiliateLink {
@@ -839,6 +890,8 @@ model BrandAffiliateLink {
839
890
  affiliateLinks AffiliateLink[]
840
891
 
841
892
  brand Brand @relation(fields: [brandId], references: [id])
893
+
894
+ @@index([brandId])
842
895
  }
843
896
 
844
897
  model AffiliateLink {
@@ -898,7 +951,7 @@ model SavedFile {
898
951
 
899
952
  model CampaignInvite {
900
953
  id Int @default(autoincrement()) @id
901
- socialProfileId Int?
954
+ socialProfileId Int?
902
955
  brandId Int
903
956
  campaignId Int?
904
957
  optInId Int? @unique
@@ -906,14 +959,15 @@ model CampaignInvite {
906
959
  createdAt DateTime @default(now())
907
960
  declineDate DateTime?
908
961
  declineReason String? @db.Text
909
-
962
+
910
963
  metaData Json? @default("{}")
911
964
 
912
965
  brand Brand @relation(fields: [brandId], references: [id], onDelete: Cascade)
913
966
  campaign Campaign? @relation(fields: [campaignId], references: [id])
914
967
  socialProfile SocialProfile? @relation(fields: [socialProfileId], references: [id])
915
968
  optIn OptIn? @relation(fields: [optInId], references: [id])
916
-
969
+
970
+ @@index([socialProfileId])
917
971
  }
918
972
 
919
973
  model CreatorList {
@@ -947,11 +1001,12 @@ model CreatorListItem {
947
1001
 
948
1002
  creatorList CreatorList @relation(fields: [creatorListId], references: [id], onDelete: Cascade)
949
1003
  socialProfile SocialProfile? @relation(fields: [socialProfileId], references: [id], onDelete: Cascade)
950
-
1004
+
951
1005
  sequenceOutboundEmails SequenceOutboundEmail[]
952
1006
  sequenceInboundEmails SequenceInboundEmail[]
953
1007
  sequenceImapCheckpoints SequenceImapCheckpoint[]
954
1008
 
1009
+ @@index([creatorListId])
955
1010
  @@map("creatorlistitem")
956
1011
  }
957
1012
 
@@ -982,6 +1037,7 @@ model SocialProfile {
982
1037
  user User? @relation(fields: [userId], references: [id])
983
1038
 
984
1039
  @@index(username)
1040
+ @@index(userId)
985
1041
  @@map("socialprofile")
986
1042
  }
987
1043
 
@@ -993,6 +1049,7 @@ model MessageTemplate {
993
1049
  brand Brand? @relation(fields: [brandId], references: [id])
994
1050
  metaData Json @default("{}") // to save any additional data such as user defined variables
995
1051
 
1052
+ @@index([brandId])
996
1053
  @@map("messagetemplate")
997
1054
  }
998
1055
 
@@ -1002,11 +1059,13 @@ model EmailTemplate {
1002
1059
  subject String?
1003
1060
  template String @db.Text
1004
1061
  brandId Int?
1005
-
1062
+
1006
1063
  brand Brand? @relation(fields: [brandId], references: [id])
1007
1064
  metaData Json @default("{}") // to save any additional data such as user defined variables
1008
1065
 
1009
1066
  sequenceSteps SequenceStep[]
1067
+
1068
+ @@index([brandId])
1010
1069
  }
1011
1070
 
1012
1071
  model SocialListeningList {
@@ -1035,6 +1094,7 @@ model ListToSocialPost {
1035
1094
  list SocialListeningList @relation(fields: [listId], references: [id], onDelete: Cascade)
1036
1095
  socialPost SocialPost @relation(fields: [postId], references: [id], onDelete: Cascade)
1037
1096
 
1097
+ @@index([listId, postId])
1038
1098
  @@map("listtosocialpost")
1039
1099
  }
1040
1100
 
package/wasm.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './index'