@bash-app/bash-common 21.0.0 → 21.1.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": "21.0.0",
3
+ "version": "21.1.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",
@@ -25,9 +25,9 @@
25
25
  "qrcode": "^1.5.3"
26
26
  },
27
27
  "peerDependencies": {
28
- "@prisma/client": "^5.16.2",
28
+ "@prisma/client": "^5.18.0",
29
29
  "dayjs": "^1.11.10",
30
- "prisma": "^5.16.2",
30
+ "prisma": "^5.18.0",
31
31
  "react-tailwindcss-datepicker": "^1.6.6",
32
32
  "tsx": "^4.10.3"
33
33
  },
@@ -14,7 +14,7 @@ datasource db {
14
14
  model Club {
15
15
  id String @id @default(cuid())
16
16
  name String
17
- address String
17
+ street String
18
18
  userId String
19
19
  price Int?
20
20
  events BashEvent[]
@@ -327,7 +327,7 @@ enum UserSubscriptionType {
327
327
  VIP
328
328
  }
329
329
 
330
- model SubServiceSubscription {
330
+ model ServiceSubscription {
331
331
  id String @id @default(cuid())
332
332
  ownerId String
333
333
  owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)
@@ -343,8 +343,8 @@ enum BookingStatus {
343
343
 
344
344
  model Booking {
345
345
  id String @id @default(cuid())
346
- serviceId String
347
- service Business @relation(fields: [serviceId], references: [id])
346
+ businessId String
347
+ business Business @relation(fields: [businessId], references: [id])
348
348
  validDate DateTime?
349
349
  forUserId String?
350
350
  forUser User? @relation(fields: [forUserId], references: [id])
@@ -359,7 +359,7 @@ model Booking {
359
359
  checkoutId String?
360
360
  checkout Checkout? @relation(fields: [checkoutId], references: [id])
361
361
 
362
- @@index([serviceId])
362
+ @@index([businessId])
363
363
  @@index([forUserId])
364
364
  @@index([checkoutId])
365
365
  }
@@ -573,7 +573,7 @@ model TargetAudience {
573
573
  showOnDetailPage Boolean @default(true)
574
574
 
575
575
  bashEvent BashEvent?
576
- service Business?
576
+ business Business?
577
577
  venue Venue?
578
578
  vendor Vendor?
579
579
  eventService EventService?
@@ -624,23 +624,23 @@ enum ServiceStatus {
624
624
  }
625
625
 
626
626
  model DocumentID {
627
- id String @id @default(cuid())
628
- givenName String?
629
- familyName String?
630
- middleName String?
631
- suffix String?
632
- streetAddress String?
633
- city String?
634
- state String?
635
- stateName String?
636
- postalCode String?
637
- idNumber String?
638
- expires String?
639
- dob String?
640
- issueDate String?
641
- idType String?
642
- userId String? @unique
643
- user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
627
+ id String @id @default(cuid())
628
+ givenName String?
629
+ familyName String?
630
+ middleName String?
631
+ suffix String?
632
+ street String?
633
+ city String?
634
+ state String?
635
+ stateName String?
636
+ zipCode String?
637
+ idNumber String?
638
+ expires String?
639
+ dob String?
640
+ issueDate String?
641
+ idType String?
642
+ userId String? @unique
643
+ user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
644
644
  }
645
645
 
646
646
  model EventLink {
@@ -782,11 +782,11 @@ enum SponsorType {
782
782
  }
783
783
 
784
784
  model User {
785
- id String @id @default(cuid())
786
- email String @unique
787
- createdOn DateTime @default(now())
788
- stripeCustomerId String? @unique
789
- stripeAccountId String? @unique
785
+ id String @id @default(cuid())
786
+ email String @unique
787
+ createdOn DateTime @default(now())
788
+ stripeCustomerId String? @unique
789
+ stripeAccountId String? @unique
790
790
  googleCalendarAccess String?
791
791
  givenName String?
792
792
  familyName String?
@@ -797,11 +797,11 @@ model User {
797
797
  dob DateTime?
798
798
  gender Gender?
799
799
  sex Sex?
800
- roles UserRole[] @default([User])
801
- services Business[]
802
- createdEvents BashEvent[] @relation("CreatedEvent")
803
- ticketsISent Ticket[] @relation("TicketsISent")
804
- ticketsIOwn Ticket[] @relation("TicketsIOwn")
800
+ roles UserRole[] @default([User])
801
+ businesses Business[]
802
+ createdEvents BashEvent[] @relation("CreatedEvent")
803
+ ticketsISent Ticket[] @relation("TicketsISent")
804
+ ticketsIOwn Ticket[] @relation("TicketsIOwn")
805
805
  reviews Review[]
806
806
  sponsorships SponsoredEvent[]
807
807
  investments Investment[]
@@ -820,30 +820,30 @@ model User {
820
820
  magicLinkExpiration DateTime?
821
821
  magicLinkUsed DateTime?
822
822
  idVerified DateTime?
823
- streetAddress String?
823
+ street String?
824
824
  city String?
825
825
  state String?
826
- postalCode String?
827
- country String? @default("US")
826
+ zipCode String?
827
+ country String? @default("US")
828
828
  phone String?
829
- documentIDId String? @unique
829
+ documentIDId String? @unique
830
830
  documentID DocumentID?
831
831
  comment BashComment[]
832
832
  associatedBashes AssociatedBash[]
833
- invitationsCreatedByMe Invitation[] @relation("InvitationsCreatedByMe")
834
- invitationsSentToMe Invitation[] @relation("InvitationsSentToMe")
835
- notificationsCreatedByMe BashNotification[] @relation("NotificationsCreatedByMe")
836
- remindersCreatedByMe Reminder[] @relation("RemindersCreatedByMe")
837
- remindersAssignedToMe Reminder[] @relation("RemindersAssignedToMe")
838
- eventTasksAssignedToMe EventTask[] @relation("TasksAssignedToMe")
833
+ invitationsCreatedByMe Invitation[] @relation("InvitationsCreatedByMe")
834
+ invitationsSentToMe Invitation[] @relation("InvitationsSentToMe")
835
+ notificationsCreatedByMe BashNotification[] @relation("NotificationsCreatedByMe")
836
+ remindersCreatedByMe Reminder[] @relation("RemindersCreatedByMe")
837
+ remindersAssignedToMe Reminder[] @relation("RemindersAssignedToMe")
838
+ eventTasksAssignedToMe EventTask[] @relation("TasksAssignedToMe")
839
839
  checkouts Checkout[]
840
840
  ticketTiersWaitListsIveJoined TicketTier[]
841
841
  contacts Contact[]
842
842
  bashEventPromoCodesIUsed BashEventPromoCode[]
843
- ServiceCheckout ServiceCheckout[]
843
+ serviceCheckouts ServiceCheckout[]
844
844
  bookingForMe Booking[]
845
- bashSubscription UserSubscription?
846
- subServiceSubcriptions SubServiceSubscription[]
845
+ userSubscription UserSubscription?
846
+ serviceSubcriptions ServiceSubscription[]
847
847
  }
848
848
 
849
849
  model Contact {
@@ -881,18 +881,16 @@ model Business {
881
881
  owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)
882
882
  dateCreated DateTime @default(now())
883
883
  email String
884
- location String?
885
- streetAddress String
884
+ street String
886
885
  city String
887
886
  state String
888
- postalCode String
887
+ zipCode String
889
888
  country String
890
889
  phone String
891
- name String @default("New Service")
890
+ name String @default("New Business")
892
891
  coverPhoto String?
893
892
  agreedToAgreement Boolean?
894
893
  media Media[]
895
- serviceTypes ServiceType[]
896
894
  customServiceTag String[]
897
895
  yearsOfExperince YearsOfExperience @default(LessThanOneYear)
898
896
  serviceLinks ServiceLink[]
@@ -903,10 +901,9 @@ model Business {
903
901
  // bashesInterestedIn BashEventType[]
904
902
  status ServiceStatus @default(Draft)
905
903
  venues Venue[]
906
- serviceRangeId String @unique
907
- serviceRange ServiceRange @relation("ServiceRange", fields: [serviceRangeId], references: [id], onDelete: Cascade)
908
- targetAudience TargetAudience? @relation(fields: [targetAudienceId], references: [id])
909
904
  targetAudienceId String? @unique
905
+ targetAudience TargetAudience? @relation(fields: [targetAudienceId], references: [id])
906
+ volunteerService VolunteerService?
910
907
  eventServices EventService[]
911
908
  entertainmentServices EntertainmentService[]
912
909
  vendors Vendor[]
@@ -926,18 +923,24 @@ model Business {
926
923
  @@index([phone])
927
924
  }
928
925
 
926
+ model VolunteerService {
927
+ id String @id @default(cuid())
928
+ businessId String @unique
929
+ business Business @relation(fields: [businessId], references: [id])
930
+ }
931
+
929
932
  model EventService {
930
933
  id String @id @default(cuid())
931
- service Business? @relation(fields: [serviceId], references: [id])
932
- serviceId String?
934
+ business Business? @relation(fields: [businessId], references: [id])
935
+ businessId String?
933
936
  eventServiceName String
934
937
  eventServiceTypes EventServiceType[]
935
938
  eventServiceSubType String?
936
939
  email String
937
- streetAddress String
940
+ street String
938
941
  city String
939
942
  state String
940
- postalCode String
943
+ zipCode String
941
944
  country String
942
945
  phone String
943
946
  coverPhoto String?
@@ -969,17 +972,17 @@ model EventService {
969
972
 
970
973
  model EntertainmentService {
971
974
  id String @id @default(cuid())
972
- service Business? @relation(fields: [serviceId], references: [id])
973
- serviceId String?
975
+ business Business? @relation(fields: [businessId], references: [id])
976
+ businessId String?
974
977
  entertainmentServiceName String
975
978
  entertainmentServiceTypes EntertainmentServiceType[]
976
979
  entertainmentServiceSubType String?
977
980
  genre MusicGenreType?
978
981
  email String
979
- streetAddress String
982
+ street String
980
983
  city String
981
984
  state String
982
- postalCode String
985
+ zipCode String
983
986
  country String
984
987
  phone String
985
988
  coverPhoto String?
@@ -1010,14 +1013,14 @@ model EntertainmentService {
1010
1013
 
1011
1014
  model Vendor {
1012
1015
  id String @id @default(cuid())
1013
- service Business? @relation(fields: [serviceId], references: [id])
1014
- serviceId String?
1016
+ business Business? @relation(fields: [businessId], references: [id])
1017
+ businessId String?
1015
1018
  vendorName String
1016
1019
  email String
1017
- streetAddress String
1020
+ street String
1018
1021
  city String
1019
1022
  state String
1020
- postalCode String
1023
+ zipCode String
1021
1024
  country String
1022
1025
  phone String
1023
1026
  coverPhoto String?
@@ -1049,14 +1052,14 @@ model Vendor {
1049
1052
 
1050
1053
  model Exhibitor {
1051
1054
  id String @id @default(cuid())
1052
- service Business? @relation(fields: [serviceId], references: [id])
1053
- serviceId String?
1055
+ business Business? @relation(fields: [businessId], references: [id])
1056
+ businessId String?
1054
1057
  exhibitorName String
1055
1058
  email String
1056
- streetAddress String
1059
+ street String
1057
1060
  city String
1058
1061
  state String
1059
- postalCode String
1062
+ zipCode String
1060
1063
  country String
1061
1064
  phone String
1062
1065
  coverPhoto String?
@@ -1087,14 +1090,14 @@ model Exhibitor {
1087
1090
 
1088
1091
  model Sponsor {
1089
1092
  id String @id @default(cuid())
1090
- service Business? @relation(fields: [serviceId], references: [id])
1091
- serviceId String?
1093
+ business Business? @relation(fields: [businessId], references: [id])
1094
+ businessId String?
1092
1095
  sponsorName String
1093
1096
  email String
1094
- streetAddress String
1097
+ street String
1095
1098
  city String
1096
1099
  state String
1097
- postalCode String
1100
+ zipCode String
1098
1101
  country String
1099
1102
  phone String
1100
1103
  coverPhoto String?
@@ -1126,14 +1129,14 @@ model Sponsor {
1126
1129
 
1127
1130
  model Venue {
1128
1131
  id String @id @default(cuid())
1129
- service Business @relation(fields: [serviceId], references: [id])
1130
- serviceId String
1132
+ business Business @relation(fields: [businessId], references: [id])
1133
+ businessId String
1131
1134
  venueName String
1132
1135
  email String
1133
- streetAddress String
1136
+ street String
1134
1137
  city String
1135
1138
  state String
1136
- postalCode String
1139
+ zipCode String
1137
1140
  country String
1138
1141
  phone String
1139
1142
  coverPhoto String?
@@ -1142,6 +1145,8 @@ model Venue {
1142
1145
  status ServiceStatus @default(Draft)
1143
1146
  yearsInBusiness YearsOfExperience
1144
1147
  description String?
1148
+ serviceRangeId String @unique
1149
+ serviceRange ServiceRange @relation(fields: [serviceRangeId], references: [id], onDelete: Cascade)
1145
1150
  capacityId String? @unique
1146
1151
  capacity AmountOfGuests? @relation(fields: [capacityId], references: [id], onDelete: Cascade)
1147
1152
  amenities String[]
@@ -1169,15 +1174,15 @@ model Venue {
1169
1174
 
1170
1175
  model Organization {
1171
1176
  id String @id @default(cuid())
1172
- service Business? @relation(fields: [serviceId], references: [id])
1173
- serviceId String?
1177
+ business Business? @relation(fields: [businessId], references: [id])
1178
+ businessId String?
1174
1179
  organizationName String
1175
1180
  organizationType OrganizationType[]
1176
1181
  email String
1177
- streetAddress String
1182
+ street String
1178
1183
  city String
1179
1184
  state String
1180
- postalCode String
1185
+ zipCode String
1181
1186
  country String
1182
1187
  phone String
1183
1188
  coverPhoto String?
@@ -1274,10 +1279,11 @@ enum YearsOfExperience {
1274
1279
  }
1275
1280
 
1276
1281
  model ServiceRange {
1277
- id String @id @default(cuid())
1278
- min Int @default(0)
1279
- max Int @default(50)
1280
- serviceServiceRange Business? @relation("ServiceRange")
1282
+ id String @id @default(cuid())
1283
+ min Int @default(0)
1284
+ max Int @default(50)
1285
+
1286
+ venue Venue?
1281
1287
  }
1282
1288
 
1283
1289
  model Availability {
@@ -1316,17 +1322,6 @@ enum MusicGenreType {
1316
1322
  Acoustic
1317
1323
  }
1318
1324
 
1319
- enum ServiceType {
1320
- Volunteer
1321
- EventService
1322
- EntertainmentService
1323
- Vendor
1324
- Exhibitor
1325
- Sponsor
1326
- Venue
1327
- Organization
1328
- }
1329
-
1330
1325
  enum UserRole {
1331
1326
  User
1332
1327
  Vendor
@@ -1381,8 +1376,8 @@ model VerificationToken {
1381
1376
 
1382
1377
  model ServiceLink {
1383
1378
  id String @id @default(cuid())
1384
- serviceId String
1385
- service Business @relation(fields: [serviceId], references: [id], onDelete: Cascade)
1379
+ businessId String
1380
+ business Business @relation(fields: [businessId], references: [id], onDelete: Cascade)
1386
1381
  linkId String
1387
1382
  link Link @relation(fields: [linkId], references: [id], onDelete: Cascade)
1388
1383
  eventService EventService? @relation(fields: [eventServiceId], references: [id])
@@ -1400,5 +1395,5 @@ model ServiceLink {
1400
1395
  organization Organization? @relation(fields: [organizationId], references: [id])
1401
1396
  organizationId String?
1402
1397
 
1403
- @@index([serviceId])
1398
+ @@index([businessId])
1404
1399
  }
@@ -4,13 +4,12 @@ import {
4
4
  BashEventVibeTags,
5
5
  Contact,
6
6
  DayOfWeek,
7
- ServiceType,
8
7
  Ticket,
9
8
  TicketTier,
10
9
  User,
11
10
  YearsOfExperience
12
11
  } from "@prisma/client";
13
- import { CheckoutExt, PublicUser } from "./extendedSchemas";
12
+ import {BusinessExt, CheckoutExt, PublicUser} from "./extendedSchemas";
14
13
 
15
14
  export const PASSWORD_MIN_LENGTH = 10 as const;
16
15
  export const PASSWORD_REQUIREMENTS_REGEX = new RegExp(String.raw`^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{${PASSWORD_MIN_LENGTH},}$`);
@@ -89,6 +88,22 @@ export type DateTimeArgType = Date | string | undefined | null;
89
88
  export type RequiredStripeInfoMissingErrorDataType = { [k in keyof User]?: { type: string, label: string } };
90
89
  export type ContactOrUser = Contact | PublicUser;
91
90
 
91
+ export type UnionFromArray<T extends ReadonlyArray<any>> = T[number];
92
+ export type ValueOf<T> = T[keyof T];
93
+
94
+ export type ValueOfServiceType = ValueOf<typeof ServiceType>;
95
+
96
+ export const ServiceType = {
97
+ 'Volunteer': 'volunteerService',
98
+ 'EventService': 'eventServices',
99
+ 'Organization': 'organizations',
100
+ 'Venue': 'venues',
101
+ 'Vendor': 'vendors',
102
+ 'Sponsor': 'sponsors',
103
+ 'Exhibitor': 'exhibitors',
104
+ 'EntertainmentService': 'entertainmentServices',
105
+ } satisfies {[key: string]: keyof BusinessExt}
106
+
92
107
  export type FilterFields = {
93
108
  price: string[];
94
109
  ageRequirement: string[];
@@ -295,6 +310,20 @@ export const YearsOfExperienceToString: { [key in YearsOfExperience]: string } =
295
310
  [YearsOfExperience.FivePlusYears]: 'More than five years',
296
311
  };
297
312
 
313
+ export type ServiceTypeToStringType = {
314
+ [key in ValueOf<typeof ServiceType>]: string;
315
+ };
316
+ export const ServiceTypeToString: ServiceTypeToStringType = {
317
+ [ServiceType.Volunteer]: "/servicesDefault.webp",
318
+ [ServiceType.EventService]: "/servicesDefault.webp",
319
+ [ServiceType.EntertainmentService]: "/servicesDefault.webp",
320
+ [ServiceType.Vendor]: "/servicesDefault.webp",
321
+ [ServiceType.Exhibitor]: "/servicesDefault.webp",
322
+ [ServiceType.Sponsor]: "/servicesDefault.webp",
323
+ [ServiceType.Venue]: "/servicesDefault.webp",
324
+ [ServiceType.Organization]: "/servicesDefault.webp"
325
+ }
326
+
298
327
  export type BashEventTypeToStringType = {
299
328
  [key in BashEventType]: string;
300
329
  };
@@ -411,20 +440,6 @@ export const BashEventTypeToString: BashEventTypeToStringType = {
411
440
  [BashEventType.Other]: "Other",
412
441
  }
413
442
 
414
- export type ServiceTypeToStringType = {
415
- [key in ServiceType]: string;
416
- };
417
- export const ServiceTypeToString: ServiceTypeToStringType = {
418
- [ServiceType.Volunteer]: "/servicesDefault.webp",
419
- [ServiceType.EventService]: "/servicesDefault.webp",
420
- [ServiceType.EntertainmentService]: "/servicesDefault.webp",
421
- [ServiceType.Vendor]: "/servicesDefault.webp",
422
- [ServiceType.Exhibitor]: "/servicesDefault.webp",
423
- [ServiceType.Sponsor]: "/servicesDefault.webp",
424
- [ServiceType.Venue]: "/servicesDefault.webp",
425
- [ServiceType.Organization]: "/servicesDefault.webp"
426
- }
427
-
428
443
  export type RecordKey = string | number | symbol;
429
444
  export type PartialExcept<T, K extends keyof T> = Partial<T> & {[P in K]: T[P]};
430
445
  type GetTypeOfArray<T> = T extends (infer U)[] ? U : never;
@@ -458,3 +473,14 @@ type AllKeysUnion<T> = T extends object
458
473
  : never;
459
474
 
460
475
  export type AllKeys<T> = AllKeysUnion<T>[];
476
+
477
+
478
+
479
+ export interface IAddress {
480
+ place?: string;
481
+ street: string;
482
+ city: string;
483
+ state: string;
484
+ zipCode: string;
485
+ country: string;
486
+ }
@@ -8,7 +8,7 @@ import {
8
8
  User,
9
9
  TicketTier, Business, Review, Media, BashComment, Recurrence, Contact,
10
10
  BashNotification, BashEventPromoCode,
11
- Reminder, ServiceRange,
11
+ Reminder,
12
12
  Checkout,
13
13
  ServiceLink,
14
14
  Link, Venue, Availability,
@@ -21,8 +21,9 @@ import {
21
21
  Sponsor,
22
22
  Organization,
23
23
  Booking,
24
- ServiceType,
24
+ VolunteerService, Prisma,
25
25
  } from "@prisma/client";
26
+ import {UnionFromArray} from "./definitions";
26
27
 
27
28
  export const FRONT_END_USER_DATA_TO_SELECT = {
28
29
  id: true,
@@ -31,18 +32,17 @@ export const FRONT_END_USER_DATA_TO_SELECT = {
31
32
  familyName: true,
32
33
  image: true,
33
34
  uploadedImage: true,
34
- services: true,
35
- }
35
+ } satisfies Prisma.UserSelect;
36
36
 
37
37
  export const PRIVATE_USER_ACCOUNT_TO_SELECT = {
38
38
  ...FRONT_END_USER_DATA_TO_SELECT,
39
- streetAddress: true,
39
+ street: true,
40
40
  city: true,
41
41
  state: true,
42
- postalCode: true,
42
+ zipCode: true,
43
43
  country: true,
44
44
  phone: true,
45
- }
45
+ } satisfies Prisma.UserSelect;
46
46
 
47
47
  export interface BashEventExt extends BashEvent {
48
48
  targetAudience?: TargetAudience;
@@ -59,7 +59,7 @@ export interface BashEventExt extends BashEvent {
59
59
 
60
60
  export const TICKET_TIER_DATA_TO_INCLUDE = {
61
61
  promoCodes: true,
62
- }
62
+ } satisfies Prisma.TicketTierInclude;
63
63
 
64
64
  export const BASH_EVENT_DATA_TO_INCLUDE = {
65
65
  creator: {
@@ -73,7 +73,7 @@ export const BASH_EVENT_DATA_TO_INCLUDE = {
73
73
  },
74
74
  eventTasks: true,
75
75
  media: true,
76
- }
76
+ } satisfies Prisma.BashEventInclude;
77
77
 
78
78
  export const BASH_EVENT_DATA_TO_CLONE = [
79
79
  'ticketTiers',
@@ -83,7 +83,6 @@ export const BASH_EVENT_DATA_TO_CLONE = [
83
83
  ] as const;
84
84
 
85
85
  type RemoveCommonProperties<T, U> = keyof (Omit<T, keyof U> & Omit<U, keyof T>);
86
- export type UnionFromArray<T extends ReadonlyArray<any>> = T[number];
87
86
  type BashEventExtMinusDataToCloneType = Omit<BashEventExt, UnionFromArray<typeof BASH_EVENT_DATA_TO_CLONE>>;
88
87
 
89
88
  export const BASH_EVENT_DATA_TO_REMOVE: RemoveCommonProperties<BashEvent, BashEventExtMinusDataToCloneType>[] = [
@@ -176,6 +175,19 @@ export interface VendorExt extends Vendor {
176
175
  media?: Media[];
177
176
  }
178
177
 
178
+ export const VENDOR_DATA_TO_INCLUDE = {
179
+ business: true,
180
+ availableDateTimes: true,
181
+ targetAudience: true,
182
+ links: true,
183
+ crowdSize: true,
184
+ media: true,
185
+ }
186
+
187
+ export const SERVICE_LINK_DATA_TO_INCLUDE = {
188
+ link: true,
189
+ }
190
+
179
191
  export interface VenueExt extends Venue {
180
192
  business: Business;
181
193
  availableDateTimes: Availability[];
@@ -185,6 +197,17 @@ export interface VenueExt extends Venue {
185
197
  media?: Media[];
186
198
  }
187
199
 
200
+ export const VENUE_DATA_TO_INCLUDE = {
201
+ business: true,
202
+ availableDateTimes: true,
203
+ targetAudience: true,
204
+ links: {
205
+ include: SERVICE_LINK_DATA_TO_INCLUDE
206
+ },
207
+ capacity: true,
208
+ media: true,
209
+ }
210
+
188
211
  export interface OrganizationExt extends Organization {
189
212
  business: Business;
190
213
  availableDateTimes: Availability[];
@@ -195,28 +218,12 @@ export interface OrganizationExt extends Organization {
195
218
  status: ServiceStatus;
196
219
  }
197
220
 
198
- export const VENUE_DATA_TO_INCLUDE = {
199
- service: true,
200
- availableDateTimes: true,
201
- targetAudience: true,
202
- links: true,
203
- capacity: true,
204
- media: true,
205
- }
206
- export const VENDOR_DATA_TO_INCLUDE = {
207
- service: true,
208
- availableDateTimes: true,
209
- targetAudience: true,
210
- links: true,
211
- crowdSize: true,
212
- media: true,
213
- }
214
221
 
215
- export interface ServiceExt extends Business {
222
+ export interface BusinessExt extends Business {
216
223
  owner: PublicUser;
217
224
  media: Media[];
218
- serviceRange: ServiceRange;
219
- targetAudience: TargetAudience;
225
+ targetAudience?: TargetAudience | null;
226
+ volunteerService?: VolunteerService | null;
220
227
  serviceLinks?: ServiceLinkExt[];
221
228
  venues?: Venue[];
222
229
  eventServices?: EventService[];
@@ -226,23 +233,14 @@ export interface ServiceExt extends Business {
226
233
  sponsors?: Sponsor[];
227
234
  organizations?: Organization[];
228
235
  bookings?: Booking[];
229
- serviceTypes: ServiceType[];
230
236
  }
231
237
 
232
- export interface ServiceLinkExt extends ServiceLink {
233
- link: Link;
234
- }
235
-
236
- export const SERVICE_LINK_DATA_TO_INCLUDE = {
237
- link: true,
238
- }
239
-
240
- export const SERVICE_DATA_TO_INCLUDE = {
238
+ export const BUSINESS_DATA_TO_INCLUDE = {
241
239
  owner: {
242
240
  select: FRONT_END_USER_DATA_TO_SELECT
243
241
  },
244
242
  media: true,
245
- serviceRange: true,
243
+ volunteerService: true,
246
244
  targetAudience: true,
247
245
  serviceLinks: {
248
246
  include: SERVICE_LINK_DATA_TO_INCLUDE
@@ -253,6 +251,10 @@ export const SERVICE_DATA_TO_INCLUDE = {
253
251
  vendors: {
254
252
  include: VENDOR_DATA_TO_INCLUDE
255
253
  }
254
+ } satisfies Prisma.BusinessInclude
255
+
256
+ export interface ServiceLinkExt extends ServiceLink {
257
+ link: Link;
256
258
  }
257
259
 
258
260
  export interface InvitationExt extends Invitation {
@@ -337,7 +339,7 @@ export interface UserExtraData extends User {
337
339
  }
338
340
 
339
341
  export interface UserExt extends User {
340
- services?: Business[] | null;
342
+ businesses?: Business[] | null;
341
343
 
342
344
  // Do not include in fetch as there could be thousands of these
343
345
  associatedBashes?: AssociatedBash[] | null;
@@ -1,18 +1,10 @@
1
+ import {IAddress} from "../definitions";
1
2
 
2
3
  const ADDRESS_DELIM = '|';
3
4
 
4
5
  const googleMapsApiKey = process.env.REACT_APP_GOOGLE_MAP_API_KEY as string;
5
6
 
6
7
 
7
- export interface IAddress {
8
- place: string;
9
- street: string;
10
- city: string;
11
- state: string;
12
- zipCode: string;
13
- country: string;
14
- }
15
-
16
8
  export function addressHasEnoughDataForGeolocation(address: IAddress): boolean {
17
9
  return !!((address.place && address.city && address.state) || (address.street && address.city && address.state));
18
10
  }
@@ -60,6 +52,13 @@ export function databaseAddressStringToDisplayString(addressString: string | und
60
52
  return '';
61
53
  }
62
54
 
55
+ export function addressToDisplayString(address: IAddress): string {
56
+ let addressArr = address.place ? [address.place] : [];
57
+ addressArr = [...addressArr, address.street, address.city, address.state];
58
+ const addressStr = addressArr.filter((str) => !!str).join(', ');
59
+ return `${addressStr} ${address.zipCode}`;
60
+ }
61
+
63
62
 
64
63
  export async function getAddressFromCoordinates( lat: number, lng: number ): Promise<IAddress> {
65
64
  const apiUrl = `https://maps.googleapis.com/maps/api/geocode/json?latlng=${lat},${lng}&key=${googleMapsApiKey}&loading=async`;