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