@bash-app/bash-common 29.50.0 → 29.52.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bash-app/bash-common",
3
- "version": "29.50.0",
3
+ "version": "29.52.0",
4
4
  "description": "Common data and scripts to use on the frontend and backend",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -26,9 +26,9 @@
26
26
  "qrcode": "^1.5.3"
27
27
  },
28
28
  "peerDependencies": {
29
- "@prisma/client": "^5.18.0",
29
+ "@prisma/client": "^6.1.0",
30
30
  "dayjs": "^1.11.13",
31
- "prisma": "^5.18.0",
31
+ "prisma": "^6.1.0",
32
32
  "react-tailwindcss-datepicker": "^1.6.6",
33
33
  "tsx": "^4.10.3"
34
34
  },
@@ -243,6 +243,7 @@ model BashEvent {
243
243
  venueId String? // Nullable, meaning it's optional
244
244
  venue Venue? @relation(fields: [venueId], references: [id])
245
245
  userPromoCodeRedemption UserPromoCodeRedemption[]
246
+ averageRating Float? @default(0)
246
247
  }
247
248
 
248
249
  model Coordinates {
@@ -628,6 +629,12 @@ enum ServiceCondition {
628
629
  Deactivated
629
630
  }
630
631
 
632
+ enum ServiceSubscriptionStatus {
633
+ None
634
+ Trialing
635
+ Normal
636
+ }
637
+
631
638
  enum VolunteerServiceStatus {
632
639
  Draft
633
640
  Pending
@@ -749,6 +756,10 @@ model Review {
749
756
  bashEventId String
750
757
  bashEvent BashEvent @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
751
758
  comments BashComment[]
759
+ createdAt DateTime @default(now()) // Add this for timestamps
760
+ updatedAt DateTime @updatedAt
761
+
762
+ @@unique([creatorId, bashEventId])
752
763
  }
753
764
 
754
765
  model GoogleReview {
@@ -840,6 +851,7 @@ model User {
840
851
  stripeCustomerId String? @unique
841
852
  stripeAccountId String? @unique
842
853
  isSuperUser Boolean @default(false)
854
+ isSuspended Boolean @default(false)
843
855
  googleCalendarAccess String?
844
856
  givenName String?
845
857
  familyName String?
@@ -870,6 +882,8 @@ model User {
870
882
  competitionPrizes Prize[]
871
883
  userRatingGiven UserRatingGiven[]
872
884
  userRating UserRating[]
885
+ hostRating Float?
886
+ totalRatings Int?
873
887
  magicLink String?
874
888
  magicLinkExpiration DateTime?
875
889
  magicLinkUsed DateTime?
@@ -903,6 +917,13 @@ model User {
903
917
  volunteerService VolunteerService[]
904
918
  stripeAccounts StripeAccount[]
905
919
  userPromoCodeRedemption UserPromoCodeRedemption[]
920
+ accepted Boolean? @default(false) // Tracks if the user accepted the invitation
921
+ boughtTicket Boolean? @default(false) // Tracks if the user bought a ticket
922
+ noPay Boolean? @default(false) // Tracks if the user is marked as "noPay"
923
+ supportedEvent Boolean? @default(false) // Tracks if the user supported the event
924
+
925
+ // primaryStripeAccountDBId String? @unique
926
+ // primaryStripeAccountDB StripeAccount? @relation("PrimaryStripeAccount", fields: [primaryStripeAccountDBId], references: [id], onDelete: Restrict, onUpdate: Restrict)
906
927
  }
907
928
 
908
929
  model Contact {
@@ -980,10 +1001,20 @@ enum UserSubscriptionType {
980
1001
  // VIP
981
1002
  }
982
1003
 
983
- enum ServiceSubscriptionTier {
984
- Ally
985
- Partner
986
- Patreon
1004
+ // enum ServiceSubscriptionTier {
1005
+ // Ally
1006
+ // Partner
1007
+ // Patreon
1008
+ // }
1009
+
1010
+ model ServiceSubscriptionCounts {
1011
+ id String @id @default(cuid())
1012
+
1013
+ allyCount Int @default(0)
1014
+ partnerCount Int @default(0)
1015
+ patronCount Int @default(0)
1016
+ subscriptionCount UserSubscription? @relation("subscriptionCount")
1017
+ listedCount UserSubscription? @relation("listedCount")
987
1018
  }
988
1019
 
989
1020
  model UserSubscription {
@@ -995,15 +1026,29 @@ model UserSubscription {
995
1026
  stripeAccountId String @unique
996
1027
  stripeAccount StripeAccount @relation(fields: [stripeAccountId], references: [id], onDelete: Restrict, onUpdate: Restrict)
997
1028
 
998
- stripeCheckoutSessionId String? @unique
999
1029
  stripeSubscriptionId String? @unique
1030
+ stripeCheckoutSessionId String? @unique //used to set default payment method if one does not already exist on the customer
1000
1031
 
1001
1032
  type UserSubscriptionType?
1002
1033
  status UserSubscriptionStatus?
1003
1034
 
1004
1035
  //price addons
1005
- serviceSubscriptionTier ServiceSubscriptionTier?
1036
+ // serviceSubscriptionTier ServiceSubscriptionTier?
1037
+ subscriptionCountId String @unique
1038
+ subscriptionCount ServiceSubscriptionCounts @relation("subscriptionCount", fields: [subscriptionCountId], references: [id], onDelete: Cascade)
1039
+
1040
+ listedCountId String @unique
1041
+ listedCount ServiceSubscriptionCounts @relation("listedCount", fields: [listedCountId], references: [id], onDelete: Cascade)
1006
1042
 
1043
+ // allySubscriptionCount Int @default(0)
1044
+ // partnerSubscriptionCount Int @default(0)
1045
+ // patreonSubscriptionCount Int @default(0)
1046
+
1047
+ // allyServicesListed Int @default(0)
1048
+ // partnerServicesListed Int @default(0)
1049
+ // patreonServicesListed Int @default(0)
1050
+
1051
+ @@index([ownerId])
1007
1052
  @@index([stripeCheckoutSessionId])
1008
1053
  @@index([stripeSubscriptionId])
1009
1054
  }
@@ -1012,9 +1057,10 @@ model UserSubscription {
1012
1057
  model Service {
1013
1058
  id String @id @default(cuid())
1014
1059
 
1015
- serviceType ServiceTypes?
1016
- serviceStatus ServiceStatus @default(Draft)
1017
- serviceCondition ServiceCondition @default(Pending)
1060
+ serviceType ServiceTypes?
1061
+ serviceStatus ServiceStatus @default(Draft)
1062
+ serviceCondition ServiceCondition @default(Pending)
1063
+ subscriptionStatus ServiceSubscriptionStatus @default(None)
1018
1064
 
1019
1065
  isApproved Boolean @default(false)
1020
1066
 
@@ -0,0 +1,31 @@
1
+ # run this script after any schema change to make sure the typescript defintions are updated or
2
+ #... or if npm i is run on any of the repos, as it may overwrite the symlink
3
+
4
+ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
5
+
6
+ PATH_TO_PARENT_DIR="../.."
7
+ NODE_MODULES_PATH="node_modules/@bash-app"
8
+ FRONT_END_TARGET="$SCRIPT_DIR/$PATH_TO_PARENT_DIR/bash-app"
9
+ API_TARGET="$SCRIPT_DIR/$PATH_TO_PARENT_DIR/api"
10
+
11
+ TARGETS=(
12
+ $FRONT_END_TARGET
13
+ $API_TARGET
14
+ )
15
+
16
+ BASH_COMMON_TARGET="$SCRIPT_DIR/$PATH_TO_PARENT_DIR/bash-common"
17
+
18
+ echo "FRONT_END_TARGET: $FRONT_END_TARGET"
19
+ echo "API_TARGET: $API_TARGET"
20
+ echo "BASH_COMMON_TARGET: $BASH_COMMON_TARGET"
21
+ printf "\n\n"
22
+
23
+ cd $BASH_COMMON_TARGET && npx prisma generate
24
+
25
+ for TARGET in "${TARGETS[@]}"; do
26
+ rm -rf "$TARGET/$NODE_MODULES_PATH"
27
+ mkdir -p "$TARGET/$NODE_MODULES_PATH"
28
+
29
+ ln -s "$BASH_COMMON_TARGET" "$TARGET/$NODE_MODULES_PATH"
30
+ cd $TARGET && cp -rf "./$NODE_MODULES_PATH/bash-common/prisma" . && npm run generate
31
+ done
@@ -10,23 +10,42 @@ import {
10
10
  Ticket,
11
11
  TicketTier,
12
12
  User,
13
- YearsOfExperience
13
+ UserSubscriptionType,
14
+ YearsOfExperience,
14
15
  } from "@prisma/client";
15
- import { ServiceExt, CheckoutExt, PublicUser, VolunteerServiceExt, BashEventExt} from "./extendedSchemas";
16
+ import {
17
+ ServiceExt,
18
+ CheckoutExt,
19
+ PublicUser,
20
+ VolunteerServiceExt,
21
+ BashEventExt,
22
+ } from "./extendedSchemas";
23
+ import { ServiceSubscriptionTier } from "./utils/userSubscriptionUtils";
16
24
 
17
25
  export const PASSWORD_MIN_LENGTH = 8 as const;
18
- export const PASSWORD_REQUIREMENTS_REGEX = new RegExp(String.raw`^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&^#])[A-Za-z\d@$!%*?&^#]{${PASSWORD_MIN_LENGTH},}$`);
19
- export const BASH_FEE_PERCENTAGE = 0.10;
20
- export const GOOGLE_CALLBACK_URL = '/auth/google/callback' as const;
21
- export const CHECKOUT_RETURN_SUCCESS_URL = `/checkout-return/success/{CHECKOUT_SESSION_ID}` as const;
22
- export const CHECKOUT_RETURN_CANCEL_URL = `/checkout-return/cancel/{CHECKOUT_SESSION_ID}` as const;
23
- export const CHECKOUT_RETURN_SUCCESS_URL_PAGE = '/checkout-return/success/$checkoutSessionId' as const;
24
- export const CHECKOUT_RETURN_CANCEL_URL_PAGE = '/checkout-return/cancel/$checkoutSessionId' as const;
25
- export const DONATION_CHECKOUT_RETURN_SUCCESS_URL = `/donation-checkout-return/success/{CHECKOUT_SESSION_ID}` as const;
26
- export const DONATION_CHECKOUT_RETURN_CANCEL_URL = `/donation-checkout-return/cancel/{CHECKOUT_SESSION_ID}` as const;
27
- export const DONATION_CHECKOUT_RETURN_SUCCESS_URL_PAGE = '/donation-checkout-return/success/$checkoutSessionId' as const;
28
- export const DONATION_CHECKOUT_RETURN_CANCEL_URL_PAGE = '/donation-checkout-return/cancel/$checkoutSessionId' as const;
26
+ export const PASSWORD_REQUIREMENTS_REGEX = new RegExp(
27
+ String.raw`^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&^#])[A-Za-z\d@$!%*?&^#]{${PASSWORD_MIN_LENGTH},}$`
28
+ );
29
+ export const BASH_FEE_PERCENTAGE = 0.1;
30
+ export const GOOGLE_CALLBACK_URL = "/auth/google/callback" as const;
31
+ export const CHECKOUT_RETURN_SUCCESS_URL =
32
+ `/checkout-return/success/{CHECKOUT_SESSION_ID}` as const;
33
+ export const CHECKOUT_RETURN_CANCEL_URL =
34
+ `/checkout-return/cancel/{CHECKOUT_SESSION_ID}` as const;
35
+ export const CHECKOUT_RETURN_SUCCESS_URL_PAGE =
36
+ "/checkout-return/success/$checkoutSessionId" as const;
37
+ export const CHECKOUT_RETURN_CANCEL_URL_PAGE =
38
+ "/checkout-return/cancel/$checkoutSessionId" as const;
39
+ export const DONATION_CHECKOUT_RETURN_SUCCESS_URL =
40
+ `/donation-checkout-return/success/{CHECKOUT_SESSION_ID}` as const;
41
+ export const DONATION_CHECKOUT_RETURN_CANCEL_URL =
42
+ `/donation-checkout-return/cancel/{CHECKOUT_SESSION_ID}` as const;
43
+ export const DONATION_CHECKOUT_RETURN_SUCCESS_URL_PAGE =
44
+ "/donation-checkout-return/success/$checkoutSessionId" as const;
45
+ export const DONATION_CHECKOUT_RETURN_CANCEL_URL_PAGE =
46
+ "/donation-checkout-return/cancel/$checkoutSessionId" as const;
29
47
  export const VERIFICATION_RETURN_URL = `/sign-up` as const;
48
+ export const MY_SERVICES_URL = "/my-services" as const;
30
49
  export const BASH_DETAIL_URL = `/bash-detail` as const;
31
50
  export const SERVICE_PAGE_URL = `/service-page` as const;
32
51
  export const LOGIN_URL = `/login` as const;
@@ -37,43 +56,48 @@ export const SWR_KEY_AUTH_TOKEN = "auth-token" as const;
37
56
  export const PRICE_DOLLARS_AND_CENTS_RATIO = 100 as const;
38
57
 
39
58
  export const MIN_AMOUNT_OF_TICKETS_FOR_PUBLIC_EVENT_TO_SHOW = 0 as const;
40
- export const DEFAULT_MAX_NUMBER_OF_TICKETS = 35 as const
59
+ export const DEFAULT_MAX_NUMBER_OF_TICKETS = 35 as const;
41
60
  export const MIN_NUMBER_OF_TICKETS = 0 as const;
42
61
 
43
- export const MAX_NUMBER_OF_FREE_TICKETS_PER_USER_FOR_A_BASH_EVENT = 100 as const;
62
+ export const MAX_NUMBER_OF_FREE_TICKETS_PER_USER_FOR_A_BASH_EVENT =
63
+ 100 as const;
44
64
  export const MAX_NUMBER_OF_TICKETS_PER_REQUEST_FOR_A_BASH_EVENT = 50 as const;
45
65
 
46
- export const MONTHS_PREVIOUS_THAT_STRIPE_ACCOUNTS_WILL_BE_SEARCHED_BY_EMAIL = 1 as const;
66
+ export const MONTHS_PREVIOUS_THAT_STRIPE_ACCOUNTS_WILL_BE_SEARCHED_BY_EMAIL =
67
+ 1 as const;
47
68
 
48
69
  export const HTTP_CODE_OK = 200 as const;
49
70
  export const HTTP_CODE_TEMPORARY_REDIRECT = 307 as const;
50
- export const HTTP_CODE_INTERNAL_SERVER_ERR = 500 as const
71
+ export const HTTP_CODE_INTERNAL_SERVER_ERR = 500 as const;
51
72
  export const HTTP_CODE_BAD_REQUEST = 400 as const;
52
73
  export const HTTP_CODE_UNAUTHORIZED = 401 as const;
53
74
  export const HTTP_CODE_NOT_FOUND = 404 as const;
54
- export const ERR_UNAUTHORIZED_REQUEST = "Unauthorized to perform requested action. Have you logged in?" as const;
55
-
56
- export const URL_PARAMS_BASH_EVENT_ID = 'bashEventId' as const;
57
- export const URL_PARAMS_BASH_EVENT_TITLE = 'bashEventTitle' as const;
58
- export const URL_PARAMS_BASH_EVENT_DESC = 'bashEventDesc' as const;
59
- export const URL_PARAMS_BASH_EVENT_COVER_PHOTO = 'bashEventCoverPhoto' as const;
60
- export const URL_PARAMS_EMAIL = 'email' as const;
61
- export const URL_PARAMS_OTP_CODE = 'code' as const;
62
- export const URL_PARAMS_INCLUDE = 'include' as const;
63
- export const URL_PARAMS_REDIRECT = 'redirect' as const;
64
- export const URL_PARAMS_GOOGLE_ACCESS_CODE = 'code' as const;
65
- export const URL_PARAMS_LINKED_IN_CODE = 'code' as const;
66
- export const URL_PARAMS_STATE = 'state' as const;
67
- export const URL_PARAMS_STRIPE_CHECKOUT = 'checkout' as const;
68
- export type UrlParamsStripeCheckoutOptions = 'complete' | 'incomplete';
69
-
70
- export const URL_PARAMS_TICKET_LIST_DELIM = ',' as const;
71
- export const URL_PARAMS_TICKET_TIER_ID_NUMBER_OF_TICKETS_DATE_DELIM = '__' as const
72
- export const URL_PARAMS_NUMBER_OF_TICKETS_TICKETS_DATE_DELIM = '~~' as const
73
- export const URL_PARAMS_TICKETS_DATE_DELIM = ';;' as const
74
-
75
- export const URL_INCLUDE_QUERY_PARAM_DELIM = ',' as const;
76
- export const URL_INCLUDE_PRISMA_DATA_KEYS_DELIM = '.' as const;
75
+ export const ERR_UNAUTHORIZED_REQUEST =
76
+ "Unauthorized to perform requested action. Have you logged in?" as const;
77
+
78
+ export const URL_PARAMS_BASH_EVENT_ID = "bashEventId" as const;
79
+ export const URL_PARAMS_BASH_EVENT_TITLE = "bashEventTitle" as const;
80
+ export const URL_PARAMS_BASH_EVENT_DESC = "bashEventDesc" as const;
81
+ export const URL_PARAMS_BASH_EVENT_COVER_PHOTO = "bashEventCoverPhoto" as const;
82
+ export const URL_PARAMS_EMAIL = "email" as const;
83
+ export const URL_PARAMS_OTP_CODE = "code" as const;
84
+ export const URL_PARAMS_INCLUDE = "include" as const;
85
+ export const URL_PARAMS_REDIRECT = "redirect" as const;
86
+ export const URL_PARAMS_GOOGLE_ACCESS_CODE = "code" as const;
87
+ export const URL_PARAMS_LINKED_IN_CODE = "code" as const;
88
+ export const URL_PARAMS_STATE = "state" as const;
89
+ export const URL_PARAMS_STRIPE_CHECKOUT = "checkout" as const;
90
+ export const URL_PARAMS_SETUP_PAYMENT = "paymentSetup" as const;
91
+ export type UrlParamsStripeCheckoutOptions = "complete" | "incomplete";
92
+
93
+ export const URL_PARAMS_TICKET_LIST_DELIM = "," as const;
94
+ export const URL_PARAMS_TICKET_TIER_ID_NUMBER_OF_TICKETS_DATE_DELIM =
95
+ "__" as const;
96
+ export const URL_PARAMS_NUMBER_OF_TICKETS_TICKETS_DATE_DELIM = "~~" as const;
97
+ export const URL_PARAMS_TICKETS_DATE_DELIM = ";;" as const;
98
+
99
+ export const URL_INCLUDE_QUERY_PARAM_DELIM = "," as const;
100
+ export const URL_INCLUDE_PRISMA_DATA_KEYS_DELIM = "." as const;
77
101
 
78
102
  export const DEFAULT_PRISMA_TTL_SECONDS = 60 as const;
79
103
  export const PRISMA_MEDIA_TTL_SECONDS = 60 * 5; // 5 hours
@@ -83,7 +107,7 @@ export const PRISMA_SERVICE_TTL_SECONDS = 60 as const;
83
107
 
84
108
  export const DEBOUNCE_WAIT = 1000 as const;
85
109
 
86
- export const ASSET_KEY_DELIM = '__' as const;
110
+ export const ASSET_KEY_DELIM = "__" as const;
87
111
  export const ASSET_MAX_MD5_BYTE_LENGTH = 1024 * 100; // 100kb
88
112
 
89
113
  export const MIN_NUMBER_OF_HOURS = 1;
@@ -93,7 +117,6 @@ export const SERVICE_LINK_DATA_TO_INCLUDE = {
93
117
  link: true,
94
118
  } satisfies Prisma.ServiceLinkInclude;
95
119
 
96
-
97
120
  // export type ServiceSpecificName = keyof Pick<
98
121
  // ServiceExt,
99
122
  // "eventService" |
@@ -105,9 +128,7 @@ export const SERVICE_LINK_DATA_TO_INCLUDE = {
105
128
  // "organization"
106
129
  // >;
107
130
 
108
- export const VENUE_DATA_TO_INCLUDE = {
109
-
110
- } satisfies Prisma.VenueInclude;
131
+ export const VENUE_DATA_TO_INCLUDE = {} satisfies Prisma.VenueInclude;
111
132
 
112
133
  export const VENDOR_DATA_TO_INCLUDE = {
113
134
  crowdSize: true,
@@ -124,7 +145,9 @@ export const VOLUNTEER_DATA_TO_INCLUDE = {
124
145
  } satisfies Prisma.VolunteerServiceInclude;
125
146
 
126
147
  export type DateTimeArgType = Date | string | undefined | null;
127
- export type RequiredStripeInfoMissingErrorDataType = { [k in keyof User]?: { type: string, label: string } };
148
+ export type RequiredStripeInfoMissingErrorDataType = {
149
+ [k in keyof User]?: { type: string; label: string };
150
+ };
128
151
  export type ContactOrUser = Contact | PublicUser;
129
152
 
130
153
  export type UnionFromArray<T extends ReadonlyArray<any>> = T[number];
@@ -143,7 +166,9 @@ export type FilterFields = {
143
166
  eventFormat: string[];
144
167
  };
145
168
 
146
- export type TicketTierWherePriceIsAString = Omit<TicketTier, 'price'> & {price: string} & {cannotDelete: boolean};
169
+ export type TicketTierWherePriceIsAString = Omit<TicketTier, "price"> & {
170
+ price: string;
171
+ } & { cannotDelete: boolean };
147
172
 
148
173
  export interface DeletedAndHiddenTiers {
149
174
  deletedTiers: TicketTier[];
@@ -189,7 +214,7 @@ export interface AvailableTicketsForTicketTier {
189
214
  }
190
215
 
191
216
  export interface AvailableTicketsForTicketTierForDate {
192
- ticketTier: TicketTier,
217
+ ticketTier: TicketTier;
193
218
  availableTicketsForDate: NumberOfTicketsForDate;
194
219
  }
195
220
 
@@ -267,7 +292,28 @@ export enum ApiErrorType {
267
292
  export type ErrorDataType = Record<RecordKey, any>;
268
293
 
269
294
  export const StripeErrorToApiErrorType = {
270
- "stripe_tax_inactive": ApiErrorType.StripeAccountHasNotSetupTaxData
295
+ stripe_tax_inactive: ApiErrorType.StripeAccountHasNotSetupTaxData,
296
+ };
297
+
298
+ export interface ServiceGetSubscriptionCostArgs {
299
+ serviceId: string;
300
+ }
301
+
302
+ export interface StripeSubscriptionItemCost {
303
+ tax: number;
304
+ subtotal: number;
305
+ total: number;
306
+ }
307
+
308
+ export interface StripeServiceSubscriptionCost {
309
+ serviceId: string;
310
+ tier: ServiceSubscriptionTier;
311
+ isTrial: boolean;
312
+ cost: StripeSubscriptionItemCost;
313
+ }
314
+
315
+ export interface UserSubscriptionData {
316
+ subscriptionType: UserSubscriptionType;
271
317
  }
272
318
 
273
319
  export interface StripeCreateBashEventTicketsCheckoutSessionArgs {
@@ -285,11 +331,8 @@ export interface StripeCreateBashEventDonationCheckoutSessionArgs {
285
331
  donationAmount: number;
286
332
  }
287
333
 
288
- export interface StripeCreateServiceSubscriptionCheckoutSessionArgs {
289
- serviceId: string;
334
+ export interface StripeCreateSetupPaymentMethodSessionArgs {
290
335
  currency: string;
291
- paymentMethodType: string;
292
- promoCode?: string;
293
336
  successUrl: string;
294
337
  cancelUrl: string;
295
338
  }
@@ -302,7 +345,7 @@ export interface StripeCreateAccountPortalSessionArgs {
302
345
  export type StripeSessionRedirect = {
303
346
  stripeAccountIdDB: string;
304
347
  redirectUrl: string;
305
- }
348
+ };
306
349
 
307
350
  // export type ServiceStripeSessionRedirect = {
308
351
  // service: ServiceExt;
@@ -389,15 +432,15 @@ export interface IPreSignedUrlResult {
389
432
  }
390
433
 
391
434
  export const ASSET_MIME_TYPES_TO_EXT = {
392
- 'image/jpeg': '.jpeg',
393
- 'image/png': '.png',
394
- 'image/gif': '.gif',
395
- 'image/bmp': '.bmp',
396
- 'image/webp': '.webp',
397
- 'image/svg+xml': '.svg',
398
- 'image/tiff': '.tiff',
399
- 'image/vnd': '.ico',
400
- 'video/mp4': '.mp4',
435
+ "image/jpeg": ".jpeg",
436
+ "image/png": ".png",
437
+ "image/gif": ".gif",
438
+ "image/bmp": ".bmp",
439
+ "image/webp": ".webp",
440
+ "image/svg+xml": ".svg",
441
+ "image/tiff": ".tiff",
442
+ "image/vnd": ".ico",
443
+ "video/mp4": ".mp4",
401
444
  // '.webm',
402
445
  // '.ogg',
403
446
  // '.avi',
@@ -409,12 +452,12 @@ export const VALID_ASSET_MIME_TYPES = Object.keys(ASSET_MIME_TYPES_TO_EXT);
409
452
  export const VibeTagsToString: { [key in BashEventVibeTags]: string } = {
410
453
  [BashEventVibeTags.Wild]: "Wild",
411
454
  [BashEventVibeTags.Calm]: "Chill",
412
- }
455
+ };
413
456
  export const DressTagsToString: { [key in BashEventDressTags]: string } = {
414
457
  [BashEventDressTags.Casual]: "Casual",
415
458
  [BashEventDressTags.BusinessCasual]: "Business casual",
416
- [BashEventDressTags.Formal]: "Formal"
417
- }
459
+ [BashEventDressTags.Formal]: "Formal",
460
+ };
418
461
 
419
462
  // export const ServicesTagsToString: { [key in ServicesTags]: string } = {
420
463
  // [ServicesTags.Fast]: "Fast",
@@ -423,23 +466,23 @@ export const DressTagsToString: { [key in BashEventDressTags]: string } = {
423
466
  // }
424
467
 
425
468
  export const DayOfWeekToString: { [key in DayOfWeek]: string } = {
426
- [DayOfWeek.Sunday]: 'S',
427
- [DayOfWeek.Monday]: 'M',
428
- [DayOfWeek.Tuesday]: 'T',
429
- [DayOfWeek.Wednesday]: 'W',
430
- [DayOfWeek.Thursday]: 'T',
431
- [DayOfWeek.Friday]: 'F',
432
- [DayOfWeek.Saturday]: 'S',
433
- }
434
-
435
-
436
- export const YearsOfExperienceToString: { [key in YearsOfExperience]: string } = {
437
- [YearsOfExperience.LessThanOneYear]: 'Less than one year',
438
- [YearsOfExperience.OneToThreeYears]: 'One to three years',
439
- [YearsOfExperience.ThreeToFiveYears]: 'Three to five years',
440
- [YearsOfExperience.FivePlusYears]: 'More than five years',
469
+ [DayOfWeek.Sunday]: "S",
470
+ [DayOfWeek.Monday]: "M",
471
+ [DayOfWeek.Tuesday]: "T",
472
+ [DayOfWeek.Wednesday]: "W",
473
+ [DayOfWeek.Thursday]: "T",
474
+ [DayOfWeek.Friday]: "F",
475
+ [DayOfWeek.Saturday]: "S",
441
476
  };
442
477
 
478
+ export const YearsOfExperienceToString: { [key in YearsOfExperience]: string } =
479
+ {
480
+ [YearsOfExperience.LessThanOneYear]: "Less than one year",
481
+ [YearsOfExperience.OneToThreeYears]: "One to three years",
482
+ [YearsOfExperience.ThreeToFiveYears]: "Three to five years",
483
+ [YearsOfExperience.FivePlusYears]: "More than five years",
484
+ };
485
+
443
486
  export type BashEventTypeToStringType = {
444
487
  [key in BashEventType]: string;
445
488
  };
@@ -469,8 +512,10 @@ export const BashEventTypeToString: BashEventTypeToStringType = {
469
512
  [BashEventType.ChurchEvent]: "Church Event",
470
513
  [BashEventType.CircusOrCarnivalParty]: "Circus/Carnival Party",
471
514
  [BashEventType.CocktailParty]: "Cocktail Party",
472
- [BashEventType.CollegeParty_FraternityOrSorority]: "College Party (Fraternity/Sorority)",
473
- [BashEventType.ComedyShowOrStandUpComedyNight]: "Comedy Show Or Stand-Up Comedy Night",
515
+ [BashEventType.CollegeParty_FraternityOrSorority]:
516
+ "College Party (Fraternity/Sorority)",
517
+ [BashEventType.ComedyShowOrStandUpComedyNight]:
518
+ "Comedy Show Or Stand-Up Comedy Night",
474
519
  [BashEventType.ComicConvention]: "Comic Convention",
475
520
  [BashEventType.Competition]: "Competition",
476
521
  [BashEventType.Concert]: "Concert",
@@ -508,7 +553,8 @@ export const BashEventTypeToString: BashEventTypeToStringType = {
508
553
  [BashEventType.HousewarmingParty]: "Housewarming Party",
509
554
  [BashEventType.KaraokeNight]: "Karaoke Night",
510
555
  [BashEventType.KiteFlyingFestival]: "Kite Flying Festival",
511
- [BashEventType.LiveBandPerformanceInALocalVenue]: "Live Band Performance in a Local Venue",
556
+ [BashEventType.LiveBandPerformanceInALocalVenue]:
557
+ "Live Band Performance in a Local Venue",
512
558
  [BashEventType.Luau]: "Luau",
513
559
  [BashEventType.MansionParty]: "Mansion Party",
514
560
  [BashEventType.MardiGras]: "Mardi Gras",
@@ -521,7 +567,8 @@ export const BashEventTypeToString: BashEventTypeToStringType = {
521
567
  [BashEventType.OpenMicNight]: "Open Mic Night",
522
568
  [BashEventType.OutdoorActivity]: "Outdoor Activity",
523
569
  [BashEventType.OutdoorConcert]: "Outdoor Concert",
524
- [BashEventType.OutdoorMovieNight_WithAProjector]: "Outdoor Movie Night (With a Projector)",
570
+ [BashEventType.OutdoorMovieNight_WithAProjector]:
571
+ "Outdoor Movie Night (With a Projector)",
525
572
  [BashEventType.Parade]: "Parade",
526
573
  [BashEventType.Party]: "Party",
527
574
  [BashEventType.PoolParty]: "Pool Party",
@@ -532,9 +579,11 @@ export const BashEventTypeToString: BashEventTypeToStringType = {
532
579
  [BashEventType.ProfessionalNetworkingEvent]: "Professional Networking Event",
533
580
  [BashEventType.Rave_General]: "Rave (General)",
534
581
  [BashEventType.RetirementCelebration]: "Retirement Celebration",
535
- [BashEventType.Reunion_FamilyOrSchoolOrFriends]: "Reunion (Family/School/Friends)",
582
+ [BashEventType.Reunion_FamilyOrSchoolOrFriends]:
583
+ "Reunion (Family/School/Friends)",
536
584
  [BashEventType.SafariAdventureParty]: "Safari Adventure Party",
537
- [BashEventType.SchoolEvent_MiddleSchoolOrHighSchoolOrCollege]: "School Event (MiddleSchool, High School, College)",
585
+ [BashEventType.SchoolEvent_MiddleSchoolOrHighSchoolOrCollege]:
586
+ "School Event (MiddleSchool, High School, College)",
538
587
  [BashEventType.ScienceFictionThemedParty]: "Science Fiction-Themed Party",
539
588
  [BashEventType.SocialClubEvent]: "Social Club Event",
540
589
  [BashEventType.SportsTournament]: "Sports Tournament",
@@ -554,36 +603,70 @@ export const BashEventTypeToString: BashEventTypeToStringType = {
554
603
  [BashEventType.WellnessFestival]: "Wellness Festival",
555
604
  [BashEventType.WineTastingEvent]: "Wine Tasting Event",
556
605
  [BashEventType.Other]: "Other",
557
- }
606
+ };
558
607
 
559
608
  export type RecordKey = string | number | symbol;
560
- export type PartialExcept<T, K extends keyof T> = Partial<T> & {[P in K]: T[P]};
609
+ export type PartialExcept<T, K extends keyof T> = Partial<T> & {
610
+ [P in K]: T[P];
611
+ };
561
612
  type GetTypeOfArray<T> = T extends (infer U)[] ? U : never;
562
613
 
563
614
  export type AllKeysUnionOfDescendants<T> = T extends object
564
615
  ? T[keyof T] extends infer K
565
616
  ? K extends string | number | symbol
566
- ? {[K in keyof T]-?: T[K] extends any[]
567
- ? GetTypeOfArray<T[K]> extends Record<RecordKey, any>
568
- ? `${K & string}` | `${AllKeysUnion<GetTypeOfArray<T[K]>>}`
569
- : never
570
- : `${K & string}` | `${AllKeysUnion<T[K]>}`}[keyof T]
617
+ ? {
618
+ [K in keyof T]-?: T[K] extends any[]
619
+ ? GetTypeOfArray<T[K]> extends Record<RecordKey, any>
620
+ ? `${K & string}` | `${AllKeysUnion<GetTypeOfArray<T[K]>>}`
621
+ : never
622
+ : `${K & string}` | `${AllKeysUnion<T[K]>}`;
623
+ }[keyof T]
571
624
  : never
572
625
  : never
573
626
  : never;
574
627
 
575
628
  export type AllKeysOfDescendants<T> = AllKeysUnionOfDescendants<T>[];
576
629
 
577
- type AllKeysUnion<T> = T extends object
630
+ type Decrement<N extends number> = N extends 5
631
+ ? 4
632
+ : N extends 4
633
+ ? 3
634
+ : N extends 3
635
+ ? 2
636
+ : N extends 2
637
+ ? 1
638
+ : N extends 1
639
+ ? 0
640
+ : never;
641
+
642
+ type AllKeysUnion<T, Depth extends number = 5> = Depth extends 0
643
+ ? never
644
+ : T extends object
578
645
  ? T[keyof T] extends infer K
579
646
  ? K extends string | number | symbol
580
- ? {[K in keyof T]-?: T[K] extends any[]
581
- ? GetTypeOfArray<T[K]> extends Record<RecordKey, any>
582
- ? `${K & string}` | `${K & string}${typeof URL_INCLUDE_PRISMA_DATA_KEYS_DELIM}${AllKeysUnion<GetTypeOfArray<T[K]>> & string}`
583
- : never
584
- : T[K] extends Function
585
- ? never
586
- : `${K & string}` | `${K & string}${typeof URL_INCLUDE_PRISMA_DATA_KEYS_DELIM}${AllKeysUnion<T[K]> & string}`}[keyof T]
647
+ ? {
648
+ [K in keyof T]-?: T[K] extends any[]
649
+ ? GetTypeOfArray<T[K]> extends Record<string, any>
650
+ ?
651
+ | `${K & string}`
652
+ | `${K &
653
+ string}${typeof URL_INCLUDE_PRISMA_DATA_KEYS_DELIM}${AllKeysUnion<
654
+ GetTypeOfArray<T[K]>,
655
+ Decrement<Depth>
656
+ > &
657
+ string}`
658
+ : never
659
+ : T[K] extends Function
660
+ ? never
661
+ :
662
+ | `${K & string}`
663
+ | `${K &
664
+ string}${typeof URL_INCLUDE_PRISMA_DATA_KEYS_DELIM}${AllKeysUnion<
665
+ T[K],
666
+ Decrement<Depth>
667
+ > &
668
+ string}`;
669
+ }[keyof T]
587
670
  : never
588
671
  : never
589
672
  : never;
@@ -601,7 +684,6 @@ export interface IAddress {
601
684
  country: string;
602
685
  }
603
686
 
604
-
605
687
  export interface SocialMediaProfile {
606
688
  id: string;
607
689
  platform: string; // Enum type if available