@postxl/generator 0.0.1 → 0.0.2

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.
@@ -0,0 +1,527 @@
1
+ generator client {
2
+ provider = "prisma-client-js"
3
+ output = "../../../node_modules/@prisma/db"
4
+ }
5
+
6
+ generator pxl {
7
+ provider = "node ./dist/src/generator.js"
8
+ project = "mca"
9
+
10
+ pathToTypes = "./tests/schemas/mca/generated/backend/libs/types/src/"
11
+ pathToDataLib = "./tests/schemas/mca/generated/backend/libs/data/src/"
12
+ trpcRoutesFolder = "./tests/schemas/mca/generated/backend/libs/trpc/src/routes/"
13
+ pathToSeedLib = "./tests/schemas/mca/generated/backend/libs/seed/src/"
14
+
15
+ reactFolderOutput = "./tests/schemas/mca/generated/web/src/components/"
16
+
17
+ randomSeed = 1
18
+ force = false
19
+ }
20
+
21
+ datasource db {
22
+ provider = "postgresql"
23
+ url = env("DATABASE_CONNECTION")
24
+ }
25
+
26
+ model TherapeuticArea {
27
+ id String @id @default(cuid())
28
+ createdAt DateTime @default(now())
29
+ updatedAt DateTime? @updatedAt
30
+
31
+ name String @unique
32
+ description String
33
+
34
+ brands Brand[] @relation("Brand_TherapeuticArea_therapeuticAreaId")
35
+ indications Indication[] @relation("Indication_TherapeuticArea_therapeuticAreaId")
36
+ }
37
+
38
+ model Audience {
39
+ id String @id @default(cuid())
40
+ createdAt DateTime @default(now())
41
+ updatedAt DateTime? @updatedAt
42
+
43
+ ///@@MaxLength(255)
44
+ name String @unique @db.VarChar(255)
45
+ description String
46
+ iconUrl String?
47
+
48
+ assets Asset[] @relation("Asset_Audience_audienceId")
49
+ }
50
+
51
+ model Channel {
52
+ id String @id @default(cuid())
53
+ createdAt DateTime @default(now())
54
+ updatedAt DateTime? @updatedAt
55
+
56
+ ///@@MaxLength(255)
57
+ name String @unique @db.VarChar(255)
58
+ description String
59
+
60
+ assets Asset[] @relation("Asset_Channel_channelId")
61
+ }
62
+
63
+ model Brand {
64
+ id String @id @default(cuid())
65
+ createdAt DateTime @default(now())
66
+ updatedAt DateTime? @updatedAt
67
+
68
+ name String @unique
69
+ description String
70
+ iconUrl String?
71
+
72
+ therapeuticArea TherapeuticArea @relation("Brand_TherapeuticArea_therapeuticAreaId", fields: [therapeuticAreaId], references: [id])
73
+ therapeuticAreaId String
74
+
75
+ assets Asset[] @relation("Asset_Brand_brandId")
76
+ components Component[] @relation("Component_Brand_brandId")
77
+ }
78
+
79
+ model Indication {
80
+ id String @id @default(cuid())
81
+ createdAt DateTime @default(now())
82
+ updatedAt DateTime? @updatedAt
83
+
84
+ name String @unique
85
+ description String
86
+ iconUrl String?
87
+
88
+ therapeuticArea TherapeuticArea @relation("Indication_TherapeuticArea_therapeuticAreaId", fields: [therapeuticAreaId], references: [id])
89
+ therapeuticAreaId String
90
+
91
+ assets Asset[] @relation("Asset_Indication_indicationId")
92
+ component Component[] @relation("Component_Indication_indicationId")
93
+ }
94
+
95
+ model MustWinMoment {
96
+ id String @id @default(cuid())
97
+ createdAt DateTime @default(now())
98
+ updatedAt DateTime? @updatedAt
99
+
100
+ ///@@MaxLength(255)
101
+ name String @unique @db.VarChar(255)
102
+ description String
103
+ iconUrl String?
104
+
105
+ assets Asset[] @relation("Asset_MustWinMoment_mustWinMomentId")
106
+ }
107
+
108
+ model MessageType {
109
+ id String @id @default(cuid())
110
+ createdAt DateTime @default(now())
111
+ updatedAt DateTime? @updatedAt
112
+
113
+ ///@@MaxLength(255)
114
+ name String @unique @db.VarChar(255)
115
+ description String
116
+ isBranded Boolean @default(false)
117
+
118
+ messages Message[] @relation("Message_MessageType_messageTypeId")
119
+ }
120
+
121
+ model Message {
122
+ id String @id @default(cuid())
123
+ createdAt DateTime @default(now())
124
+ updatedAt DateTime? @updatedAt
125
+
126
+ ///@@MaxLength(255)
127
+ name String @unique @db.VarChar(255)
128
+ description String
129
+
130
+ messageTypeId String
131
+ messageType MessageType @relation("Message_MessageType_messageTypeId", fields: [messageTypeId], references: [id])
132
+
133
+ components Component[] @relation("Component_Message_messageId")
134
+ }
135
+
136
+ model ComponentType {
137
+ id String @id @default(cuid())
138
+ createdAt DateTime @default(now())
139
+ updatedAt DateTime? @updatedAt
140
+
141
+ ///@@MaxLength(255)
142
+ name String @unique @db.VarChar(255)
143
+ description String
144
+ isNotation Boolean @default(false)
145
+
146
+ components Component[] @relation("Component_ComponentType_componentTypeId")
147
+ }
148
+
149
+ /// @@TRPC_SkipCreate("")
150
+ /// @@TRPC_CustomUpdate("")
151
+ model Component {
152
+ id String @id @default(cuid())
153
+ createdAt DateTime @default(now())
154
+ updatedAt DateTime? @updatedAt
155
+
156
+ ///@@MaxLength(255)
157
+ name String @unique @db.VarChar(255)
158
+ description String
159
+ contentText String
160
+
161
+ contentUrl String?
162
+ imageWidth Int?
163
+ imageHeight Int?
164
+
165
+ status ApprovalStatus
166
+
167
+ componentTypeId String
168
+ componentType ComponentType @relation("Component_ComponentType_componentTypeId", fields: [componentTypeId], references: [id])
169
+
170
+ message Message? @relation("Component_Message_messageId", fields: [messageId], references: [id])
171
+ messageId String?
172
+
173
+ country Country @relation("Component_Country_countryId", fields: [countryId], references: [id])
174
+ countryId String
175
+ language Language @relation("Component_Language_languageId", fields: [languageId], references: [id])
176
+ languageId String
177
+ brand Brand? @relation("Component_Brand_brandId", fields: [brandId], references: [id])
178
+ brandId String?
179
+ indication Indication? @relation("Component_Indication_indicationId", fields: [indicationId], references: [id])
180
+ indicationId String?
181
+
182
+ parent Component? @relation("Component_Component_parentId", fields: [parentId], references: [id])
183
+ parentId String?
184
+ children Component[] @relation("Component_Component_parentId")
185
+
186
+ notationsFrom Notation[] @relation("Component_Component_sourceId")
187
+ notationsTo Notation[] @relation("Component_Component_targetId")
188
+
189
+ businessRules BusinessRule[] @relation("BusinessRule_Component_componentId")
190
+ }
191
+
192
+ /// @@TRPC_CustomCreate("")
193
+ /// @@TRPC_CustomUpdate("")
194
+ model Notation {
195
+ id String @id @default(cuid())
196
+ createdAt DateTime @default(now())
197
+ updatedAt DateTime? @updatedAt
198
+
199
+ label String
200
+ description String
201
+
202
+ source Component @relation("Component_Component_sourceId", fields: [sourceId], references: [id])
203
+ sourceId String
204
+ target Component @relation("Component_Component_targetId", fields: [targetId], references: [id])
205
+ targetId String
206
+ }
207
+
208
+ /// @@TRPC_CustomCreate("")
209
+ /// @@TRPC_CustomUpdate("")
210
+ model BusinessRule {
211
+ id String @id @default(cuid())
212
+ createdAt DateTime @default(now())
213
+ updatedAt DateTime? @updatedAt
214
+
215
+ label String
216
+ description String
217
+ order Float
218
+ prominence Int @default(0)
219
+
220
+ story Story @relation("BusinessRule_Story_storyId", fields: [storyId], references: [id])
221
+ storyId String
222
+ component Component @relation("BusinessRule_Component_componentId", fields: [componentId], references: [id])
223
+ componentId String
224
+
225
+ assetTypes BusinessRuleAssetType[] @relation("BusinessRuleAssetType_BusinessRule_businessRuleId")
226
+ storypages StoryPageBusinessRule[] @relation("StoryPageBusinessRule_BusinessRule_businessRuleId")
227
+ }
228
+
229
+ /// @@TRPC_CustomCreate("")
230
+ /// @@TRPC_CustomUpdate("")
231
+ /// The specification of how a component - a business rule - should behave in a specific context.
232
+ model BusinessRuleAssetType {
233
+ id String @id @default(cuid())
234
+ createdAt DateTime @default(now())
235
+ updatedAt DateTime? @updatedAt
236
+
237
+ label String
238
+ description String
239
+ size ComponentSize
240
+ requirement ComponentRequirement
241
+
242
+ style Style @relation("BusinessRuleAssetType_Style_styleId", fields: [styleId], references: [id])
243
+ styleId String
244
+
245
+ businessRule BusinessRule @relation("BusinessRuleAssetType_BusinessRule_businessRuleId", fields: [businessRuleId], references: [id])
246
+ businessRuleId String
247
+ assetType AssetType @relation("BusinessRuleAssetType_AssetType_assetTypeId", fields: [assetTypeId], references: [id])
248
+ assetTypeId String
249
+
250
+ storypages StoryPageBusinessRule[] @relation("StoryPageBusinessRule_BusinessRuleAssetType_businessRuleAssetTypeId")
251
+ }
252
+
253
+ enum ComponentSize {
254
+ Small
255
+ Medium
256
+ Large
257
+ XLarge
258
+ }
259
+
260
+ /// @@TRPC_CustomCreate("")
261
+ /// @@TRPC_CustomUpdate("")
262
+ model Story {
263
+ id String @id @default(cuid())
264
+ createdAt DateTime @default(now())
265
+ updatedAt DateTime? @updatedAt
266
+
267
+ ///@@MaxLength(255)
268
+ name String @unique @db.VarChar(255)
269
+ label String
270
+ description String
271
+
272
+ businessRules BusinessRule[] @relation("BusinessRule_Story_storyId")
273
+
274
+ status ApprovalStatus @default(Draft)
275
+
276
+ renderedUrl String?
277
+ imageWidth Int?
278
+ imageHeight Int?
279
+
280
+ country Country @relation("Story_Country_countryId", fields: [countryId], references: [id])
281
+ countryId String
282
+ language Language @relation("Story_Language_languageId", fields: [languageId], references: [id])
283
+ languageId String
284
+ storyPages StoryPage[] @relation("StoryPage_Story_storyId")
285
+
286
+ parent Story? @relation("Story_Story_parentId", fields: [parentId], references: [id])
287
+ parentId String?
288
+ children Story[] @relation("Story_Story_parentId")
289
+
290
+ storySubjectRelations StoryRelation[] @relation("StoryRelation_Story_storySubjectId")
291
+ storyObjectRelations StoryRelation[] @relation("StoryRelation_Story_storyObjectId")
292
+ }
293
+
294
+ /// Dependencies between different stories.
295
+ model StoryRelation {
296
+ id String @id @default(cuid())
297
+ createdAt DateTime @default(now())
298
+ updatedAt DateTime? @updatedAt
299
+
300
+ label String?
301
+ description String?
302
+
303
+ storySubject Story @relation("StoryRelation_Story_storySubjectId", fields: [storySubjectId], references: [id])
304
+ storySubjectId String
305
+ storyObject Story @relation("StoryRelation_Story_storyObjectId", fields: [storyObjectId], references: [id])
306
+ storyObjectId String
307
+
308
+ relation StoryRelationType
309
+ }
310
+
311
+ enum StoryRelationType {
312
+ HasToBeUsedWith
313
+ CanNotBeUsedWith
314
+ HasToBeUsedBefore
315
+ HasToBeUsedAfter
316
+ HasToBeUsedNextTo
317
+ }
318
+
319
+ /// @@TRPC_CustomCreate("")
320
+ /// @@TRPC_CustomUpdate("")
321
+ model Asset {
322
+ id String @id @default(cuid())
323
+ createdAt DateTime @default(now())
324
+ updatedAt DateTime? @updatedAt
325
+
326
+ ///@@MaxLength(255)
327
+ name String @unique @db.VarChar(255)
328
+ label String
329
+ description String
330
+
331
+ storyPages StoryPage[] @relation("StoryPage_Asset_assetId")
332
+
333
+ renderedUrl String?
334
+ imageWidth Int?
335
+ imageHeight Int?
336
+
337
+ status AssetApprovalStatus
338
+ approvalComment String
339
+
340
+ assetType AssetType @relation("Asset_AssetType_assetTypeId", fields: [assetTypeId], references: [id])
341
+ assetTypeId String
342
+ brand Brand @relation("Asset_Brand_brandId", fields: [brandId], references: [id])
343
+ brandId String
344
+ indication Indication @relation("Asset_Indication_indicationId", fields: [indicationId], references: [id])
345
+ indicationId String
346
+ country Country @relation("Asset_Country_countryId", fields: [countryId], references: [id])
347
+ countryId String
348
+ language Language @relation("Asset_Language_languageId", fields: [languageId], references: [id])
349
+ languageId String
350
+ audience Audience @relation("Asset_Audience_audienceId", fields: [audienceId], references: [id])
351
+ audienceId String
352
+ channel Channel @relation("Asset_Channel_channelId", fields: [channelId], references: [id])
353
+ channelId String
354
+ mustWinMoment MustWinMoment @relation("Asset_MustWinMoment_mustWinMomentId", fields: [mustWinMomentId], references: [id])
355
+ mustWinMomentId String
356
+
357
+ parent Asset? @relation("Asset_Asset_parentId", fields: [parentId], references: [id])
358
+ parentId String?
359
+ children Asset[] @relation("Asset_Asset_parentId")
360
+ }
361
+
362
+ enum AssetApprovalStatus {
363
+ Draft
364
+ IsVariant
365
+ Update
366
+ Approved
367
+ }
368
+
369
+ /// @@TRPC_CustomCreate("")
370
+ /// @@TRPC_CustomUpdate("")
371
+ model StoryPage {
372
+ id String @id @default(cuid())
373
+ createdAt DateTime @default(now())
374
+ updatedAt DateTime? @updatedAt
375
+
376
+ label String
377
+ pageNumber Int
378
+ description String
379
+
380
+ renderedUrl String?
381
+ imageWidth Int?
382
+ imageHeight Int?
383
+
384
+ story Story @relation("StoryPage_Story_storyId", fields: [storyId], references: [id])
385
+ storyId String
386
+ asset Asset @relation("StoryPage_Asset_assetId", fields: [assetId], references: [id])
387
+ assetId String
388
+
389
+ isApproved Boolean @default(false)
390
+ approvalComment String
391
+
392
+ storyPageBusinessRules StoryPageBusinessRule[] @relation("StoryPageBusinessRule_StoryPage_storyPageId")
393
+ }
394
+
395
+ /// A configuration of a given business rule inside a given story page (i.e. a story in an asset).
396
+ model StoryPageBusinessRule {
397
+ id String @id @default(cuid())
398
+ createdAt DateTime @default(now())
399
+ updatedAt DateTime? @updatedAt
400
+
401
+ storyPageId String
402
+ storyPage StoryPage @relation("StoryPageBusinessRule_StoryPage_storyPageId", fields: [storyPageId], references: [id])
403
+ businessRuleAssetTypeId String
404
+ businessRuleAssetType BusinessRuleAssetType @relation("StoryPageBusinessRule_BusinessRuleAssetType_businessRuleAssetTypeId", fields: [businessRuleAssetTypeId], references: [id])
405
+ businessRuleId String
406
+ businessRule BusinessRule @relation("StoryPageBusinessRule_BusinessRule_businessRuleId", fields: [businessRuleId], references: [id])
407
+
408
+ isIncluded Boolean @default(true)
409
+ isApproved Boolean @default(false)
410
+ approvalComment String
411
+
412
+ @@unique([storyPageId, businessRuleAssetTypeId])
413
+ }
414
+
415
+ model Country {
416
+ id String @id @default(cuid())
417
+ createdAt DateTime @default(now())
418
+ updatedAt DateTime? @updatedAt
419
+
420
+ ///@@MaxLength(255)
421
+ name String @unique @db.VarChar(255)
422
+ description String
423
+ countryCode String //"US", "DE", "AT"
424
+
425
+ defaultLanguage Language? @relation("Country_Language_defaultLanguageId", fields: [defaultLanguageId], references: [id])
426
+ defaultLanguageId String?
427
+
428
+ components Component[] @relation("Component_Country_countryId")
429
+ assets Asset[] @relation("Asset_Country_countryId")
430
+ stories Story[] @relation("Story_Country_countryId")
431
+
432
+ ///@@IsDefault()
433
+ isGlobal Boolean @default(false) // true if country is global default
434
+ }
435
+
436
+ model Language {
437
+ id String @id @default(cuid())
438
+ createdAt DateTime @default(now())
439
+ updatedAt DateTime? @updatedAt
440
+
441
+ ///@@MaxLength(255)
442
+ name String @unique @db.VarChar(255)
443
+ description String
444
+ languageCode String //"en", "de"
445
+
446
+ ///@@IsDefault()
447
+ isGlobal Boolean @default(false) // true if language is global default
448
+
449
+ defaultCountries Country[] @relation("Country_Language_defaultLanguageId")
450
+ components Component[] @relation("Component_Language_languageId")
451
+ assets Asset[] @relation("Asset_Language_languageId")
452
+ stories Story[] @relation("Story_Language_languageId")
453
+ }
454
+
455
+ model Style {
456
+ id String @id @default(cuid())
457
+ createdAt DateTime @default(now())
458
+ updatedAt DateTime? @updatedAt
459
+
460
+ ///@@MaxLength(255)
461
+ name String @unique @db.VarChar(255)
462
+ description String
463
+ styleType StyleType
464
+
465
+ businessRuleAssetTypes BusinessRuleAssetType[] @relation("BusinessRuleAssetType_Style_styleId")
466
+ assetTypes AssetType[] @relation("AssetType_Style_defaultStyleId")
467
+ }
468
+
469
+ enum StyleType {
470
+ Text
471
+ Graphic
472
+ Video
473
+ Audio
474
+ Code
475
+ PDF
476
+ }
477
+
478
+ enum ComponentRequirement {
479
+ RequiredInStory
480
+ RequiredOncePerPage
481
+ RequiredOncePerPiece
482
+ RequiredOneClickAway
483
+ Optional
484
+ }
485
+
486
+ model AssetType {
487
+ // LeaveBehind
488
+ // BannerAd
489
+ // Email
490
+ // SocialMedia
491
+ // Video
492
+ // PDF
493
+ id String @id @default(cuid())
494
+ createdAt DateTime @default(now())
495
+ updatedAt DateTime? @updatedAt
496
+
497
+ ///@@MaxLength(255)
498
+ name String @unique @db.VarChar(255)
499
+ description String
500
+ iconUrl String?
501
+
502
+ defaultStyle Style @relation("AssetType_Style_defaultStyleId", fields: [defaultStyleId], references: [id])
503
+ defaultStyleId String
504
+ defaultSize ComponentSize
505
+ defaultRequirement ComponentRequirement
506
+
507
+ assets Asset[] @relation("Asset_AssetType_assetTypeId")
508
+ businessRuleAssetTypes BusinessRuleAssetType[] @relation("BusinessRuleAssetType_AssetType_assetTypeId")
509
+ }
510
+
511
+ enum ApprovalStatus {
512
+ // A given object has been created and never used.
513
+ Draft
514
+
515
+ // Someone has confirmed the use of a given object in an asset.
516
+ Approved
517
+
518
+ // A given object has been used, but something has changed and someone needs to re-confirm
519
+ // the change in one of the assets that uses it.
520
+ Updated
521
+ }
522
+
523
+ /// @@Global_Ignore("Used for internal configuration of database, not to be exposed to client")
524
+ model Config {
525
+ id Boolean @id @default(true)
526
+ isTest Boolean @default(false)
527
+ }