@bash-app/bash-common 29.66.0 → 29.68.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.
@@ -5,6 +5,8 @@ import {
5
5
  Contact,
6
6
  DayOfWeek,
7
7
  Prisma,
8
+ ServiceBookingAddOn,
9
+ ServiceBookingDay,
8
10
  // Rate,
9
11
  ServiceTypes,
10
12
  Ticket,
@@ -21,6 +23,12 @@ import {
21
23
  BashEventExt,
22
24
  } from "./extendedSchemas";
23
25
  import { ServiceSubscriptionTier } from "./utils/userSubscriptionUtils";
26
+ import {
27
+ ServiceAddonInput,
28
+ ServiceGetPriceToBookResult,
29
+ } from "./utils/service/serviceBookingUtils";
30
+ import { LuxonDateRange } from "./utils/luxonUtils";
31
+ import { ServiceCantBookReason } from "./utils/service/serviceBookingApiUtils";
24
32
 
25
33
  export const PASSWORD_MIN_LENGTH = 8 as const;
26
34
  export const PASSWORD_REQUIREMENTS_REGEX = new RegExp(
@@ -181,7 +189,6 @@ export type RequiredStripeInfoMissingErrorDataType = {
181
189
  };
182
190
  export type ContactOrUser = Contact | PublicUser;
183
191
 
184
- export type UnionFromArray<T extends ReadonlyArray<any>> = T[number];
185
192
  export type ValueOf<T> = T[keyof T];
186
193
 
187
194
  export type FilterFields = {
@@ -201,6 +208,65 @@ export type TicketTierWherePriceIsAString = Omit<TicketTier, "price"> & {
201
208
  price: string;
202
209
  } & { cannotDelete: boolean };
203
210
 
211
+ export type ServiceAddonApiParams = {
212
+ addonId: string;
213
+ chosenQuantity: number;
214
+ };
215
+
216
+ export type ServiceBookedDayApiParams = {
217
+ serviceId: string;
218
+ forUserId: number;
219
+
220
+ startDate: string;
221
+ endDate: string;
222
+ addOns: ServiceAddonApiParams[];
223
+
224
+ isFreeGuest?: boolean;
225
+ allowPromiseToPay?: boolean;
226
+ };
227
+
228
+ export type ServiceBookedDayApiParamsLuxon = Omit<
229
+ ServiceBookedDayApiParams,
230
+ "startDate" | "endDate"
231
+ > & {
232
+ dateTimeRange: LuxonDateRange;
233
+ };
234
+
235
+ export type ServiceBookingApiParamsLuxon = Omit<
236
+ ServiceBookingApiParams,
237
+ "bookedDays"
238
+ > & {
239
+ bookedDays: ServiceBookedDayApiParamsLuxon[];
240
+ };
241
+
242
+ export type ServiceBookingApiParams = {
243
+ serviceId: string;
244
+ bookedDays: ServiceBookedDayApiParams[];
245
+ timezone: string;
246
+ };
247
+
248
+ export type ServiceCanBookApiParams = {} & ServiceBookingApiParams;
249
+
250
+ export type ServicePriceToBookApiParams = {
251
+ // stripeAccountDBId: string;
252
+ } & ServiceBookingApiParams;
253
+
254
+ export type ServicePriceToBookApiResult = {
255
+ // taxes: number;
256
+ // totalAfterTaxes: number;
257
+ // currency: string;
258
+ } & ServiceGetPriceToBookResult;
259
+
260
+ // export type ServiceBookingApiResult = {
261
+ // serviceId: string;
262
+ // bookedDays: ServiceBookingDay[];
263
+ // };
264
+
265
+ export type ServiceCanBookApiResult = {
266
+ canBook: boolean;
267
+ reason?: ServiceCantBookReason;
268
+ };
269
+
204
270
  export interface DeletedAndHiddenTiers {
205
271
  deletedTiers: TicketTier[];
206
272
  hiddenTiers: TicketTier[];
@@ -302,6 +368,7 @@ export interface ApiResult<T, P extends ErrorDataType = ErrorDataType> {
302
368
  error?: string;
303
369
  errorType?: ApiErrorType;
304
370
  errorData?: P;
371
+ rawResponse?: any;
305
372
  }
306
373
 
307
374
  export enum ApiErrorType {
@@ -489,6 +556,7 @@ export interface IMediaUploadArgs {
489
556
  mimetype: string;
490
557
  idOfLinkedPrismaEntry: string;
491
558
  assetKey: string;
559
+ fileBuffer?: Buffer;
492
560
  }
493
561
 
494
562
  export interface IPreSignedUrlArgs {
@@ -535,16 +603,6 @@ export const DressTagsToString: { [key in BashEventDressTags]: string } = {
535
603
  // [ServicesTags.AwardRecipient]: "Award recipient"
536
604
  // }
537
605
 
538
- export const DayOfWeekToString: { [key in DayOfWeek]: string } = {
539
- [DayOfWeek.Sunday]: "S",
540
- [DayOfWeek.Monday]: "M",
541
- [DayOfWeek.Tuesday]: "T",
542
- [DayOfWeek.Wednesday]: "W",
543
- [DayOfWeek.Thursday]: "T",
544
- [DayOfWeek.Friday]: "F",
545
- [DayOfWeek.Saturday]: "S",
546
- };
547
-
548
606
  export const YearsOfExperienceToString: { [key in YearsOfExperience]: string } =
549
607
  {
550
608
  [YearsOfExperience.LessThanOneYear]: "Less than one year",
@@ -561,118 +619,131 @@ export const BashEventTypeToString: BashEventTypeToStringType = {
561
619
  [BashEventType.AnimeAndCosplayFestival]: "Anime and Cosplay Festival",
562
620
  [BashEventType.AnniversaryCelebration]: "Anniversary Celebration",
563
621
  [BashEventType.ArtExhibitOpening]: "Art Exhibit Opening",
564
- [BashEventType.ArtAndCraftNight]: "Art and Craft Night",
565
- [BashEventType.BBQCookout]: "BBQ Cookout",
566
- [BashEventType.BabyShower]: "Baby Shower",
567
622
  [BashEventType.BachelorOrBacheloretteParty]: "Bachelor/Bachelorette Party",
568
623
  [BashEventType.BeachParty]: "Beach Party",
569
- [BashEventType.Birthday]: "Birthday",
570
624
  [BashEventType.BoatPartyOrCruise]: "Boat Party or Cruise",
571
- [BashEventType.Bonfire]: "Bonfire",
572
- [BashEventType.BookClubMeeting]: "Book Club Meeting",
573
- [BashEventType.BridalShower]: "Bridal Shower",
574
- [BashEventType.BrunchGathering]: "Brunch Gathering",
575
625
  [BashEventType.CarShow]: "Car Show",
576
626
  [BashEventType.CarnivalAndFair]: "Carnival and Fair",
577
627
  [BashEventType.CasinoNight]: "Casino Night",
578
628
  [BashEventType.CasualMixer]: "Casual Mixer",
579
- [BashEventType.CharityBall]: "Charity Ball",
580
- [BashEventType.CharityFundraiser]: "Charity Fundraiser",
581
629
  [BashEventType.ChristmasParty]: "Christmas Party",
582
- [BashEventType.ChurchEvent]: "Church Event",
630
+ [BashEventType.CharityGala]: "Charity Gala",
583
631
  [BashEventType.CircusOrCarnivalParty]: "Circus/Carnival Party",
584
- [BashEventType.CocktailParty]: "Cocktail Party",
585
632
  [BashEventType.CollegeParty_FraternityOrSorority]:
586
633
  "College Party (Fraternity/Sorority)",
587
634
  [BashEventType.ComedyShowOrStandUpComedyNight]:
588
635
  "Comedy Show Or Stand-Up Comedy Night",
589
636
  [BashEventType.ComicConvention]: "Comic Convention",
637
+ [BashEventType.CommunityMovieNight]: "Community Movie Night",
590
638
  [BashEventType.Competition]: "Competition",
591
639
  [BashEventType.Concert]: "Concert",
592
640
  [BashEventType.CookingCompetition]: "Cooking Competition",
593
641
  [BashEventType.CorporateEventOrOfficeParty]: "Corporate Event/Office Party",
594
- [BashEventType.CostumeParty_Theme_Based]: "Costume Party (Theme-Based)",
595
642
  [BashEventType.CulturalFestival]: "Cultural Festival",
596
643
  [BashEventType.DanceParty]: "Dance Party",
644
+ [BashEventType.ESportsGamingTournament]: "E-sports Gaming Tournament",
645
+ [BashEventType.LuxuryRetreat]: "Luxury Retreat",
646
+ [BashEventType.FashionShow]: "Fashion Show",
647
+ [BashEventType.Festival]: "Festival",
648
+ [BashEventType.FestivalFilm]: "Film Festival",
649
+ [BashEventType.FestivalFood]: "Food Festival",
650
+ [BashEventType.Fundraiser]: "Fundraiser",
651
+ [BashEventType.HalloweenParty]: "Halloween Party",
652
+ [BashEventType.HolidayParty]: "Holiday Party",
653
+ [BashEventType.HouseParty]: "House Party",
654
+ [BashEventType.KaraokeNight]: "Karaoke Night",
655
+ [BashEventType.MansionParty]: "Mansion Party",
656
+ [BashEventType.MardiGras]: "Mardi Gras",
657
+ [BashEventType.MasqueradeBall]: "Masquerade Ball",
658
+ [BashEventType.Mastermind]: "Mastermind",
659
+ [BashEventType.MoviePremiere]: "Movie Premiere",
660
+ [BashEventType.MusicFestival]: "Music Festival",
661
+ [BashEventType.NewYearsEveCelebration]: "New Year's Eve Celebration",
662
+ [BashEventType.OpenMicNight]: "Open Mic Night",
663
+ [BashEventType.OutdoorConcert]: "Outdoor Concert",
664
+ [BashEventType.Parade]: "Parade",
665
+ [BashEventType.Potluck]: "Potluck",
666
+ [BashEventType.PoolParty]: "Pool Party",
667
+ [BashEventType.ProductLaunch]: "Product Launch",
668
+ [BashEventType.ProfessionalNetworkingEvent]: "Professional Networking Event",
669
+ [BashEventType.Rave]: "Rave (EDM)",
670
+ [BashEventType.Reunion]: "Reunion",
671
+ [BashEventType.SchoolEvent]: "School Event",
672
+ [BashEventType.UniversityEvent]: "University Event",
673
+ [BashEventType.SportsTournament]: "Sports Tournament",
674
+ [BashEventType.PubCrawl]: "Pub Crawl",
675
+ [BashEventType.Tournament]: "Tournament",
676
+ [BashEventType.TradeShow]: "Trade Show",
677
+ [BashEventType.ValentinesDayParty]: "Valentine's Day Party",
678
+ [BashEventType.WeddingReception]: "Wedding Reception",
679
+ [BashEventType.WellnessFestival]: "Wellness Festival",
680
+ [BashEventType.WineTastingEvent]: "Wine Tasting Event",
681
+ [BashEventType.Other]: "Other",
682
+ [BashEventType.ExclusiveLuxuryRetreat]: "Exclusive Luxury Retreat",
683
+ [BashEventType.LaunchParty]: "Launch Party",
684
+ [BashEventType.ArtAndCraftNight]: "Art and Craft Night",
685
+ [BashEventType.BBQCookout]: "BBQ Cookout",
686
+ [BashEventType.BabyShower]: "Baby Shower",
687
+ [BashEventType.Birthday]: "Birthday",
688
+ [BashEventType.Bonfire]: "Bonfire",
689
+ [BashEventType.BookClubMeeting]: "Book Club Meeting",
690
+ [BashEventType.BridalShower]: "Bridal Shower",
691
+ [BashEventType.BrunchGathering]: "Brunch Gathering",
692
+ [BashEventType.CharityFundraiser]: "Charity Fundraiser",
693
+ [BashEventType.ChurchEvent]: "Church Event",
694
+ [BashEventType.CocktailParty]: "Cocktail Party",
695
+ [BashEventType.CostumeParty_Theme_Based]: "Theme-Based Costume Party",
597
696
  [BashEventType.DesertRave]: "Desert Rave",
598
697
  [BashEventType.DiscoNight]: "Disco Night",
599
698
  [BashEventType.EasterGathering]: "Easter Gathering",
600
699
  [BashEventType.EngagementParty]: "Engagement Party",
601
- [BashEventType.ESportsGamingTournament]: "E-sports Gaming Tournament",
602
- [BashEventType.ExclusiveLuxuryRetreat]: "Exclusive Luxury Retreat",
603
700
  [BashEventType.FantasyThemedParty]: "Fantasy Themed Party",
604
- [BashEventType.FashionShow]: "Fashion Show",
605
701
  [BashEventType.Fireside]: "Fireside",
606
702
  [BashEventType.FitnessFestival]: "Fitness Festival",
607
703
  [BashEventType.FlashMob]: "Flash Mob",
608
- [BashEventType.Festival]: "Festival",
609
- [BashEventType.FestivalFilm]: "Film Festival",
610
- [BashEventType.FestivalFood]: "Food Festival",
611
704
  [BashEventType.FundraisingEvent]: "Fundraising Event",
612
705
  [BashEventType.GalaDinner]: "Gala Dinner",
613
706
  [BashEventType.GameNight]: "Game Night",
614
707
  [BashEventType.GamingEvent]: "Gaming Event",
615
708
  [BashEventType.GardenParty]: "Garden Party",
616
- [BashEventType.GoingAwayPartyOrFarewell]: "Going-away Party or Farewell",
709
+ [BashEventType.GoingAwayPartyOrFarewell]: "Going Away Party/Farewell",
617
710
  [BashEventType.GraduationParty]: "Graduation Party",
618
- [BashEventType.HalloweenCostumeParty]: "Halloween Costume Party",
619
711
  [BashEventType.HanukkahParty]: "Hanukkah Party",
620
712
  [BashEventType.HistoricalEraParty]: "Historical Era Party",
621
- [BashEventType.HolidayParty]: "Holiday Party",
622
- [BashEventType.HouseParty]: "House Party",
623
713
  [BashEventType.HousewarmingParty]: "Housewarming Party",
624
- [BashEventType.KaraokeNight]: "Karaoke Night",
625
714
  [BashEventType.KiteFlyingFestival]: "Kite Flying Festival",
626
715
  [BashEventType.LiveBandPerformanceInALocalVenue]:
627
716
  "Live Band Performance in a Local Venue",
628
717
  [BashEventType.Luau]: "Luau",
629
- [BashEventType.MansionParty]: "Mansion Party",
630
- [BashEventType.MardiGras]: "Mardi Gras",
631
- [BashEventType.MasqueradeBall]: "Masquerade Ball",
632
718
  [BashEventType.MotorcycleRally]: "Motorcycle Rally",
633
719
  [BashEventType.MovieNight]: "Movie Night",
634
- [BashEventType.MoviePremiere]: "Movie Premiere",
635
- [BashEventType.MusicFestival]: "Music Festival",
636
- [BashEventType.NewYearsEveCelebration]: "New Year's Eve Celebration",
637
- [BashEventType.OpenMicNight]: "Open Mic Night",
638
720
  [BashEventType.OutdoorActivity]: "Outdoor Activity",
639
- [BashEventType.OutdoorConcert]: "Outdoor Concert",
640
721
  [BashEventType.OutdoorMovieNight_WithAProjector]:
641
- "Outdoor Movie Night (With a Projector)",
642
- [BashEventType.Parade]: "Parade",
722
+ "Outdoor Movie Night (With Projector)",
643
723
  [BashEventType.Party]: "Party",
644
- [BashEventType.PoolParty]: "Pool Party",
645
- [BashEventType.Potluck]: "Potluck",
646
- [BashEventType.PotluckVegan]: "Potluck (Vegan)",
724
+ [BashEventType.PotluckVegan]: "Vegan Potluck",
647
725
  [BashEventType.PreParty]: "Pre-Party",
648
- [BashEventType.ProductLaunch]: "Product Launch",
649
- [BashEventType.ProfessionalNetworkingEvent]: "Professional Networking Event",
650
726
  [BashEventType.Rave_General]: "Rave (General)",
651
727
  [BashEventType.RetirementCelebration]: "Retirement Celebration",
652
728
  [BashEventType.Reunion_FamilyOrSchoolOrFriends]:
653
729
  "Reunion (Family/School/Friends)",
654
730
  [BashEventType.SafariAdventureParty]: "Safari Adventure Party",
655
731
  [BashEventType.SchoolEvent_MiddleSchoolOrHighSchoolOrCollege]:
656
- "School Event (MiddleSchool, High School, College)",
657
- [BashEventType.ScienceFictionThemedParty]: "Science Fiction-Themed Party",
732
+ "School Event (Middle School/High School/College)",
733
+ [BashEventType.ScienceFictionThemedParty]: "Science Fiction Themed Party",
658
734
  [BashEventType.SocialClubEvent]: "Social Club Event",
659
- [BashEventType.SportsTournament]: "Sports Tournament",
660
735
  [BashEventType.SportsWatchParty]: "Sports Watch Party",
661
736
  [BashEventType.SuperheroThemedParty]: "Superhero Themed Party",
662
- [BashEventType.SurfCompetition]: "Surf Competition",
663
737
  [BashEventType.ThanksgivingDinner]: "Thanksgiving Dinner",
664
738
  [BashEventType.ThemedCostumeParty]: "Themed Costume Party",
665
739
  [BashEventType.ThemedDinnerParty]: "Themed Dinner Party",
666
740
  [BashEventType.ThemedPubCrawl]: "Themed Pub Crawl",
667
- [BashEventType.Tournament]: "Tournament",
668
741
  [BashEventType.TravelAndTradeShow]: "Travel and Trade Show",
669
742
  [BashEventType.TriviaNight]: "Trivia Night",
670
- [BashEventType.ValentinesDayParty]: "Valentine's Day Party",
671
- [BashEventType.WeddingReception]: "Wedding Reception",
672
743
  [BashEventType.WelcomeHomeParty]: "Welcome Home Party",
673
- [BashEventType.WellnessFestival]: "Wellness Festival",
674
- [BashEventType.WineTastingEvent]: "Wine Tasting Event",
675
- [BashEventType.Other]: "Other",
744
+ [BashEventType.HalloweenCostumeParty]: "Halloween Costume Party",
745
+ [BashEventType.SurfCompetition]: "Surf Competition",
746
+ [BashEventType.CharityBall]: "Charity Ball",
676
747
  };
677
748
 
678
749
  export type RecordKey = string | number | symbol;
@@ -29,7 +29,6 @@ import {
29
29
  Exhibitor,
30
30
  Sponsor,
31
31
  Organization,
32
- Booking,
33
32
  VolunteerService,
34
33
  Prisma,
35
34
  ServiceRange,
@@ -43,15 +42,26 @@ import {
43
42
  ServiceRatesAssociation,
44
43
  ServiceRate,
45
44
  ServiceDailyRates,
46
- ServiceSpecialRates,
47
45
  ServiceAddon,
48
46
  ServicePackage,
49
47
  UserSubscription,
50
48
  SocialMediaProfile,
51
49
  SocialMediaPlatform,
52
50
  ServiceSubscriptionCounts,
51
+ ServiceSpecialRates,
52
+ ServiceBookingAddOn,
53
+ ServiceBookingDay,
54
+ ServiceBookingPackage,
55
+ ServiceBookingCheckout,
56
+ ServiceBooking,
53
57
  } from "@prisma/client";
54
- import { SERVICE_LINK_DATA_TO_INCLUDE, UnionFromArray } from "./definitions";
58
+ import { SERVICE_LINK_DATA_TO_INCLUDE } from "./definitions";
59
+ import { serviceKeysArray } from "./utils/service/serviceUtils";
60
+ import {
61
+ createAllTrueObject,
62
+ RemoveCommonProperties,
63
+ UnionFromArray,
64
+ } from "./utils/typeUtils";
55
65
 
56
66
  //------------------------------------------------------user subscriptions------------------------------------------------------
57
67
  export const PUBLIC_USER_SUBSCRIPTION_DATA_TO_SELECT = {
@@ -100,10 +110,10 @@ export const FRONT_END_USER_DATA_TO_SELECT = {
100
110
  // documentID: true,
101
111
  reviews: true,
102
112
  contacts: true,
103
- accepted: true,
104
- boughtTicket: true,
105
- noPay: true,
106
- supportedEvent: true,
113
+ accepted: true,
114
+ boughtTicket: true,
115
+ noPay: true,
116
+ supportedEvent: true,
107
117
  } satisfies Prisma.UserSelect;
108
118
 
109
119
  export const PRIVATE_USER_ACCOUNT_TO_SELECT = {
@@ -177,7 +187,6 @@ export const BASH_EVENT_DATA_TO_CLONE = [
177
187
  "invitations",
178
188
  ] as const;
179
189
 
180
- type RemoveCommonProperties<T, U> = keyof (Omit<T, keyof U> & Omit<U, keyof T>);
181
190
  type BashEventExtMinusDataToCloneType = Omit<
182
191
  BashEventExt,
183
192
  UnionFromArray<typeof BASH_EVENT_DATA_TO_CLONE>
@@ -189,6 +198,143 @@ export const BASH_EVENT_DATA_TO_REMOVE: RemoveCommonProperties<
189
198
  >[] = ["creator", "eventTasks", "tickets", "targetAudience", "amountOfGuests"];
190
199
 
191
200
  //---------------Services------------------
201
+ export const SERVICE_PACKAGE_DATA_TO_INCLUDE = {
202
+ serviceAddons: true,
203
+ } satisfies Prisma.ServicePackageInclude;
204
+
205
+ export const SERVICE_DAILYRATES_DATA_TO_INCLUDE = {
206
+ serviceRate: true,
207
+ } satisfies Prisma.ServiceDailyRatesInclude;
208
+
209
+ export const SERVICE_SPECIALRATES_DATA_TO_INCLUDE = {
210
+ serviceRate: true,
211
+ } satisfies Prisma.ServiceSpecialRatesInclude;
212
+
213
+ export const SERVICE_RATES_ASSOCIATION_DATA_TO_INCLUDE = {
214
+ serviceGeneralRates: true,
215
+ serviceDailyRates: {
216
+ include: SERVICE_DAILYRATES_DATA_TO_INCLUDE,
217
+ },
218
+ serviceSpecialRates: {
219
+ include: SERVICE_SPECIALRATES_DATA_TO_INCLUDE,
220
+ },
221
+ addons: true,
222
+ packages: {
223
+ include: SERVICE_PACKAGE_DATA_TO_INCLUDE,
224
+ },
225
+ media: true,
226
+ } satisfies Prisma.ServiceRatesAssociationInclude;
227
+
228
+ export interface ServiceRateExt extends ServiceRate {
229
+ serviceSpecialRates?: ServiceSpecialRates;
230
+ serviceDailyRates?: ServiceDailyRates;
231
+ serviceRatesAssociation?: ServiceRatesAssociation;
232
+ }
233
+
234
+ export interface ServiceAddonExt extends ServiceAddon {}
235
+
236
+ export interface ServicePackageExt extends ServicePackage {
237
+ serviceAddons: ServiceAddonExt[];
238
+ }
239
+
240
+ export interface ServiceDailyRatesExt extends ServiceDailyRates {
241
+ serviceRate?: ServiceRate;
242
+ }
243
+ export interface ServiceSpecialRatesExt extends ServiceSpecialRates {
244
+ serviceRate?: ServiceRate;
245
+ }
246
+
247
+ export interface ServiceRatesAssociationExt extends ServiceRatesAssociation {
248
+ serviceGeneralRates?: ServiceRate | null;
249
+ serviceDailyRates?: ServiceDailyRatesExt[];
250
+ serviceSpecialRates?: ServiceSpecialRatesExt[];
251
+
252
+ addons?: ServiceAddonExt[];
253
+ packages?: ServicePackageExt[];
254
+ media?: Media[];
255
+ }
256
+
257
+ export interface ServiceBookingAddOnExt extends ServiceBookingAddOn {
258
+ addOn: ServiceAddonExt;
259
+ }
260
+ export interface ServiceBookingPackageExt extends ServiceBookingPackage {
261
+ package: ServicePackageExt;
262
+ }
263
+ export interface ServiceBookingDayExt extends ServiceBookingDay {
264
+ // service: ServiceExt; //we don't need service here
265
+ addOns: ServiceBookingAddOnExt[];
266
+ packages: ServiceBookingPackageExt[];
267
+ }
268
+
269
+ export interface ServiceBookingExt extends ServiceBooking {
270
+ // service: ServiceExt; //we don't need service here
271
+ bookedDays: ServiceBookingDayExt[];
272
+ checkout?: ServiceBookingCheckout | null;
273
+ creator: PublicUser;
274
+ forUser: PublicUser;
275
+ }
276
+
277
+ export interface ServiceBookingCheckoutExt extends ServiceBookingCheckout {
278
+ // service: ServiceExt; //we don't need service here
279
+ creator: PublicUser;
280
+ // bookingData: ServiceBookingExt;
281
+ }
282
+
283
+ export const SERVICE_BOOKING_ADDON_DATA_TO_INCLUDE = {
284
+ addOn: true,
285
+ } satisfies Prisma.ServiceBookingAddOnInclude;
286
+
287
+ export const SERVICE_BOOKING_PACKAGE_DATA_TO_INCLUDE = {
288
+ package: {
289
+ include: SERVICE_PACKAGE_DATA_TO_INCLUDE,
290
+ },
291
+ } satisfies Prisma.ServiceBookingPackageInclude;
292
+
293
+ export const SERVICE_BOOKING_DAY_DATA_TO_INCLUDE = {
294
+ addOns: {
295
+ include: SERVICE_BOOKING_ADDON_DATA_TO_INCLUDE,
296
+ },
297
+ packages: {
298
+ include: SERVICE_BOOKING_PACKAGE_DATA_TO_INCLUDE,
299
+ },
300
+ } satisfies Prisma.ServiceBookingDayInclude;
301
+
302
+ export const SERVICE_BOOKING_CHECKOUT_DATA_TO_INCLUDE = {
303
+ // bookingData: {
304
+ // include: SERVICE_BOOKING_DATA_TO_INCLUDE,
305
+ // },
306
+ creator: {
307
+ select: FRONT_END_USER_DATA_TO_SELECT,
308
+ },
309
+ } satisfies Prisma.ServiceBookingCheckoutInclude;
310
+
311
+ export const FRONT_END_SERVICE_BOOKING_CHECKOUT_DATA_SELECT = {
312
+ id: true,
313
+ creatorId: true,
314
+ creator: true,
315
+ checkoutDateTime: true,
316
+ totalAmount: true,
317
+ depositAmount: true,
318
+ } satisfies Prisma.ServiceBookingCheckoutSelect;
319
+
320
+ export const SERVICE_BOOKING_PUBLIC_DATA_TO_INCLUDE = {
321
+ bookedDays: {
322
+ include: SERVICE_BOOKING_DAY_DATA_TO_INCLUDE,
323
+ },
324
+ } satisfies Prisma.ServiceBookingInclude;
325
+
326
+ export const SERVICE_BOOKING_PRIVATE_DATA_TO_INCLUDE = {
327
+ ...SERVICE_BOOKING_PUBLIC_DATA_TO_INCLUDE,
328
+ checkout: {
329
+ select: FRONT_END_SERVICE_BOOKING_CHECKOUT_DATA_SELECT,
330
+ },
331
+ creator: {
332
+ select: FRONT_END_USER_DATA_TO_SELECT,
333
+ },
334
+ forUser: {
335
+ select: FRONT_END_USER_DATA_TO_SELECT,
336
+ },
337
+ } satisfies Prisma.ServiceBookingInclude;
192
338
  export interface ServiceExt extends Service {
193
339
  owner?: PublicUser | null;
194
340
  creator?: PublicUser | null;
@@ -197,7 +343,6 @@ export interface ServiceExt extends Service {
197
343
 
198
344
  // availableDateTimes?: Availability[];
199
345
 
200
- bookings?: Booking[];
201
346
  // rates?: Rate[];
202
347
  targetAudience?: TargetAudience | null;
203
348
  media?: Media[];
@@ -218,35 +363,10 @@ export interface ServiceExt extends Service {
218
363
  associatedServicesReferencingMe?: AssociatedService[];
219
364
 
220
365
  // googleReviews: GoogleReview[];
221
- }
222
366
 
223
- export interface ServiceRateExt extends ServiceRate {
224
- serviceSpecialRates?: ServiceSpecialRates;
225
- serviceDailyRates?: ServiceDailyRates;
226
- serviceRatesAssociation?: ServiceRatesAssociation;
227
- }
228
-
229
- export interface ServicePackageExt extends ServicePackage {
230
- serviceAddons: ServiceAddon[];
231
- }
232
-
233
- export interface ServiceDailyRatesExt extends ServiceDailyRates {
234
- serviceRate?: ServiceRate;
235
- }
236
- export interface ServiceSpecialRatesExt extends ServiceSpecialRates {
237
- serviceRate?: ServiceRate;
367
+ // bookedCheckouts: ServiceBookingCheckoutExt[]; //not necessary to include
368
+ bookings?: ServiceBookingExt[];
238
369
  }
239
-
240
- export interface ServiceRatesAssociationExt extends ServiceRatesAssociation {
241
- serviceGeneralRates?: ServiceRate | null;
242
- serviceDailyRates?: ServiceDailyRatesExt[];
243
- serviceSpecialRates?: ServiceSpecialRatesExt[];
244
-
245
- addons?: ServiceAddon[];
246
- packages?: ServicePackageExt[];
247
- media?: Media[];
248
- }
249
-
250
370
  export interface EventServiceExt extends EventService {
251
371
  service: ServiceExt;
252
372
  crowdSize?: AmountOfGuests;
@@ -299,73 +419,6 @@ export interface ServiceLinkExt extends ServiceLink {
299
419
  link: Link;
300
420
  }
301
421
 
302
- // Create the final object dynamically
303
- function createAllTrueObject<T extends string>(keys: T[]): Record<T, true> {
304
- return keys.reduce((acc, key) => {
305
- acc[key] = true;
306
- return acc;
307
- }, {} as Record<T, true>);
308
- }
309
-
310
- // Define the keys and values in a single object
311
- const serviceKeysObject = {
312
- eventService: true,
313
- entertainmentService: true,
314
- vendor: true,
315
- exhibitor: true,
316
- sponsor: true,
317
- venue: true,
318
- organization: true,
319
- } as const;
320
-
321
- export type ServiceSpecificName = keyof typeof serviceKeysObject;
322
-
323
- const serviceKeysArray = Object.keys(serviceKeysObject);
324
-
325
- export type ServiceSpecificType = ServiceExt[ServiceSpecificName];
326
-
327
- export const specificServiceMap: Record<ServiceTypes, ServiceSpecificName> = {
328
- EventServices: "eventService",
329
- EntertainmentServices: "entertainmentService",
330
- Vendors: "vendor",
331
- Exhibitors: "exhibitor",
332
- Sponsors: "sponsor",
333
- Venues: "venue",
334
- Organizations: "organization",
335
- } as const;
336
-
337
- export const serviceTypeToField = (
338
- serviceType: ServiceTypes
339
- ): ServiceSpecificName => {
340
- return specificServiceMap[serviceType];
341
- };
342
- export const SERVICE_PACKAGE_DATA_TO_INCLUDE = {
343
- serviceAddons: true,
344
- } satisfies Prisma.ServicePackageInclude;
345
-
346
- export const SERVICE_DAILYRATES_DATA_TO_INCLUDE = {
347
- serviceRate: true,
348
- } satisfies Prisma.ServiceDailyRatesInclude;
349
-
350
- export const SERVICE_SPECIALRATES_DATA_TO_INCLUDE = {
351
- serviceRate: true,
352
- } satisfies Prisma.ServiceSpecialRatesInclude;
353
-
354
- export const SERVICE_RATES_ASSOCIATION_DATA_TO_INCLUDE = {
355
- serviceGeneralRates: true,
356
- serviceDailyRates: {
357
- include: SERVICE_DAILYRATES_DATA_TO_INCLUDE,
358
- },
359
- serviceSpecialRates: {
360
- include: SERVICE_SPECIALRATES_DATA_TO_INCLUDE,
361
- },
362
- addons: true,
363
- packages: {
364
- include: SERVICE_PACKAGE_DATA_TO_INCLUDE,
365
- },
366
- media: true,
367
- } satisfies Prisma.ServiceRatesAssociationInclude;
368
-
369
422
  //------------Stripe Accounts--------------
370
423
  export const PUBLIC_STRIPE_ACCOUNT_DATA_TO_SELECT = {
371
424
  logo: true,
@@ -396,24 +449,26 @@ export const SERVICE_DATA_TO_INCLUDE = {
396
449
  select: FRONT_END_USER_DATA_TO_SELECT,
397
450
  },
398
451
  targetAudience: true,
399
- // amountOfGuests: true,
400
- // recurrence: true,
401
- // ticketTiers: {
402
- // include: TICKET_TIER_DATA_TO_INCLUDE
403
- // },
404
- // eventTasks: true,
405
452
  media: true,
406
453
  stripeAccount: {
407
454
  // ...STRIPE_ACCOUNT_DATA_TO_INCLUDE,
408
455
  select: PUBLIC_STRIPE_ACCOUNT_DATA_TO_SELECT,
409
456
  },
410
- // availableDateTimes: true,
411
457
  serviceLinks: {
412
458
  include: SERVICE_LINK_DATA_TO_INCLUDE,
413
459
  },
414
460
  serviceRatesAssociation: {
415
461
  include: SERVICE_RATES_ASSOCIATION_DATA_TO_INCLUDE,
416
462
  },
463
+ // bookings: {
464
+ // include: SERVICE_BOOKING_PRIVATE_DATA_TO_INCLUDE, //make sure only to include owned bookedDays
465
+ // },
466
+ bashEvent: {
467
+ include: BASH_EVENT_DATA_TO_INCLUDE,
468
+ },
469
+ // bookedCheckouts: {
470
+ // include: SERVICE_BOOKING_CHECKOUT_DATA_TO_INCLUDE, //make sure only to include owned checkouts
471
+ // },
417
472
  } satisfies Prisma.ServiceInclude;
418
473
 
419
474
  //full service data to include, includes specific service data
@@ -508,7 +563,7 @@ export const EVENT_TASK_DATA_TO_INCLUDE = {
508
563
  export interface InvitationExt extends Invitation {
509
564
  creator: PublicUser; // Include full details of the creator
510
565
  sentTo?: PublicUser; // Full details of the user the invitation was sent to
511
- associatedBash?: Partial<AssociatedBashExt> | null
566
+ associatedBash?: Partial<AssociatedBashExt> | null;
512
567
  tickets: Ticket[]; // Tickets associated with the invitation
513
568
  }
514
569
 
package/src/index.ts CHANGED
@@ -15,5 +15,14 @@ export * from "./utils/userPromoCodeUtils";
15
15
  export * from "./utils/userSubscriptionUtils";
16
16
  export * from "./utils/service/serviceUtils";
17
17
  export * from "./utils/service/venueUtils";
18
+ export * from "./utils/service/attendeeOptionUtils";
19
+ export * from "./utils/service/serviceRateDBUtils";
20
+ export * from "./utils/service/serviceDBUtils";
21
+ export * from "./utils/service/serviceRateUtils";
22
+ export * from "./utils/service/serviceBookingUtils";
23
+ export * from "./utils/service/serviceBookingApiUtils";
18
24
  export * from "./utils/stripeAccountUtils";
19
25
  export * from "./utils/entityUtils";
26
+ export * from "./utils/generalDateTimeUtils";
27
+ export * from "./utils/luxonUtils";
28
+ export * from "./utils/mathUtils";