@creator.co/creatorco-prisma-client 1.0.6 → 1.0.8

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