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