@bash-app/bash-common 29.42.3 → 29.44.0
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/README.md +8 -8
- package/package.json +47 -47
- package/prisma/schema.prisma +1622 -1623
- package/src/definitions.ts +608 -608
- package/src/extendedSchemas.ts +554 -555
- package/src/index.ts +16 -16
- package/src/utils/addressUtils.ts +173 -173
- package/src/utils/apiUtils.ts +76 -76
- package/src/utils/awsS3Utils.ts +99 -99
- package/src/utils/dateTimeUtils.ts +199 -199
- package/src/utils/paymentUtils.ts +56 -56
- package/src/utils/promoCodesUtils.ts +29 -29
- package/src/utils/qrCodeUtils.ts +23 -23
- package/src/utils/recurrenceUtils.ts +175 -175
- package/src/utils/service/serviceUtils.ts +121 -121
- package/src/utils/service/venueUtils.ts +45 -45
- package/src/utils/sortUtils.ts +28 -28
- package/src/utils/stripeAccountUtils.ts +11 -11
- package/src/utils/ticketListUtils.ts +78 -78
- package/src/utils/urlUtils.ts +29 -29
- package/tsconfig.json +19 -19
package/src/extendedSchemas.ts
CHANGED
|
@@ -1,555 +1,554 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AmountOfGuests,
|
|
3
|
-
EventTask,
|
|
4
|
-
AssociatedBash,
|
|
5
|
-
AssociatedService,
|
|
6
|
-
BashEvent,
|
|
7
|
-
Invitation,
|
|
8
|
-
Ticket,
|
|
9
|
-
User,
|
|
10
|
-
TicketTier, Service, Review, Media, BashComment, Recurrence, Contact,
|
|
11
|
-
BashNotification, BashEventPromoCode,
|
|
12
|
-
Reminder,
|
|
13
|
-
Checkout,
|
|
14
|
-
ServiceLink,
|
|
15
|
-
Link, Venue,
|
|
16
|
-
// Availability,
|
|
17
|
-
TargetAudience,
|
|
18
|
-
Vendor,
|
|
19
|
-
EventService,
|
|
20
|
-
EntertainmentService,
|
|
21
|
-
Exhibitor,
|
|
22
|
-
Sponsor,
|
|
23
|
-
Organization,
|
|
24
|
-
Booking,
|
|
25
|
-
VolunteerService, Prisma, ServiceRange,
|
|
26
|
-
StripeAccount,
|
|
27
|
-
VisibilityPreference,
|
|
28
|
-
BashEventType,
|
|
29
|
-
Coordinates,
|
|
30
|
-
// Rate,
|
|
31
|
-
GoogleReview,
|
|
32
|
-
ServiceTypes,
|
|
33
|
-
ServiceRatesAssociation,
|
|
34
|
-
ServiceRate,
|
|
35
|
-
ServiceDailyRates,
|
|
36
|
-
ServiceSpecialRates,
|
|
37
|
-
ServiceAddon,
|
|
38
|
-
ServicePackage,
|
|
39
|
-
ServiceListingSubscription,
|
|
40
|
-
SocialMediaProfile,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
'
|
|
100
|
-
'
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
'
|
|
110
|
-
'
|
|
111
|
-
'
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
export
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
"
|
|
258
|
-
"
|
|
259
|
-
"
|
|
260
|
-
"
|
|
261
|
-
"
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
//
|
|
328
|
-
//
|
|
329
|
-
//
|
|
330
|
-
//
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
'
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
'
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
]
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
//
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
export type PublicServiceListingSubscription = Pick<ServiceListingSubscription, keyof typeof PUBLIC_SERVICE_LISTING_SUBSCRIPTION_DATA_TO_SELECT>;
|
|
1
|
+
import {
|
|
2
|
+
AmountOfGuests,
|
|
3
|
+
EventTask,
|
|
4
|
+
AssociatedBash,
|
|
5
|
+
AssociatedService,
|
|
6
|
+
BashEvent,
|
|
7
|
+
Invitation,
|
|
8
|
+
Ticket,
|
|
9
|
+
User,
|
|
10
|
+
TicketTier, Service, Review, Media, BashComment, Recurrence, Contact,
|
|
11
|
+
BashNotification, BashEventPromoCode,
|
|
12
|
+
Reminder,
|
|
13
|
+
Checkout,
|
|
14
|
+
ServiceLink,
|
|
15
|
+
Link, Venue,
|
|
16
|
+
// Availability,
|
|
17
|
+
TargetAudience,
|
|
18
|
+
Vendor,
|
|
19
|
+
EventService,
|
|
20
|
+
EntertainmentService,
|
|
21
|
+
Exhibitor,
|
|
22
|
+
Sponsor,
|
|
23
|
+
Organization,
|
|
24
|
+
Booking,
|
|
25
|
+
VolunteerService, Prisma, ServiceRange,
|
|
26
|
+
StripeAccount,
|
|
27
|
+
VisibilityPreference,
|
|
28
|
+
BashEventType,
|
|
29
|
+
Coordinates,
|
|
30
|
+
// Rate,
|
|
31
|
+
GoogleReview,
|
|
32
|
+
ServiceTypes,
|
|
33
|
+
ServiceRatesAssociation,
|
|
34
|
+
ServiceRate,
|
|
35
|
+
ServiceDailyRates,
|
|
36
|
+
ServiceSpecialRates,
|
|
37
|
+
ServiceAddon,
|
|
38
|
+
ServicePackage,
|
|
39
|
+
ServiceListingSubscription,
|
|
40
|
+
SocialMediaProfile,
|
|
41
|
+
SocialMediaPlatform,
|
|
42
|
+
} from "@prisma/client";
|
|
43
|
+
import { SERVICE_LINK_DATA_TO_INCLUDE, UnionFromArray } from "./definitions";
|
|
44
|
+
|
|
45
|
+
export const FRONT_END_USER_DATA_TO_SELECT = {
|
|
46
|
+
id: true,
|
|
47
|
+
email: true,
|
|
48
|
+
givenName: true,
|
|
49
|
+
familyName: true,
|
|
50
|
+
image: true,
|
|
51
|
+
uploadedImage: true,
|
|
52
|
+
isSuperUser: true,
|
|
53
|
+
socialMediaProfiles: true,
|
|
54
|
+
} satisfies Prisma.UserSelect;
|
|
55
|
+
|
|
56
|
+
export const PRIVATE_USER_ACCOUNT_TO_SELECT = {
|
|
57
|
+
...FRONT_END_USER_DATA_TO_SELECT,
|
|
58
|
+
street: true,
|
|
59
|
+
city: true,
|
|
60
|
+
state: true,
|
|
61
|
+
zipCode: true,
|
|
62
|
+
country: true,
|
|
63
|
+
phone: true,
|
|
64
|
+
} satisfies Prisma.UserSelect;
|
|
65
|
+
|
|
66
|
+
export interface BashEventExt extends BashEvent {
|
|
67
|
+
targetAudience?: TargetAudience;
|
|
68
|
+
amountOfGuests?: AmountOfGuests;
|
|
69
|
+
recurrence?: Recurrence;
|
|
70
|
+
creator?: PublicUser;
|
|
71
|
+
ticketTiers: TicketTierExt[];
|
|
72
|
+
media: Media[];
|
|
73
|
+
eventTasks: EventTask[];
|
|
74
|
+
tickets?: Ticket[]; // Only include tickets that the user has purchased and not all tickets (could be thousands + privacy)
|
|
75
|
+
// Do not include in fetch. Could be hundreds of these
|
|
76
|
+
invitations: InvitationExt[];
|
|
77
|
+
coordinates?: Coordinates[];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export const TICKET_TIER_DATA_TO_INCLUDE = {
|
|
81
|
+
promoCodes: true,
|
|
82
|
+
} satisfies Prisma.TicketTierInclude;
|
|
83
|
+
|
|
84
|
+
export const BASH_EVENT_DATA_TO_INCLUDE = {
|
|
85
|
+
creator: {
|
|
86
|
+
select: FRONT_END_USER_DATA_TO_SELECT
|
|
87
|
+
},
|
|
88
|
+
targetAudience: true,
|
|
89
|
+
amountOfGuests: true,
|
|
90
|
+
recurrence: true,
|
|
91
|
+
ticketTiers: {
|
|
92
|
+
include: TICKET_TIER_DATA_TO_INCLUDE
|
|
93
|
+
},
|
|
94
|
+
eventTasks: true,
|
|
95
|
+
media: true,
|
|
96
|
+
} satisfies Prisma.BashEventInclude;
|
|
97
|
+
|
|
98
|
+
export const BASH_EVENT_DATA_TO_CLONE = [
|
|
99
|
+
'ticketTiers',
|
|
100
|
+
'media',
|
|
101
|
+
'recurrence',
|
|
102
|
+
'invitations',
|
|
103
|
+
] as const;
|
|
104
|
+
|
|
105
|
+
type RemoveCommonProperties<T, U> = keyof (Omit<T, keyof U> & Omit<U, keyof T>);
|
|
106
|
+
type BashEventExtMinusDataToCloneType = Omit<BashEventExt, UnionFromArray<typeof BASH_EVENT_DATA_TO_CLONE>>;
|
|
107
|
+
|
|
108
|
+
export const BASH_EVENT_DATA_TO_REMOVE: RemoveCommonProperties<BashEvent, BashEventExtMinusDataToCloneType>[] = [
|
|
109
|
+
'creator',
|
|
110
|
+
'eventTasks',
|
|
111
|
+
'tickets',
|
|
112
|
+
'targetAudience',
|
|
113
|
+
'amountOfGuests',
|
|
114
|
+
];
|
|
115
|
+
|
|
116
|
+
//---------------Services------------------
|
|
117
|
+
export interface ServiceExt extends Service {
|
|
118
|
+
owner?: PublicUser | null;
|
|
119
|
+
creator?: PublicUser | null;
|
|
120
|
+
|
|
121
|
+
stripeAccount?: PublicStripeAccount | null;
|
|
122
|
+
serviceListingSubscription?: PublicServiceListingSubscription | null;
|
|
123
|
+
|
|
124
|
+
// availableDateTimes?: Availability[];
|
|
125
|
+
|
|
126
|
+
bookings?: Booking[];
|
|
127
|
+
// rates?: Rate[];
|
|
128
|
+
targetAudience?: TargetAudience | null;
|
|
129
|
+
media?: Media[];
|
|
130
|
+
serviceLinks?: ServiceLinkExt[];
|
|
131
|
+
|
|
132
|
+
eventService?: EventService;
|
|
133
|
+
entertainmentService?: EntertainmentService;
|
|
134
|
+
vendor?: Vendor;
|
|
135
|
+
exhibitor?: Exhibitor;
|
|
136
|
+
sponsor?: Sponsor;
|
|
137
|
+
venue?: Venue;
|
|
138
|
+
organization?: Organization;
|
|
139
|
+
volunteerService?: VolunteerService;
|
|
140
|
+
bashEvent: BashEvent[];
|
|
141
|
+
|
|
142
|
+
serviceRatesAssociation?: ServiceRatesAssociationExt | null;
|
|
143
|
+
associatedBashesReferencingMe?: AssociatedBash[];
|
|
144
|
+
associatedServicesReferencingMe?: AssociatedService[];
|
|
145
|
+
|
|
146
|
+
// googleReviews: GoogleReview[];
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export interface ServiceRateExt extends ServiceRate {
|
|
150
|
+
serviceSpecialRates?: ServiceSpecialRates;
|
|
151
|
+
serviceDailyRates?: ServiceDailyRates;
|
|
152
|
+
serviceRatesAssociation?: ServiceRatesAssociation;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface ServicePackageExt extends ServicePackage {
|
|
156
|
+
serviceAddons: ServiceAddon[];
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export interface ServiceDailyRatesExt extends ServiceDailyRates {
|
|
160
|
+
serviceRate?: ServiceRate;
|
|
161
|
+
}
|
|
162
|
+
export interface ServiceSpecialRatesExt extends ServiceSpecialRates {
|
|
163
|
+
serviceRate?: ServiceRate;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export interface ServiceRatesAssociationExt extends ServiceRatesAssociation {
|
|
167
|
+
serviceGeneralRates?: ServiceRate | null;
|
|
168
|
+
serviceDailyRates?: ServiceDailyRatesExt[];
|
|
169
|
+
serviceSpecialRates?: ServiceSpecialRatesExt[];
|
|
170
|
+
|
|
171
|
+
addons?: ServiceAddon[];
|
|
172
|
+
packages?: ServicePackageExt[];
|
|
173
|
+
media?: Media[];
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
export interface EventServiceExt extends EventService {
|
|
178
|
+
service: ServiceExt;
|
|
179
|
+
crowdSize?: AmountOfGuests;
|
|
180
|
+
serviceRange?: ServiceRange;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export interface EntertainmentServiceExt extends EntertainmentService {
|
|
184
|
+
service: ServiceExt;
|
|
185
|
+
crowdSize?: AmountOfGuests;
|
|
186
|
+
serviceRange?: ServiceRange;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export interface ExhibitorExt extends Exhibitor {
|
|
190
|
+
service: ServiceExt;
|
|
191
|
+
crowdSize?: AmountOfGuests;
|
|
192
|
+
serviceRange?: ServiceRange;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export interface SponsorExt extends Sponsor {
|
|
196
|
+
service: ServiceExt;
|
|
197
|
+
crowdSize?: AmountOfGuests;
|
|
198
|
+
serviceRange?: ServiceRange;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
export interface VendorExt extends Vendor {
|
|
202
|
+
service: ServiceExt;
|
|
203
|
+
crowdSize?: AmountOfGuests;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export interface VenueExt extends Venue {
|
|
207
|
+
service: ServiceExt;
|
|
208
|
+
// crowdSize?: AmountOfGuests;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export interface OrganizationExt extends Organization {
|
|
212
|
+
service: ServiceExt;
|
|
213
|
+
amountOfGuests?: AmountOfGuests;
|
|
214
|
+
}
|
|
215
|
+
//-----------------------------------------
|
|
216
|
+
|
|
217
|
+
export interface VolunteerServiceExt extends VolunteerService {
|
|
218
|
+
service?: ServiceExt;
|
|
219
|
+
serviceRange?: ServiceRange | null;
|
|
220
|
+
media?: Media[];
|
|
221
|
+
links?: Link[];
|
|
222
|
+
// availableDateTimes?: Availability[];
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export interface ServiceLinkExt extends ServiceLink {
|
|
226
|
+
link: Link;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
// Create the final object dynamically
|
|
231
|
+
function createAllTrueObject<T extends string>(keys: T[]): Record<T, true> {
|
|
232
|
+
return keys.reduce((acc, key) => {
|
|
233
|
+
acc[key] = true;
|
|
234
|
+
return acc;
|
|
235
|
+
}, {} as Record<T, true>);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// Define the keys and values in a single object
|
|
239
|
+
const serviceKeysObject = {
|
|
240
|
+
eventService: true,
|
|
241
|
+
entertainmentService: true,
|
|
242
|
+
vendor: true,
|
|
243
|
+
exhibitor: true,
|
|
244
|
+
sponsor: true,
|
|
245
|
+
venue: true,
|
|
246
|
+
organization: true,
|
|
247
|
+
} as const;
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
export type ServiceSpecificName = keyof typeof serviceKeysObject;
|
|
251
|
+
|
|
252
|
+
const serviceKeysArray = Object.keys(serviceKeysObject);
|
|
253
|
+
|
|
254
|
+
export type ServiceSpecificType = ServiceExt[ServiceSpecificName];
|
|
255
|
+
|
|
256
|
+
export const specificServiceMap : Record<ServiceTypes, ServiceSpecificName> = {
|
|
257
|
+
"EventServices": "eventService",
|
|
258
|
+
"EntertainmentServices": "entertainmentService",
|
|
259
|
+
"Vendors": "vendor",
|
|
260
|
+
"Exhibitors": "exhibitor",
|
|
261
|
+
"Sponsors": "sponsor",
|
|
262
|
+
"Venues": "venue",
|
|
263
|
+
"Organizations": "organization"
|
|
264
|
+
} as const;
|
|
265
|
+
|
|
266
|
+
export const serviceTypeToField = (serviceType : ServiceTypes) : ServiceSpecificName => {
|
|
267
|
+
return specificServiceMap[serviceType];
|
|
268
|
+
}
|
|
269
|
+
export const SERVICE_PACKAGE_DATA_TO_INCLUDE = {
|
|
270
|
+
serviceAddons: true
|
|
271
|
+
} satisfies Prisma.ServicePackageInclude;
|
|
272
|
+
|
|
273
|
+
export const SERVICE_DAILYRATES_DATA_TO_INCLUDE = {
|
|
274
|
+
serviceRate: true
|
|
275
|
+
} satisfies Prisma.ServiceDailyRatesInclude;
|
|
276
|
+
|
|
277
|
+
export const SERVICE_SPECIALRATES_DATA_TO_INCLUDE = {
|
|
278
|
+
serviceRate: true
|
|
279
|
+
} satisfies Prisma.ServiceSpecialRatesInclude;
|
|
280
|
+
|
|
281
|
+
export const SERVICE_RATES_ASSOCIATION_DATA_TO_INCLUDE = {
|
|
282
|
+
serviceGeneralRates: true,
|
|
283
|
+
serviceDailyRates: {
|
|
284
|
+
include: SERVICE_DAILYRATES_DATA_TO_INCLUDE
|
|
285
|
+
},
|
|
286
|
+
serviceSpecialRates: {
|
|
287
|
+
include: SERVICE_SPECIALRATES_DATA_TO_INCLUDE
|
|
288
|
+
},
|
|
289
|
+
addons: true,
|
|
290
|
+
packages: {
|
|
291
|
+
include: SERVICE_PACKAGE_DATA_TO_INCLUDE
|
|
292
|
+
},
|
|
293
|
+
media: true
|
|
294
|
+
} satisfies Prisma.ServiceRatesAssociationInclude;
|
|
295
|
+
|
|
296
|
+
//------------Stripe Accounts--------------
|
|
297
|
+
export const STRIPE_ACCOUNT_DATA_TO_INCLUDE = {
|
|
298
|
+
logo: true,
|
|
299
|
+
owner: {
|
|
300
|
+
select: FRONT_END_USER_DATA_TO_SELECT
|
|
301
|
+
}
|
|
302
|
+
} satisfies Prisma.StripeAccountInclude;
|
|
303
|
+
|
|
304
|
+
export const PUBLIC_STRIPE_ACCOUNT_DATA_TO_SELECT = {
|
|
305
|
+
logo: true,
|
|
306
|
+
logoId: true,
|
|
307
|
+
createdAt: true,
|
|
308
|
+
updatedAt: true
|
|
309
|
+
} satisfies Prisma.StripeAccountSelect;
|
|
310
|
+
|
|
311
|
+
export const PUBLIC_SERVICE_LISTING_SUBSCRIPTION_DATA_TO_SELECT = {
|
|
312
|
+
serviceId: true
|
|
313
|
+
} satisfies Prisma.ServiceListingSubscriptionSelect;
|
|
314
|
+
|
|
315
|
+
export interface StripeAccountExt extends StripeAccount {
|
|
316
|
+
logo?: Media | null;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
export const SERVICE_DATA_TO_INCLUDE = {
|
|
320
|
+
creator: {
|
|
321
|
+
select: FRONT_END_USER_DATA_TO_SELECT
|
|
322
|
+
},
|
|
323
|
+
owner: {
|
|
324
|
+
select: FRONT_END_USER_DATA_TO_SELECT
|
|
325
|
+
},
|
|
326
|
+
targetAudience: true,
|
|
327
|
+
// amountOfGuests: true,
|
|
328
|
+
// recurrence: true,
|
|
329
|
+
// ticketTiers: {
|
|
330
|
+
// include: TICKET_TIER_DATA_TO_INCLUDE
|
|
331
|
+
// },
|
|
332
|
+
// eventTasks: true,
|
|
333
|
+
media: true,
|
|
334
|
+
stripeAccount: {
|
|
335
|
+
// ...STRIPE_ACCOUNT_DATA_TO_INCLUDE,
|
|
336
|
+
select: PUBLIC_STRIPE_ACCOUNT_DATA_TO_SELECT
|
|
337
|
+
},
|
|
338
|
+
serviceListingSubscription: {
|
|
339
|
+
select: PUBLIC_SERVICE_LISTING_SUBSCRIPTION_DATA_TO_SELECT
|
|
340
|
+
},
|
|
341
|
+
// availableDateTimes: true,
|
|
342
|
+
serviceLinks: {
|
|
343
|
+
include: SERVICE_LINK_DATA_TO_INCLUDE
|
|
344
|
+
},
|
|
345
|
+
serviceRatesAssociation: {
|
|
346
|
+
include: SERVICE_RATES_ASSOCIATION_DATA_TO_INCLUDE
|
|
347
|
+
}
|
|
348
|
+
} satisfies Prisma.ServiceInclude;
|
|
349
|
+
|
|
350
|
+
//full service data to include, includes specific service data
|
|
351
|
+
export const SERVICE_FULL_DATA_TO_INCLUDE = {
|
|
352
|
+
...SERVICE_DATA_TO_INCLUDE,
|
|
353
|
+
...createAllTrueObject(serviceKeysArray)
|
|
354
|
+
} satisfies Prisma.ServiceInclude;
|
|
355
|
+
|
|
356
|
+
export const SERVICE_FULL_DATA_TO_CLONE = [
|
|
357
|
+
'media',
|
|
358
|
+
'targetAudience',
|
|
359
|
+
'serviceLinks',
|
|
360
|
+
// ...Object.values(specificServiceMap)
|
|
361
|
+
] as const;
|
|
362
|
+
|
|
363
|
+
type ServiceExtMinusDataToCloneType = Omit<ServiceExt, UnionFromArray<typeof SERVICE_FULL_DATA_TO_CLONE>>;
|
|
364
|
+
export const SERVICE_FULL_DATA_TO_REMOVE: RemoveCommonProperties<Service, ServiceExtMinusDataToCloneType>[] = [
|
|
365
|
+
'creator',
|
|
366
|
+
'owner',
|
|
367
|
+
'bookings',
|
|
368
|
+
] as const;
|
|
369
|
+
|
|
370
|
+
export const VENUE_DATA_TO_CLONE = [
|
|
371
|
+
|
|
372
|
+
] as const;
|
|
373
|
+
|
|
374
|
+
type VenueExtMinusDataToCloneType = Omit<Venue, UnionFromArray<typeof VENUE_DATA_TO_CLONE>>;
|
|
375
|
+
export const VENUE_DATA_TO_REMOVE: RemoveCommonProperties<Venue, VenueExtMinusDataToCloneType>[] = [
|
|
376
|
+
// 'bashEvents',
|
|
377
|
+
] as const;
|
|
378
|
+
//-----------------------------------------
|
|
379
|
+
|
|
380
|
+
export interface BashNotificationExt extends BashNotification {
|
|
381
|
+
creator?: PublicUser;
|
|
382
|
+
bashEvent?: BashEvent;
|
|
383
|
+
eventTask?: EventTask;
|
|
384
|
+
invitation?: Invitation;
|
|
385
|
+
reminders?: Reminder[];
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
export interface TargetAudienceExt extends TargetAudience {
|
|
389
|
+
formattedDetails?: string;
|
|
390
|
+
isSelected?: boolean;
|
|
391
|
+
priorityScore?: number;
|
|
392
|
+
tags?: string[];
|
|
393
|
+
createdAt?: Date;
|
|
394
|
+
updatedAt?: Date;
|
|
395
|
+
notes?: string;
|
|
396
|
+
isHighlighted?: boolean;
|
|
397
|
+
associatedCampaigns?: string[];
|
|
398
|
+
icon?: string;
|
|
399
|
+
relatedAudiences?: TargetAudienceExt[];
|
|
400
|
+
conversionRate?: number;
|
|
401
|
+
feedbackScore?: number;
|
|
402
|
+
interactionHistory?: { date: Date; interaction: string }[];
|
|
403
|
+
customAttributes?: { [key: string]: any };
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
export const BASH_NOTIFICATION_DATA_TO_INCLUDE = {
|
|
408
|
+
bashEvent: {
|
|
409
|
+
select: {
|
|
410
|
+
coverPhoto: true,
|
|
411
|
+
},
|
|
412
|
+
},
|
|
413
|
+
creator: {
|
|
414
|
+
select: {
|
|
415
|
+
image: true,
|
|
416
|
+
},
|
|
417
|
+
},
|
|
418
|
+
} satisfies Prisma.BashNotificationInclude;
|
|
419
|
+
|
|
420
|
+
export interface EventTaskExt extends EventTask {
|
|
421
|
+
creator: PublicUser;
|
|
422
|
+
assignedTo?: PublicUser | null;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
export const EVENT_TASK_DATA_TO_INCLUDE = {
|
|
426
|
+
creator: {
|
|
427
|
+
select: FRONT_END_USER_DATA_TO_SELECT
|
|
428
|
+
},
|
|
429
|
+
assignedTo: {
|
|
430
|
+
select: FRONT_END_USER_DATA_TO_SELECT
|
|
431
|
+
}
|
|
432
|
+
} satisfies Prisma.EventTaskInclude;
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
export interface InvitationExt extends Invitation {
|
|
436
|
+
creator: PublicUser;
|
|
437
|
+
sentTo: PublicUser;
|
|
438
|
+
tickets: Ticket[];
|
|
439
|
+
associatedBash?: AssociatedBash | null;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
export const INVITATION_DATA_TO_INCLUDE = {
|
|
443
|
+
creator: {
|
|
444
|
+
select: FRONT_END_USER_DATA_TO_SELECT
|
|
445
|
+
},
|
|
446
|
+
sentTo: {
|
|
447
|
+
select: FRONT_END_USER_DATA_TO_SELECT
|
|
448
|
+
},
|
|
449
|
+
tickets: true,
|
|
450
|
+
} satisfies Prisma.InvitationInclude;
|
|
451
|
+
|
|
452
|
+
export interface InvitationExtraData extends Invitation {
|
|
453
|
+
isFreeGuest?: boolean;
|
|
454
|
+
isOrganizer?: boolean;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
export interface AssociatedBashExt extends AssociatedBash {
|
|
458
|
+
bashEvent: BashEventExt;
|
|
459
|
+
invitation: InvitationExt;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
export interface AssociatedServiceExt extends AssociatedService {
|
|
463
|
+
service: ServiceExt;
|
|
464
|
+
// invitation: InvitationExt;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
export const ASSOCIATED_BASH_DATA_TO_INCLUDE = {
|
|
468
|
+
bashEvent: {
|
|
469
|
+
include: BASH_EVENT_DATA_TO_INCLUDE
|
|
470
|
+
},
|
|
471
|
+
invitation: {
|
|
472
|
+
include: INVITATION_DATA_TO_INCLUDE
|
|
473
|
+
}
|
|
474
|
+
} satisfies Prisma.AssociatedBashInclude;
|
|
475
|
+
|
|
476
|
+
export const ASSOCIATED_SERVICE_DATA_TO_INCLUDE = {
|
|
477
|
+
service: {
|
|
478
|
+
include: SERVICE_DATA_TO_INCLUDE
|
|
479
|
+
},
|
|
480
|
+
// invitation: {
|
|
481
|
+
// include: INVITATION_DATA_TO_INCLUDE
|
|
482
|
+
// }
|
|
483
|
+
} satisfies Prisma.AssociatedServiceInclude;
|
|
484
|
+
|
|
485
|
+
export interface TicketTierExt extends TicketTier {
|
|
486
|
+
bashEvent: BashEvent;
|
|
487
|
+
tickets: TicketExt[];
|
|
488
|
+
promoCodes: BashEventPromoCode[];
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
export interface TicketExt extends Ticket {
|
|
492
|
+
owner: PublicUser;
|
|
493
|
+
forUser: PublicUser;
|
|
494
|
+
checkout?: Checkout;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
export interface CheckoutExt extends Checkout {
|
|
498
|
+
owner: PublicUser;
|
|
499
|
+
tickets: Ticket[]
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
export const CHECKOUT_DATA_TO_INCLUDE = {
|
|
503
|
+
owner: {
|
|
504
|
+
select: FRONT_END_USER_DATA_TO_SELECT
|
|
505
|
+
},
|
|
506
|
+
tickets: {
|
|
507
|
+
select: {
|
|
508
|
+
ownerId: true
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
} satisfies Prisma.CheckoutInclude;
|
|
512
|
+
|
|
513
|
+
export interface ReviewExt extends Review {
|
|
514
|
+
comments: BashComment[];
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
export const CONTACT_DATA_TO_INCLUDE = {
|
|
518
|
+
contactOwner: {
|
|
519
|
+
select: FRONT_END_USER_DATA_TO_SELECT
|
|
520
|
+
},
|
|
521
|
+
} satisfies Prisma.ContactInclude;
|
|
522
|
+
|
|
523
|
+
export interface UserExt extends User {
|
|
524
|
+
services?: Service[] | null;
|
|
525
|
+
|
|
526
|
+
// Do not include in fetch as there could be thousands of these
|
|
527
|
+
associatedBashes?: AssociatedBash[] | null;
|
|
528
|
+
associatedServices?: AssociatedService[] | null;
|
|
529
|
+
socialMediaProfiles?: SocialMediaProfile[] | null;
|
|
530
|
+
socialMediaPlatforms?: SocialMediaPlatform[] | null;
|
|
531
|
+
reviews?: ReviewExt[] | null;
|
|
532
|
+
contacts?: Contact[] | null;
|
|
533
|
+
ticketsIOwn?: TicketExt[] | null;
|
|
534
|
+
ownedServices?: ServiceExt[];
|
|
535
|
+
createdServices?: ServiceExt[];
|
|
536
|
+
password?: string;
|
|
537
|
+
otp?: string;
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
export const USER_DATA_SELECT_REVIEWS_COMMENTS = {
|
|
541
|
+
reviews: {
|
|
542
|
+
include: {
|
|
543
|
+
comments: true
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
} satisfies Prisma.UserSelect;
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
export type PublicUser = Pick<UserExt, keyof typeof FRONT_END_USER_DATA_TO_SELECT>
|
|
550
|
+
& Partial<Pick<UserExt, keyof typeof USER_DATA_SELECT_REVIEWS_COMMENTS>>;
|
|
551
|
+
|
|
552
|
+
export type PublicStripeAccount = Pick<StripeAccountExt, keyof typeof PUBLIC_STRIPE_ACCOUNT_DATA_TO_SELECT>;
|
|
553
|
+
|
|
554
|
+
export type PublicServiceListingSubscription = Pick<ServiceListingSubscription, keyof typeof PUBLIC_SERVICE_LISTING_SUBSCRIPTION_DATA_TO_SELECT>;
|