@creator.co/creatorco-prisma-client 1.0.5 → 1.0.7

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
@@ -24,66 +24,68 @@ datasource db {
24
24
  url = env("DATABASE_URL")
25
25
  }
26
26
 
27
- /// comment=This is your Prisma schema file,
28
27
  model User {
29
- /// comment=This is your id field,
30
- id Int @id @default(autoincrement())
28
+ id Int @default(autoincrement()) @id
31
29
  role String
32
- email String? @unique
30
+ email String? @unique
33
31
  password String?
34
- registered DateTime @default(now())
35
- lastLoginDate DateTime?
32
+ registered DateTime @default(now())
33
+ lastLoginDate DateTime?
36
34
  firstName String?
37
35
  lastName String?
38
36
  phone String?
39
37
  phoneCode Int?
40
38
  phoneShort String?
41
- profilePicUrl String? @db.VarChar(2083)
42
- forgotPasswordKey String? @unique
43
- affiliateSlug String? @unique
39
+ profilePicUrl String? @db.VarChar(2083)
40
+ forgotPasswordKey String? @unique
41
+ affiliateSlug String? @unique
44
42
  closed DateTime?
45
43
  closedReason String?
46
44
  usercomLastSynced DateTime?
47
- extraData Json @default("{}")
48
- referrerId Int?
49
- affiliateLinks AffiliateLink[]
45
+ extraData Json @default("{}")
46
+
47
+ referrerId Int?
48
+
49
+ referrer User? @relation("Referrals", fields: [referrerId], references: [id])
50
+ referredUsers User[] @relation("Referrals")
50
51
  logs Log[]
51
- paymentTransactions PaymentTransaction[]
52
- assignedBrands Brand[]
53
- brandProfiles BrandUserProfile[]
54
- campaignPins CampaignPin[]
55
52
  creatorProfile CreatorProfile?
56
- facebookProfile FacebookProfile?
57
53
  instagramProfile InstagramProfile?
58
- messages Message[]
54
+ youtubeProfile YoutubeProfile?
55
+ tiktokProfile TiktokProfile?
56
+ facebookProfile FacebookProfile?
57
+ twitterProfile TwitterProfile?
58
+ twitchProfile TwitchProfile?
59
+ brandProfiles BrandUserProfile[]
59
60
  optIns OptIn[]
60
- rakutenActivity RakutenActivity[]
61
+ assignedBrands Brand[]
62
+ messages Message[]
61
63
  socialPosts SocialPost[]
64
+ paymentTransactions PaymentTransaction[]
65
+ affiliateLinks AffiliateLink[]
66
+ campaignPins CampaignPin[]
62
67
  socialProfiles SocialProfile[]
63
- tiktokProfile TiktokProfile?
64
- twitchProfile TwitchProfile?
65
- twitterProfile TwitterProfile?
66
- referrer User? @relation("Referrals", fields: [referrerId], references: [id])
67
- referredUsers User[] @relation("Referrals")
68
- youtubeProfile YoutubeProfile?
68
+ rakutenActivity RakutenActivity[]
69
69
 
70
70
  @@map("user")
71
+ // @@fulltext([firstName, lastName])
71
72
  }
72
73
 
73
74
  model Log {
74
- id Int @id @default(autoincrement())
75
+ id Int @id @default(autoincrement())
76
+
75
77
  userId Int?
76
- data Json?
77
78
  user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
79
+
80
+ data Json?
78
81
  }
79
82
 
80
83
  model CreatorProfile {
81
- id Int @id @default(autoincrement())
84
+ id Int @id @default(autoincrement())
82
85
  country String?
83
86
  region String?
84
87
  birthDate DateTime?
85
- /// deprecated
86
- interests Json?
88
+ interests Json? // deprecated
87
89
  gender String?
88
90
  shippingAddress1 String?
89
91
  shippingAddress2 String?
@@ -92,28 +94,32 @@ model CreatorProfile {
92
94
  shippingCountry String?
93
95
  shippingPostcode String?
94
96
  phylloUserId String?
95
- profileSlug String? @unique
97
+ profileSlug String? @unique
96
98
  profileSettings Json?
97
- walletAddress String? @unique
98
- userId Int @unique
99
- niches CreatorToCategory[]
100
- user User @relation(fields: [userId], references: [id], onDelete: Cascade)
99
+ walletAddress String? @unique
100
+
101
+ niches CreatorToCategory[]
101
102
 
102
- @@index([phylloUserId])
103
+ userId Int @unique
104
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
105
+
106
+ @@index(phylloUserId)
103
107
  @@map("creatorprofile")
104
108
  }
105
109
 
106
110
  model InstagramProfile {
107
- id Int @id @default(autoincrement())
108
- instagramId String?
109
- /// fields consistent accross profiles
110
- username String
111
- url String? @db.VarChar(2083)
112
- profilePicUrl String? @db.VarChar(2083)
113
- followerCount Int?
114
- engagement Float?
115
- lastUpdated DateTime?
116
- fullName String?
111
+ id Int @id @default(autoincrement())
112
+ instagramId String?
113
+
114
+ // fields consistent accross profiles
115
+ username String
116
+ url String? @db.VarChar(2083)
117
+ profilePicUrl String? @db.VarChar(2083)
118
+ followerCount Int?
119
+ engagement Float?
120
+ lastUpdated DateTime?
121
+
122
+ fullName String? @db.VarChar(1024)
117
123
  isBusiness Boolean?
118
124
  isPrivate Boolean?
119
125
  isVerified Boolean?
@@ -131,222 +137,253 @@ model InstagramProfile {
131
137
  hasGuides Boolean?
132
138
  hasChannel Boolean?
133
139
  totalIgtvVideos Int?
134
- /// DEPRECATED
135
- profilePicUrlHd String? @db.VarChar(2083)
140
+ profilePicUrlHd String? @db.VarChar(2083) // DEPRECATED
136
141
  lastStoriesUpdate DateTime?
137
- extraData Json?
138
- phylloData Json?
139
- audienceData Json @default("{}")
140
- visibility String? @default("public")
141
- userId Int? @unique
142
- brandId Int? @unique
143
- brand Brand? @relation(fields: [brandId], references: [id], onDelete: Cascade)
144
- user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
145
-
146
- @@index([username])
147
- @@index([instagramId])
142
+
143
+ extraData Json?
144
+ phylloData Json?
145
+ audienceData Json @default("{}")
146
+ visibility String? @default("public")
147
+
148
+ userId Int? @unique
149
+ user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
150
+ brandId Int? @unique
151
+ brand Brand? @relation(fields: [brandId], references: [id], onDelete: Cascade)
152
+
153
+ @@index(username)
154
+ @@index(instagramId)
148
155
  @@map("instagramprofile")
149
156
  }
150
157
 
151
158
  model TiktokProfile {
152
- id Int @id @default(autoincrement())
153
- tiktokId String @unique
154
- /// fields consistent accross profiles
155
- username String?
156
- url String? @db.VarChar(2083)
157
- profilePicUrl String? @db.VarChar(2083)
158
- followerCount Int?
159
- engagement Float?
160
- lastUpdated DateTime?
159
+ id Int @id @default(autoincrement())
160
+ tiktokId String @unique
161
+
162
+ // fields consistent accross profiles
163
+ username String?
164
+ url String? @db.VarChar(2083)
165
+ profilePicUrl String? @db.VarChar(2083)
166
+ followerCount Int?
167
+ engagement Float?
168
+ lastUpdated DateTime?
169
+
161
170
  handle String?
162
171
  nickname String?
163
172
  followingCount Int?
164
173
  totalComments Int?
165
174
  totalLikes Int?
166
- extraData Json?
167
- phylloData Json?
168
- audienceData Json @default("{}")
169
- visibility String? @default("public")
170
- userId Int? @unique
171
- brandId Int? @unique
172
- brand Brand? @relation(fields: [brandId], references: [id], onDelete: Cascade)
173
- user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
174
-
175
- @@index([username])
175
+
176
+ extraData Json?
177
+ phylloData Json?
178
+ audienceData Json @default("{}")
179
+ visibility String? @default("public")
180
+
181
+ userId Int? @unique
182
+ user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
183
+ brandId Int? @unique
184
+ brand Brand? @relation(fields: [brandId], references: [id], onDelete: Cascade)
185
+
186
+ @@index(username)
176
187
  @@map("tiktokprofile")
177
188
  }
178
189
 
179
190
  model YoutubeProfile {
180
- id Int @id @default(autoincrement())
181
- youtubeId String @unique
182
- /// fields consistent accross profiles
183
- username String
184
- url String? @db.VarChar(2083)
185
- profilePicUrl String? @db.VarChar(2083)
186
- followerCount Int?
187
- engagement Float?
188
- lastUpdated DateTime?
191
+ id Int @id @default(autoincrement())
192
+ youtubeId String @unique
193
+
194
+ // fields consistent accross profiles
195
+ username String
196
+ url String? @db.VarChar(2083)
197
+ profilePicUrl String? @db.VarChar(2083)
198
+ followerCount Int?
199
+ engagement Float?
200
+ lastUpdated DateTime?
201
+
189
202
  followingCount Int?
190
- fullName String?
203
+ fullName String? @db.VarChar(1024)
191
204
  isVerified Boolean?
192
205
  subscribers Int?
193
- description String?
206
+ description String? @db.Text
194
207
  country String?
195
208
  totalViews Int?
196
209
  totalVideos Int?
197
- extraData Json?
198
- phylloData Json?
199
- audienceData Json @default("{}")
200
- visibility String? @default("public")
201
- userId Int? @unique
202
- brandId Int? @unique
203
- brand Brand? @relation(fields: [brandId], references: [id], onDelete: Cascade)
204
- user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
205
-
206
- @@index([username])
210
+
211
+ extraData Json?
212
+ phylloData Json?
213
+ audienceData Json @default("{}")
214
+ visibility String? @default("public")
215
+
216
+ userId Int? @unique
217
+ user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
218
+ brandId Int? @unique
219
+ brand Brand? @relation(fields: [brandId], references: [id], onDelete: Cascade)
220
+
221
+ @@index(username)
207
222
  @@map("youtubeprofile")
208
223
  }
209
224
 
210
225
  model TwitchProfile {
211
- id Int @id @default(autoincrement())
212
- twitchId String @unique
213
- /// fields consistent accross profiles
226
+ id Int @id @default(autoincrement())
227
+ twitchId String @unique
228
+
229
+ // fields consistent accross profiles
214
230
  username String @unique
215
231
  url String? @db.VarChar(2083)
216
232
  profilePicUrl String? @db.VarChar(2083)
217
233
  followerCount Int?
218
234
  engagement Float?
219
235
  lastUpdated DateTime?
220
- extraData Json?
221
- phylloData Json?
222
- visibility String? @default("public")
223
- userId Int? @unique
224
- user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
236
+
237
+ extraData Json?
238
+ phylloData Json?
239
+ visibility String? @default("public")
240
+
241
+ userId Int? @unique
242
+ user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
225
243
 
226
244
  @@map("twitchprofile")
227
245
  }
228
246
 
229
247
  model FacebookProfile {
230
- id Int @id @default(autoincrement())
231
- facebookId String @unique
232
- /// fields consistent accross profiles
248
+ id Int @id @default(autoincrement())
249
+ facebookId String @unique
250
+
251
+ // fields consistent accross profiles
233
252
  username String @unique
234
253
  url String? @db.VarChar(2083)
235
254
  profilePicUrl String? @db.VarChar(2083)
236
255
  followerCount Int?
237
256
  engagement Float?
238
257
  lastUpdated DateTime?
239
- extraData Json?
240
- phylloData Json?
241
- visibility String? @default("public")
242
- userId Int? @unique
243
- user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
258
+
259
+ extraData Json?
260
+ phylloData Json?
261
+ visibility String? @default("public")
262
+
263
+ userId Int? @unique
264
+ user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
244
265
 
245
266
  @@map("facebookprofile")
246
267
  }
247
268
 
248
269
  model TwitterProfile {
249
- id Int @id @default(autoincrement())
250
- twitterId String @unique
251
- /// fields consistent accross profiles
270
+ id Int @id @default(autoincrement())
271
+ twitterId String @unique
272
+
273
+ // fields consistent accross profiles
252
274
  username String @unique
253
275
  url String? @db.VarChar(2083)
254
276
  profilePicUrl String? @db.VarChar(2083)
255
277
  followerCount Int?
256
278
  engagement Float?
257
279
  lastUpdated DateTime?
258
- extraData Json?
259
- phylloData Json?
260
- visibility String? @default("public")
261
- userId Int? @unique
262
- user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
280
+
281
+ extraData Json?
282
+ phylloData Json?
283
+ visibility String? @default("public")
284
+
285
+ userId Int? @unique
286
+ user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
263
287
 
264
288
  @@map("twitterprofile")
265
289
  }
266
290
 
267
291
  model BrandUserProfile {
268
- id Int @id @default(autoincrement())
292
+ id Int @id @default(autoincrement())
269
293
  userId Int
270
294
  brandId Int
271
- brand Brand @relation(fields: [brandId], references: [id], onDelete: Cascade)
272
- user User @relation(fields: [userId], references: [id], onDelete: Cascade)
295
+
296
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
297
+ brand Brand @relation(fields: [brandId], references: [id], onDelete: Cascade)
273
298
 
274
299
  @@map("branduserprofile")
275
300
  }
276
301
 
277
302
  model Brand {
278
- id Int @id @default(autoincrement())
303
+ id Int @id @default(autoincrement())
279
304
  name String
280
- description String?
305
+ description String? @db.Text
281
306
  website String
282
307
  monthlyContacts Int?
283
308
  monthlyReports Int?
284
309
  lastContactDistribution DateTime?
285
- logoUrl String? @db.VarChar(2083)
286
- affiliateBaseUrl String? @db.VarChar(2083)
310
+ logoUrl String? @db.VarChar(2083)
311
+ affiliateBaseUrl String? @db.VarChar(2083)
287
312
  affiliateCommission Float?
288
- extraData Json @default("{}")
289
- specialistId Int?
290
- affiliateLinks BrandAffiliateLink[]
291
- campaignInvites CampaignInvite[]
292
- emailTemplates EmailTemplate[]
293
- paymentTransactions PaymentTransaction[]
294
- dedicatedSpecialist User? @relation(fields: [specialistId], references: [id])
295
- categories BrandToCategory[]
296
- images BrandToImage[]
297
- brandUsers BrandUserProfile[]
298
- campaigns Campaign[]
299
- creatorLists CreatorList[]
300
- instagramProfile InstagramProfile?
301
- messageTemplate MessageTemplate[]
302
- reportCredits ReportCredits[]
303
- savedfiles SavedFile[]
304
- searchContacts SearchContacts[]
305
- socialListeningLists SocialListeningList[]
306
- tiktokProfile TiktokProfile?
307
- youtubeProfile YoutubeProfile?
313
+ extraData Json @default("{}")
314
+
315
+ specialistId Int?
316
+ dedicatedSpecialist User? @relation(fields: [specialistId], references: [id])
317
+ instagramProfile InstagramProfile?
318
+ youtubeProfile YoutubeProfile?
319
+ tiktokProfile TiktokProfile?
320
+ campaigns Campaign[]
321
+ brandUsers BrandUserProfile[]
322
+ searchContacts SearchContacts[]
323
+ reportCredits ReportCredits[]
324
+ categories BrandToCategory[]
325
+ paymentTransactions PaymentTransaction[]
326
+ savedfiles SavedFile[]
327
+ creatorLists CreatorList[]
328
+ affiliateLinks BrandAffiliateLink[]
329
+ messageTemplate MessageTemplate[]
330
+ emailTemplates EmailTemplate[]
331
+ socialListeningLists SocialListeningList[]
332
+ campaignInvites CampaignInvite[]
333
+ images BrandToImage[]
334
+
335
+ // for agencies
336
+ parentBrandId Int?
337
+ parentBrand Brand? @relation("ChildBrands", fields: [parentBrandId], references: [id])
338
+ childBrands Brand[] @relation("ChildBrands")
308
339
 
309
340
  @@map("brand")
310
341
  }
311
342
 
312
343
  model SearchContacts {
313
- id Int @id @default(autoincrement())
314
- type String
315
- prevQty Float
316
- changeQty Float
317
- currentQty Float
318
- created DateTime? @default(now())
344
+ id Int @id @default(autoincrement())
345
+ type String
346
+ prevQty Float
347
+ changeQty Float
348
+ currentQty Float
349
+ created DateTime? @default(now())
350
+
319
351
  prevQtyPostId Int? @unique
320
- brandId Int
321
- brand Brand @relation(fields: [brandId], references: [id])
322
352
  prevQtyPost SearchContacts? @relation("prevSearchQtyPostId", fields: [prevQtyPostId], references: [id])
323
353
  nextQtyPost SearchContacts? @relation("prevSearchQtyPostId")
324
354
 
355
+ brandId Int
356
+ brand Brand @relation(fields: [brandId], references: [id])
357
+
325
358
  @@map("searchcontacts")
326
359
  }
327
360
 
328
361
  model ReportCredits {
329
- id Int @id @default(autoincrement())
330
- type String
331
- prevQty Float
332
- changeQty Float
333
- currentQty Float
334
- created DateTime? @default(now())
362
+ id Int @id @default(autoincrement())
363
+ type String
364
+ prevQty Float
365
+ changeQty Float
366
+ currentQty Float
367
+ created DateTime? @default(now())
368
+
335
369
  prevQtyPostId Int? @unique
336
- brandId Int
337
- brand Brand @relation(fields: [brandId], references: [id])
338
370
  prevQtyPost ReportCredits? @relation("prevReportsQtyPostId", fields: [prevQtyPostId], references: [id])
339
371
  nextQtyPost ReportCredits? @relation("prevReportsQtyPostId")
340
372
 
373
+ brandId Int
374
+ brand Brand @relation(fields: [brandId], references: [id])
375
+
341
376
  @@map("reportcredits")
342
377
  }
343
378
 
344
379
  model BrandToImage {
345
- id Int @id @default(autoincrement())
346
- brandId Int
347
- type String
348
- sizes BrandImage[]
349
- brand Brand @relation(fields: [brandId], references: [id], onDelete: Cascade)
380
+ id Int @default(autoincrement()) @id
381
+ brandId Int
382
+ type String
383
+
384
+ brand Brand @relation(fields: [brandId], references: [id], onDelete: Cascade)
385
+
386
+ sizes BrandImage[]
350
387
 
351
388
  @@map("brandtoimage")
352
389
  }
@@ -354,8 +391,9 @@ model BrandToImage {
354
391
  model BrandToCategory {
355
392
  brandId Int
356
393
  categoryId Int
357
- campaign Brand @relation(fields: [brandId], references: [id], onDelete: Cascade)
358
- category Category @relation(fields: [categoryId], references: [id])
394
+
395
+ campaign Brand @relation(fields: [brandId], references: [id], onDelete: Cascade)
396
+ category Category @relation(fields: [categoryId], references: [id])
359
397
 
360
398
  @@id([brandId, categoryId])
361
399
  @@map("brandtocategory")
@@ -364,8 +402,9 @@ model BrandToCategory {
364
402
  model CreatorToCategory {
365
403
  creatorProfileId Int
366
404
  categoryId Int
367
- category Category @relation(fields: [categoryId], references: [id])
368
- creatorProfile CreatorProfile @relation(fields: [creatorProfileId], references: [id], onDelete: Cascade)
405
+
406
+ creatorProfile CreatorProfile @relation(fields: [creatorProfileId], references: [id], onDelete: Cascade)
407
+ category Category @relation(fields: [categoryId], references: [id])
369
408
 
370
409
  @@id([creatorProfileId, categoryId])
371
410
  }
@@ -375,9 +414,11 @@ model Chat {
375
414
  created DateTime? @default(now())
376
415
  conversationId String? @unique
377
416
  metaData Json @default("{}")
378
- optInId Int? @unique
379
- optIn OptIn? @relation(fields: [optInId], references: [id])
380
- messages Message[]
417
+
418
+ optInId Int? @unique
419
+
420
+ optIn OptIn? @relation(fields: [optInId], references: [id])
421
+ messages Message[]
381
422
 
382
423
  @@map("chat")
383
424
  }
@@ -386,30 +427,31 @@ model Message {
386
427
  id Int @id @default(autoincrement())
387
428
  created DateTime? @default(now())
388
429
  sender String
389
- content String
430
+ content String @db.Text
390
431
  read Boolean @default(false)
391
432
  type String @default("text")
392
433
  messageSid String?
393
- userId Int?
394
- chatId Int
395
- chat Chat @relation(fields: [chatId], references: [id], onDelete: Cascade)
396
- user User? @relation(fields: [userId], references: [id])
434
+
435
+ userId Int?
436
+ chatId Int
437
+
438
+ user User? @relation(fields: [userId], references: [id])
439
+ chat Chat @relation(fields: [chatId], references: [id], onDelete: Cascade)
397
440
 
398
441
  @@map("message")
399
442
  }
400
443
 
401
444
  model Campaign {
402
- id Int @id @default(autoincrement())
445
+ id Int @id @default(autoincrement())
403
446
  title String
404
- slug String? @unique
405
- /// draft, paused, pending, private, publish, trash
406
- status String @default("draft")
407
- date DateTime @default(now())
447
+ slug String? @unique
448
+ status String @default("draft") // draft, paused, pending, private, publish, trash
449
+ date DateTime @default(now())
408
450
  publishDate DateTime?
409
- description String?
410
- productDescription String?
411
- prizeDescription String?
412
- strategy String? @default("shoutout")
451
+ description String? @db.Text
452
+ productDescription String? @db.Text
453
+ prizeDescription String? @db.Text
454
+ strategy String? @default("shoutout")
413
455
  socialChannel String?
414
456
  socialChannels Json?
415
457
  facebookReach Int?
@@ -424,48 +466,48 @@ model Campaign {
424
466
  tiktokEngagement Float?
425
467
  twitchReach Int?
426
468
  twitchEngagement Float?
427
- quantity Int @default(0)
469
+ quantity Int @default(0)
428
470
  holdCost Float?
429
471
  value Float?
430
472
  paidAmount Float?
431
473
  minAge Int?
432
474
  maxAge Int?
433
- visuals String?
475
+ visuals String? @db.Text
434
476
  photoTags Json?
435
477
  hashtags Json?
436
478
  storyHashtags Json?
437
479
  storyMentions Json?
438
- caption String?
480
+ caption String? @db.Text
439
481
  password String?
440
482
  contentFormats Json?
441
483
  paidCampaign Boolean?
442
484
  minPaidAmount Float?
443
485
  maxPaidAmount Float?
444
486
  paymentType String?
445
- /// Redundant/Deprecated
446
- monthlyActivatedGoal Int?
447
- /// Redundant/Deprecated
448
- expectedOptIns Int?
487
+ monthlyActivatedGoal Int? // Redundant/Deprecated
488
+ expectedOptIns Int? // Redundant/Deprecated
449
489
  goalActivations Float?
450
490
  goalOptIns Float?
451
491
  requiresShipping Boolean?
452
492
  disableQualifications Boolean?
453
493
  disableActivations Boolean?
454
494
  affiliateLinkPath String?
455
- metaData Json @default("{}")
456
- brandId Int
457
- campaignInvites CampaignInvite[]
458
- variables Variable[]
459
- brand Brand @relation(fields: [brandId], references: [id], onDelete: Cascade)
460
- campaignPins CampaignPin[]
461
- steps CampaignStep[]
462
- categories CampaignToCategory[]
463
- countries CampaignToCountry[]
464
- images CampaignToImage[]
465
- creatorLists CreatorList[]
466
- optIns OptIn[]
467
- optInViews OptInView[]
468
- socialPosts SocialPost[]
495
+ metaData Json @default("{}")
496
+
497
+ steps CampaignStep[]
498
+ categories CampaignToCategory[]
499
+ optIns OptIn[]
500
+ images CampaignToImage[]
501
+ variables Variable[]
502
+ countries CampaignToCountry[]
503
+ campaignPins CampaignPin[]
504
+ socialPosts SocialPost[]
505
+ campaignInvites CampaignInvite[]
506
+
507
+ brandId Int
508
+ brand Brand @relation(fields: [brandId], references: [id], onDelete: Cascade)
509
+ creatorLists CreatorList[]
510
+ optInViews OptInView[]
469
511
 
470
512
  @@map("campaign")
471
513
  }
@@ -476,18 +518,21 @@ model CampaignPin {
476
518
  campaignId Int
477
519
  created DateTime @default(now())
478
520
  notified DateTime?
479
- campaign Campaign @relation(fields: [campaignId], references: [id], onDelete: Cascade)
480
- user User @relation(fields: [userId], references: [id], onDelete: Cascade)
521
+
522
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
523
+ campaign Campaign @relation(fields: [campaignId], references: [id], onDelete: Cascade)
481
524
 
482
525
  @@map("campaignpin")
483
526
  }
484
527
 
485
528
  model CampaignToImage {
486
- id Int @id @default(autoincrement())
529
+ id Int @id @default(autoincrement())
487
530
  campaignId Int
488
531
  type String
489
- campaign Campaign @relation(fields: [campaignId], references: [id], onDelete: Cascade)
490
- sizes Image[]
532
+
533
+ campaign Campaign @relation(fields: [campaignId], references: [id], onDelete: Cascade)
534
+
535
+ sizes Image[]
491
536
 
492
537
  @@map("campaigntoimage")
493
538
  }
@@ -495,8 +540,9 @@ model CampaignToImage {
495
540
  model CampaignToCategory {
496
541
  campaignId Int
497
542
  categoryId Int
498
- campaign Campaign @relation(fields: [campaignId], references: [id], onDelete: Cascade)
499
- category Category @relation(fields: [categoryId], references: [id])
543
+
544
+ campaign Campaign @relation(fields: [campaignId], references: [id], onDelete: Cascade)
545
+ category Category @relation(fields: [categoryId], references: [id])
500
546
 
501
547
  @@id([campaignId, categoryId])
502
548
  @@map("campaigntocategory")
@@ -505,145 +551,160 @@ model CampaignToCategory {
505
551
  model CampaignToCountry {
506
552
  campaignId Int
507
553
  countryId Int
508
- campaign Campaign @relation(fields: [campaignId], references: [id], onDelete: Cascade)
509
- country Country @relation(fields: [countryId], references: [id])
554
+
555
+ campaign Campaign @relation(fields: [campaignId], references: [id], onDelete: Cascade)
556
+ country Country @relation(fields: [countryId], references: [id])
510
557
 
511
558
  @@id([campaignId, countryId])
512
559
  @@map("campaigntocountry")
513
560
  }
514
561
 
515
562
  model Variable {
516
- id Int @id @default(autoincrement())
517
- title String
518
- description String?
519
- metaData Json @default("{}")
520
- campaignId Int
521
- optInVariables OptInVariable[]
522
- campaign Campaign @relation(fields: [campaignId], references: [id], onDelete: Cascade)
563
+ id Int @id @default(autoincrement())
564
+ title String
565
+ description String? @db.Text
566
+ metaData Json @default("{}")
567
+
568
+ campaignId Int
569
+
570
+ campaign Campaign @relation(fields: [campaignId], references: [id], onDelete: Cascade)
571
+
523
572
  options VariableOption[]
573
+ optInVariables OptInVariable[]
524
574
  }
525
575
 
526
576
  model VariableOption {
527
- id Int @id @default(autoincrement())
528
- title String
529
- description String?
530
- metaData Json @default("{}")
531
- variableId Int
577
+ id Int @id @default(autoincrement())
578
+ title String
579
+ description String? @db.Text
580
+ metaData Json @default("{}")
581
+
582
+ variableId Int
583
+
584
+ variable Variable @relation(fields: [variableId], references: [id], onDelete: Cascade)
585
+
532
586
  optInVariables OptInVariable[]
533
- variable Variable @relation(fields: [variableId], references: [id], onDelete: Cascade)
534
587
  }
535
588
 
536
589
  model Step {
537
- id Int @id @default(autoincrement())
538
- slug String @unique
539
- title String?
540
- description String?
541
- data Json?
590
+ id Int @id @default(autoincrement())
591
+ slug String @unique
592
+ title String?
593
+ description String? @db.Text
594
+ data Json?
595
+
542
596
  campaignSteps CampaignStep[]
543
597
 
544
598
  @@map("step")
545
599
  }
546
600
 
547
601
  model CampaignStep {
548
- id Int @id @default(autoincrement())
549
- placement Int
550
- stepSettings Json?
551
- actionee String?
552
- instructions String?
553
- customStepTitle String?
554
- customForm Json?
555
- metaData Json @default("{}")
556
- campaignId Int
557
- stepId Int?
558
- campaign Campaign @relation(fields: [campaignId], references: [id], onDelete: Cascade)
559
- step Step? @relation(fields: [stepId], references: [id])
560
- currentOptIns OptIn[]
561
- optInSteps OptInStep[]
602
+ id Int @default(autoincrement()) @id
603
+ placement Int
604
+ stepSettings Json?
605
+ actionee String?
606
+ instructions String? @db.Text
607
+ customStepTitle String?
608
+ customForm Json?
609
+ metaData Json @default("{}")
610
+ campaignId Int
611
+ stepId Int?
612
+
613
+ campaign Campaign @relation(fields: [campaignId], references: [id], onDelete: Cascade)
614
+ step Step? @relation(fields: [stepId], references: [id])
615
+ currentOptIns OptIn[]
616
+
617
+ optInSteps OptInStep[]
562
618
 
563
619
  @@map("campaignstep")
564
620
  }
565
621
 
566
622
  model OptInStep {
567
- id Int @id @default(autoincrement())
568
- completed DateTime?
569
- data Json?
623
+ id Int @id @default(autoincrement())
624
+ completed DateTime?
625
+ data Json?
626
+
570
627
  optInId Int
571
628
  campaignStepId Int
572
- /// temporary for moving shoutoutData to socialPosts
573
- socialPostId Int?
574
- campaignStep CampaignStep @relation(fields: [campaignStepId], references: [id], onDelete: Cascade)
575
- optIn OptIn @relation(fields: [optInId], references: [id], onDelete: Cascade)
629
+ socialPostId Int? // temporary for moving shoutoutData to socialPosts
630
+
631
+ optIn OptIn @relation(fields: [optInId], references: [id], onDelete: Cascade)
632
+ campaignStep CampaignStep @relation(fields: [campaignStepId], references: [id], onDelete: Cascade)
576
633
 
577
634
  @@map("optinstep")
578
635
  }
579
636
 
580
637
  model Category {
581
- id Int @id @default(autoincrement())
582
- slug String @unique
583
- title String
584
- creators CreatorToCategory[]
585
- brands BrandToCategory[]
638
+ id Int @id @default(autoincrement())
639
+ slug String @unique
640
+ title String
641
+
586
642
  campaigns CampaignToCategory[]
643
+ brands BrandToCategory[]
644
+ creators CreatorToCategory[]
587
645
 
588
646
  @@map("category")
589
647
  }
590
648
 
591
649
  model OptIn {
592
- id Int @id @default(autoincrement())
593
- status String @default("pending")
594
- created DateTime @default(now())
650
+ id Int @id @default(autoincrement())
651
+ status String @default("pending")
652
+ created DateTime @default(now())
595
653
  activated DateTime?
596
654
  completed DateTime?
597
655
  cancelled DateTime?
598
- cancelledData Json @default("{}")
656
+ cancelledData Json @default("{}")
599
657
  cancelRequested DateTime?
600
658
  reinvited DateTime?
601
- seen Boolean @default(false)
602
- instructions String?
659
+ seen Boolean @default(false)
660
+ instructions String? @db.Text
603
661
  paymentAmount Float?
604
- paymentStatus String @default("pending")
605
- extraData Json @default("{}")
606
- userId Int
607
- campaignId Int
608
- currentStepId Int?
609
- campaignInvites CampaignInvite?
610
- variables OptInVariable[]
611
- chat Chat?
612
- campaign Campaign @relation(fields: [campaignId], references: [id], onDelete: Cascade)
613
- currentStep CampaignStep? @relation(fields: [currentStepId], references: [id])
614
- user User @relation(fields: [userId], references: [id], onDelete: Cascade)
615
- optInSteps OptInStep[]
662
+ paymentStatus String @default("pending")
663
+ extraData Json @default("{}")
664
+
665
+ userId Int
666
+ campaignId Int
667
+ currentStepId Int?
668
+
669
+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)
670
+ campaign Campaign @relation(fields: [campaignId], references: [id], onDelete: Cascade)
671
+ currentStep CampaignStep? @relation(fields: [currentStepId], references: [id])
672
+
673
+ variables OptInVariable[]
674
+ optInSteps OptInStep[]
675
+ chat Chat?
676
+ campaignInvites CampaignInvite[]
616
677
 
617
678
  @@map("optin")
618
679
  }
619
680
 
620
681
  model OptInVariable {
621
- id Int @id @default(autoincrement())
682
+ id Int @id @default(autoincrement())
683
+
622
684
  optInId Int
623
685
  variableId Int
624
686
  selectedOptionId Int
625
- optIn OptIn @relation(fields: [optInId], references: [id], onDelete: Cascade)
626
- selectedOption VariableOption @relation(fields: [selectedOptionId], references: [id], onDelete: Cascade)
627
- variable Variable @relation(fields: [variableId], references: [id], onDelete: Cascade)
687
+
688
+ optIn OptIn @relation(fields: [optInId], references: [id], onDelete: Cascade)
689
+ variable Variable @relation(fields: [variableId], references: [id], onDelete: Cascade)
690
+ selectedOption VariableOption @relation(fields: [selectedOptionId], references: [id], onDelete: Cascade)
628
691
  }
629
692
 
630
693
  model SocialPost {
631
- id Int @id @default(autoincrement())
632
- phylloId String? @unique
633
- metaData Json @default("{}")
634
- /// DEPRECATED, USE metaData instead, seems to be an error when attempting to remove this field, proabably due to table size
635
- data Json @default("{}")
636
- lastFetched DateTime?
637
- lastWebhook DateTime?
638
- /// 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
639
- isStale Boolean?
640
- /// BASIC INFO
694
+ id Int @id @default(autoincrement())
695
+ phylloId String? @unique
696
+ metaData Json @default("{}")
697
+ data Json @default("{}") // DEPRECATED, USE metaData instead, seems to be an error when attempting to remove this field, proabably due to table size
698
+ lastFetched DateTime?
699
+ lastWebhook DateTime?
700
+ 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
701
+
702
+ // BASIC INFO
641
703
  posted DateTime?
642
- title String?
643
- description String?
644
- url String? @db.VarChar(2083)
645
- /// This is here so we have some external identifier to quickly search by
646
- urlPath String? @unique
704
+ title String? @db.Text
705
+ description String? @db.Text
706
+ url String? @db.VarChar(2083)
707
+ urlPath String? @unique // This is here so we have some external identifier to quickly search by
647
708
  format String?
648
709
  type String?
649
710
  platform String?
@@ -651,7 +712,7 @@ model SocialPost {
651
712
  isSponsored Boolean?
652
713
  hasCollaborators Boolean?
653
714
  isOwnedByUser Boolean?
654
- /// METRICS
715
+ // METRICS
655
716
  views Int?
656
717
  impressions Int?
657
718
  impressionsOrganic Int?
@@ -660,278 +721,301 @@ model SocialPost {
660
721
  reachOrganic Int?
661
722
  reachPaid Int?
662
723
  watchHours Float?
663
- /// ENGAGEMENT METRICS
724
+ // ENGAGEMENT METRICS
664
725
  likes Int?
665
726
  dislikes Int?
666
727
  comments Int?
667
728
  saves Int?
668
729
  shares Int?
669
- userId Int?
670
- campaignId Int?
671
- lists ListToSocialPost[]
672
- campaign Campaign? @relation(fields: [campaignId], references: [id])
673
- user User? @relation(fields: [userId], references: [id])
674
- socialPostTags SocialPostTag[]
675
-
676
- @@index([isStale])
730
+
731
+ userId Int?
732
+ campaignId Int?
733
+
734
+ user User? @relation(fields: [userId], references: [id])
735
+ campaign Campaign? @relation(fields: [campaignId], references: [id])
736
+ lists ListToSocialPost[]
737
+
738
+ socialPostTags SocialPostTag[]
739
+
740
+ @@index(isStale)
677
741
  @@map("socialpost")
678
742
  }
679
743
 
680
744
  model SocialPostTag {
681
- id Int @id @default(autoincrement())
682
- title String
683
- type String
745
+ id Int @id @default(autoincrement())
746
+ title String
747
+ type String
748
+
684
749
  socialPostId Int
685
- socialPost SocialPost @relation(fields: [socialPostId], references: [id])
750
+
751
+ socialPost SocialPost @relation(fields: [socialPostId], references: [id])
686
752
 
687
753
  @@index([title, type])
688
754
  @@map("socialposttag")
689
755
  }
690
756
 
691
757
  model Image {
692
- id Int @id @default(autoincrement())
693
- url String @db.VarChar(2083)
758
+ id Int @id @default(autoincrement())
759
+ url String @db.VarChar(2083)
694
760
  size String
695
761
  campaignImageId Int
696
- campaignImage CampaignToImage @relation(fields: [campaignImageId], references: [id], onDelete: Cascade)
762
+
763
+ campaignImage CampaignToImage @relation(fields: [campaignImageId], references: [id], onDelete: Cascade)
697
764
 
698
765
  @@map("image")
699
766
  }
700
767
 
701
768
  model BrandImage {
702
- id Int @id @default(autoincrement())
703
- url String @db.VarChar(2083)
704
- size String
705
- brandImageId Int
706
- brandImage BrandToImage @relation(fields: [brandImageId], references: [id], onDelete: Cascade)
769
+ id Int @default(autoincrement()) @id
770
+ url String @db.VarChar(2083)
771
+ size String
772
+ brandImageId Int
707
773
 
774
+ brandImage BrandToImage @relation(fields: [brandImageId], references: [id], onDelete: Cascade)
708
775
  @@map("brandimage")
709
776
  }
710
777
 
711
778
  model Country {
712
- id Int @id @default(autoincrement())
713
- countryCode String @unique @db.VarChar(2)
714
- countryName String @db.VarChar(500)
715
- teleCode String @db.VarChar(10)
716
- campaigns CampaignToCountry[]
779
+ id Int @id @default(autoincrement())
780
+ countryCode String @unique @db.VarChar(2)
781
+ countryName String @db.VarChar(500)
782
+ teleCode String @db.VarChar(10)
717
783
  states State[]
718
784
 
785
+ campaigns CampaignToCountry[]
786
+
719
787
  @@map("country")
720
788
  }
721
789
 
722
790
  model State {
723
- id Int @id @default(autoincrement())
791
+ id Int @id @default(autoincrement())
724
792
  countryId Int
725
- stateCode String @db.VarChar(50)
726
- stateName String @db.VarChar(500)
727
- country Country @relation(fields: [countryId], references: [id])
793
+ stateCode String @db.VarChar(50)
794
+ stateName String @db.VarChar(500)
795
+
796
+ country Country @relation(fields: [countryId], references: [id])
728
797
 
729
798
  @@map("state")
730
799
  }
731
800
 
732
801
  model PaymentTransaction {
733
- id Int @id @default(autoincrement())
734
- amount Float
735
- balance Float
736
- type String
737
- date DateTime @default(now())
738
- notes String?
739
- metaData Json @default("{}")
740
- accountId Int
802
+ id Int @id @default(autoincrement())
803
+ amount Float
804
+ balance Float
805
+ type String
806
+ date DateTime @default(now())
807
+ notes String? @db.Text
808
+ metaData Json @default("{}")
809
+ accountId Int
810
+
741
811
  brandId Int?
742
812
  creatorId Int?
743
- prevTransactionId Int? @unique
744
- brand Brand? @relation(fields: [brandId], references: [id])
745
- creator User? @relation(fields: [creatorId], references: [id])
746
- prevTransaction PaymentTransaction? @relation("TransactionHistory", fields: [prevTransactionId], references: [id])
747
- nextTransaction PaymentTransaction? @relation("TransactionHistory")
813
+ prevTransactionId Int? @unique
814
+
815
+ brand Brand? @relation(fields: [brandId], references: [id])
816
+ creator User? @relation(fields: [creatorId], references: [id])
817
+ prevTransaction PaymentTransaction? @relation("TransactionHistory", fields: [prevTransactionId], references: [id])
818
+ nextTransaction PaymentTransaction? @relation("TransactionHistory")
748
819
  }
749
820
 
750
821
  model BrandAffiliateLink {
751
- id Int @id @default(autoincrement())
752
- created DateTime @default(now())
753
- description String?
754
- urlPath String
755
- commission Float @default(0.2)
756
- metaData Json @default("{}")
822
+ id Int @id @default(autoincrement())
823
+ created DateTime @default(now())
824
+ description String?
825
+ urlPath String
826
+ commission Float @default(0.2)
827
+ metaData Json @default("{}")
828
+
757
829
  brandId Int
758
830
  affiliateLinks AffiliateLink[]
759
- brand Brand @relation(fields: [brandId], references: [id])
831
+
832
+ brand Brand @relation(fields: [brandId], references: [id])
760
833
  }
761
834
 
762
835
  model AffiliateLink {
763
- id Int @id @default(autoincrement())
764
- created DateTime @default(now())
765
- metaData Json @default("{}")
836
+ id Int @id @default(autoincrement())
837
+ created DateTime @default(now())
838
+ metaData Json @default("{}")
839
+
766
840
  userId Int
767
841
  brandAffiliateLinkId Int
768
842
  affiliateClicks AffiliateClick[]
769
- brandAffiliateLink BrandAffiliateLink @relation(fields: [brandAffiliateLinkId], references: [id])
770
- affiliate User @relation(fields: [userId], references: [id])
843
+
844
+ affiliate User @relation(fields: [userId], references: [id])
845
+ brandAffiliateLink BrandAffiliateLink @relation(fields: [brandAffiliateLinkId], references: [id])
771
846
  }
772
847
 
773
848
  model AffiliateClick {
774
- id Int @id @default(autoincrement())
775
- created DateTime @default(now())
776
- visitorIp String?
777
- metaData Json @default("{}")
849
+ id Int @id @default(autoincrement())
850
+ created DateTime @default(now())
851
+ visitorIp String?
852
+ metaData Json @default("{}")
853
+
778
854
  affiliateLinkId Int
779
- affiliateLink AffiliateLink @relation(fields: [affiliateLinkId], references: [id])
780
- affiliateEvent AffiliateEvent[]
855
+
856
+ affiliateLink AffiliateLink @relation(fields: [affiliateLinkId], references: [id])
857
+ affiliateEvent AffiliateEvent[]
781
858
  }
782
859
 
783
860
  model AffiliateEvent {
784
- id Int @id @default(autoincrement())
785
- /// click, purchase, etc.
786
- event String
787
- created DateTime @default(now())
861
+ id Int @id @default(autoincrement())
862
+ event String // click, purchase, etc.
863
+ created DateTime @default(now())
788
864
  visitorIp String?
789
865
  urlPath String?
790
866
  revenue Float?
791
867
  commissionAmount Float?
792
868
  commissionPercent Float?
793
- metaData Json @default("{}")
794
- affiliateClickId Int
795
- affiliateClick AffiliateClick @relation(fields: [affiliateClickId], references: [id])
869
+ metaData Json @default("{}")
870
+
871
+ affiliateClickId Int
872
+
873
+ affiliateClick AffiliateClick? @relation(fields: [affiliateClickId], references: [id])
796
874
  }
797
875
 
798
876
  model SavedFile {
799
877
  id Int @id @default(autoincrement())
800
878
  title String?
801
- /// audience-report, search-export, campaign-invite
802
- type String?
879
+ type String? // audience-report, search-export, campaign-invite
803
880
  url String?
804
881
  savedDate DateTime?
805
882
  metaData Json? @default("{}")
806
- brandId Int?
807
- brand Brand? @relation(fields: [brandId], references: [id])
883
+
884
+ brandId Int?
885
+ brand Brand? @relation(fields: [brandId], references: [id])
808
886
 
809
887
  @@map("savedfile")
810
888
  }
811
889
 
812
890
  model CampaignInvite {
813
- id Int @id @default(autoincrement())
814
- socialProfileId Int?
815
- brandId Int
816
- campaignId Int?
817
- optInId Int? @unique
818
- code String? @unique
819
- createdAt DateTime @default(now())
820
- metaData Json? @default("{}")
821
- brand Brand @relation(fields: [brandId], references: [id], onDelete: Cascade)
822
- campaign Campaign? @relation(fields: [campaignId], references: [id])
823
- optIn OptIn? @relation(fields: [optInId], references: [id])
824
- socialProfile SocialProfile? @relation(fields: [socialProfileId], references: [id])
891
+ id Int @default(autoincrement()) @id
892
+ socialProfileId Int?
893
+ brandId Int
894
+ campaignId Int?
895
+ optInId Int? @unique
896
+ code String? @unique
897
+ createdAt DateTime @default(now())
898
+ declineDate DateTime?
899
+ declineReason String? @db.Text
900
+
901
+ metaData Json? @default("{}")
902
+
903
+ brand Brand @relation(fields: [brandId], references: [id], onDelete: Cascade)
904
+ campaign Campaign? @relation(fields: [campaignId], references: [id])
905
+ socialProfile SocialProfile? @relation(fields: [socialProfileId], references: [id])
906
+ optIn OptIn? @relation(fields: [optInId], references: [id])
907
+
825
908
  }
826
909
 
827
910
  model CreatorList {
828
- id Int @id @default(autoincrement())
911
+ id Int @id @default(autoincrement())
829
912
  brandId Int
830
913
  campaignId Int?
831
- created DateTime @default(now())
914
+ created DateTime @default(now())
832
915
  archived DateTime?
833
916
  title String
834
- metaData Json? @default("{}")
835
- brand Brand @relation(fields: [brandId], references: [id], onDelete: Cascade)
836
- campaign Campaign? @relation(fields: [campaignId], references: [id])
837
- creators CreatorListItem[]
917
+ metaData Json? @default("{}")
918
+
919
+ creators CreatorListItem[]
920
+ brand Brand @relation(fields: [brandId], references: [id], onDelete: Cascade)
921
+ campaign Campaign? @relation(fields: [campaignId], references: [id])
838
922
 
839
923
  @@map("creatorlist")
840
924
  }
841
925
 
842
926
  model CreatorListItem {
843
- id Int @id @default(autoincrement())
927
+ id Int @id @default(autoincrement())
844
928
  socialProfileId Int
845
929
  creatorListId Int
846
- saved DateTime @default(now())
847
- invited DateTime?
848
- tags Json?
849
- feedback String?
850
- archived DateTime?
851
- metaData Json? @default("{}")
852
- creatorList CreatorList @relation(fields: [creatorListId], references: [id], onDelete: Cascade)
853
- socialProfile SocialProfile @relation(fields: [socialProfileId], references: [id], onDelete: Cascade)
930
+
931
+ saved DateTime @default(now())
932
+ invited DateTime?
933
+ tags Json?
934
+ feedback String? @db.Text
935
+ archived DateTime?
936
+ metaData Json? @default("{}")
937
+
938
+ creatorList CreatorList @relation(fields: [creatorListId], references: [id], onDelete: Cascade)
939
+ socialProfile SocialProfile? @relation(fields: [socialProfileId], references: [id], onDelete: Cascade)
854
940
 
855
941
  @@map("creatorlistitem")
856
942
  }
857
943
 
858
944
  model SocialProfile {
859
- id Int @id @default(autoincrement())
860
- /// need to make sure this can never overlap across multiple platforms, we should append the platform to the beginning to ensure it’s always unique
861
- socialId String? @unique
862
- /// registered user id, if available
863
- userId Int?
864
- /// social data
865
- platform String
866
- username String
867
- fullname String?
868
- profileUrl String?
869
- /// need to specify length, default size is too small
870
- profilePicUrl String? @db.VarChar(2083)
871
- followerCount Int?
872
- engagement Float?
873
- avgViews Int?
874
- verified Boolean?
875
- metaData Json @default("{}")
876
- audienceData Json @default("{}")
877
- phylloData Json @default("{}")
878
- created DateTime @default(now())
879
- updated DateTime?
880
- campaignInvites CampaignInvite[]
881
- creatorListItems CreatorListItem[]
882
- user User? @relation(fields: [userId], references: [id])
883
-
884
- @@index([username])
945
+ id Int @id @default(autoincrement())
946
+ socialId String? @unique // need to make sure this can never overlap across multiple platforms, we should append the platform to the beginning to ensure it’s always unique
947
+ userId Int? // registered user id, if available
948
+
949
+ // social data
950
+ platform String
951
+ username String
952
+ fullname String? @db.VarChar(1024)
953
+ profileUrl String?
954
+ profilePicUrl String? @db.VarChar(2083) // need to specify length, default size is too small
955
+ followerCount Int?
956
+ engagement Float?
957
+ avgViews Int?
958
+ verified Boolean?
959
+ metaData Json @default("{}")
960
+ audienceData Json @default("{}")
961
+ phylloData Json @default("{}")
962
+
963
+ created DateTime @default(now())
964
+ updated DateTime?
965
+
966
+ creatorListItems CreatorListItem[]
967
+ campaignInvites CampaignInvite[]
968
+ user User? @relation(fields: [userId], references: [id])
969
+
970
+ @@index(username)
885
971
  @@map("socialprofile")
886
972
  }
887
973
 
888
974
  model MessageTemplate {
889
975
  id Int @id @default(autoincrement())
890
976
  label String?
891
- template String
977
+ template String @db.Text
892
978
  brandId Int?
893
- /// to save any additional data such as user defined variables
894
- metaData Json @default("{}")
895
979
  brand Brand? @relation(fields: [brandId], references: [id])
980
+ metaData Json @default("{}") // to save any additional data such as user defined variables
896
981
 
897
982
  @@map("messagetemplate")
898
983
  }
899
984
 
900
985
  model EmailTemplate {
901
- id Int @id @default(autoincrement())
902
- label String?
903
- subject String?
904
- template String
905
- brandId Int?
906
- /// to save any additional data such as user defined variables
907
- metaData Json @default("{}")
908
- brand Brand? @relation(fields: [brandId], references: [id])
986
+ id Int @id @default(autoincrement())
987
+ label String?
988
+ subject String?
989
+ template String @db.Text
990
+ brandId Int?
991
+
992
+ brand Brand? @relation(fields: [brandId], references: [id])
993
+ metaData Json @default("{}") // to save any additional data such as user defined variables
909
994
  }
910
995
 
911
996
  model SocialListeningList {
912
- id Int @id @default(autoincrement())
913
- brandId Int
914
- /// optionally linked to a campaign
915
- campaignId Int? @unique
916
- created DateTime @default(now())
917
- updated DateTime?
918
- title String
919
- /// sponsored posts, top posts, or recent posts
920
- postType String
921
- /// filters to search posts by (location, date, hashtags, mentions, etc.)
922
- filters Json? @default("{}")
923
- /// last time posts were fetched
924
- lastFetched DateTime?
925
- posts ListToSocialPost[]
926
- brand Brand @relation(fields: [brandId], references: [id], onDelete: Cascade)
997
+ id Int @id @default(autoincrement())
998
+ brandId Int
999
+ campaignId Int? @unique // optionally linked to a campaign
1000
+ created DateTime @default(now())
1001
+ updated DateTime?
1002
+ title String
1003
+ postType String // sponsored posts, top posts, or recent posts
1004
+ filters Json? @default("{}") // filters to search posts by (location, date, hashtags, mentions, etc.)
1005
+
1006
+ lastFetched DateTime? // last time posts were fetched
1007
+
1008
+ brand Brand @relation(fields: [brandId], references: [id], onDelete: Cascade)
1009
+ posts ListToSocialPost[]
927
1010
 
928
1011
  @@map("sociallisteninglist")
929
1012
  }
930
1013
 
931
1014
  model ListToSocialPost {
932
- id Int @id @default(autoincrement())
933
- listId Int
934
- postId Int
1015
+ id Int @id @default(autoincrement())
1016
+ listId Int
1017
+ postId Int
1018
+
935
1019
  list SocialListeningList @relation(fields: [listId], references: [id], onDelete: Cascade)
936
1020
  socialPost SocialPost @relation(fields: [postId], references: [id], onDelete: Cascade)
937
1021
 
@@ -939,9 +1023,10 @@ model ListToSocialPost {
939
1023
  }
940
1024
 
941
1025
  model OptInView {
942
- id Int @id @default(autoincrement())
943
- title String
944
- filters Json @default("{}")
1026
+ id Int @id @default(autoincrement())
1027
+ title String
1028
+ filters Json @default("{}")
1029
+
945
1030
  campaignId Int?
946
1031
  campaign Campaign? @relation(fields: [campaignId], references: [id])
947
1032
 
@@ -958,8 +1043,10 @@ model RakutenActivity {
958
1043
  sales Float?
959
1044
  commission Float?
960
1045
  advertiserId Int?
961
- userId Int
962
- user User @relation(fields: [userId], references: [id])
1046
+
1047
+ userId Int
1048
+
1049
+ user User @relation(fields: [userId], references: [id])
963
1050
 
964
1051
  @@map("rakutenactivity")
965
1052
  }