@bash-app/bash-common 20.5.2 → 21.0.1

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": "20.5.2",
3
+ "version": "21.0.1",
4
4
  "description": "Common data and scripts to use on the frontend and backend",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -11,15 +11,6 @@ datasource db {
11
11
  directUrl = env("POSTGRES_URL_NON_POOLING") // uses a direct connection
12
12
  }
13
13
 
14
- model Business {
15
- id String @id @default(cuid())
16
- name String
17
- ein String?
18
- dba String?
19
- address String?
20
- media Media[]
21
- }
22
-
23
14
  model Club {
24
15
  id String @id @default(cuid())
25
16
  name String
@@ -336,7 +327,7 @@ enum UserSubscriptionType {
336
327
  VIP
337
328
  }
338
329
 
339
- model SubServiceSubscription {
330
+ model ServiceSubscription {
340
331
  id String @id @default(cuid())
341
332
  ownerId String
342
333
  owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)
@@ -352,8 +343,8 @@ enum BookingStatus {
352
343
 
353
344
  model Booking {
354
345
  id String @id @default(cuid())
355
- serviceId String
356
- service Service @relation(fields: [serviceId], references: [id])
346
+ businessId String
347
+ business Business @relation(fields: [businessId], references: [id])
357
348
  validDate DateTime?
358
349
  forUserId String?
359
350
  forUser User? @relation(fields: [forUserId], references: [id])
@@ -368,7 +359,7 @@ model Booking {
368
359
  checkoutId String?
369
360
  checkout Checkout? @relation(fields: [checkoutId], references: [id])
370
361
 
371
- @@index([serviceId])
362
+ @@index([businessId])
372
363
  @@index([forUserId])
373
364
  @@index([checkoutId])
374
365
  }
@@ -582,7 +573,7 @@ model TargetAudience {
582
573
  showOnDetailPage Boolean @default(true)
583
574
 
584
575
  bashEvent BashEvent?
585
- service Service?
576
+ business Business?
586
577
  venue Venue?
587
578
  vendor Vendor?
588
579
  eventService EventService?
@@ -699,9 +690,8 @@ model Media {
699
690
  type MediaType
700
691
  mimetype String?
701
692
  bashEventsReferencingMe BashEvent[]
702
- businessesReferencingMe Business[]
703
693
  sponsoredEventsReferencingMe SponsoredEvent[]
704
- servicesReferencingMe Service[]
694
+ businessesReferencingMe Business[]
705
695
  venueReferencingMe Venue[]
706
696
  EventService EventService? @relation(fields: [eventServiceId], references: [id])
707
697
  eventServiceId String?
@@ -792,11 +782,11 @@ enum SponsorType {
792
782
  }
793
783
 
794
784
  model User {
795
- id String @id @default(cuid())
796
- email String @unique
797
- createdOn DateTime @default(now())
798
- stripeCustomerId String? @unique
799
- 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
800
790
  googleCalendarAccess String?
801
791
  givenName String?
802
792
  familyName String?
@@ -807,11 +797,11 @@ model User {
807
797
  dob DateTime?
808
798
  gender Gender?
809
799
  sex Sex?
810
- roles UserRole[] @default([User])
811
- services Service[]
812
- createdEvents BashEvent[] @relation("CreatedEvent")
813
- ticketsISent Ticket[] @relation("TicketsISent")
814
- 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")
815
805
  reviews Review[]
816
806
  sponsorships SponsoredEvent[]
817
807
  investments Investment[]
@@ -834,26 +824,26 @@ model User {
834
824
  city String?
835
825
  state String?
836
826
  postalCode String?
837
- country String? @default("US")
827
+ country String? @default("US")
838
828
  phone String?
839
- documentIDId String? @unique
829
+ documentIDId String? @unique
840
830
  documentID DocumentID?
841
831
  comment BashComment[]
842
832
  associatedBashes AssociatedBash[]
843
- invitationsCreatedByMe Invitation[] @relation("InvitationsCreatedByMe")
844
- invitationsSentToMe Invitation[] @relation("InvitationsSentToMe")
845
- notificationsCreatedByMe BashNotification[] @relation("NotificationsCreatedByMe")
846
- remindersCreatedByMe Reminder[] @relation("RemindersCreatedByMe")
847
- remindersAssignedToMe Reminder[] @relation("RemindersAssignedToMe")
848
- 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")
849
839
  checkouts Checkout[]
850
840
  ticketTiersWaitListsIveJoined TicketTier[]
851
841
  contacts Contact[]
852
842
  bashEventPromoCodesIUsed BashEventPromoCode[]
853
- ServiceCheckout ServiceCheckout[]
843
+ serviceCheckouts ServiceCheckout[]
854
844
  bookingForMe Booking[]
855
845
  bashSubscription UserSubscription?
856
- subServiceSubcriptions SubServiceSubscription[]
846
+ serviceSubcriptions ServiceSubscription[]
857
847
  }
858
848
 
859
849
  model Contact {
@@ -885,7 +875,7 @@ model AssociatedBash {
885
875
  @@unique([ownerEmail, bashEventId])
886
876
  }
887
877
 
888
- model Service {
878
+ model Business {
889
879
  id String @id @default(cuid())
890
880
  ownerId String
891
881
  owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)
@@ -898,11 +888,10 @@ model Service {
898
888
  postalCode String
899
889
  country String
900
890
  phone String
901
- name String @default("New Service")
891
+ name String @default("New Business")
902
892
  coverPhoto String?
903
893
  agreedToAgreement Boolean?
904
894
  media Media[]
905
- serviceTypes ServiceType[]
906
895
  customServiceTag String[]
907
896
  yearsOfExperince YearsOfExperience @default(LessThanOneYear)
908
897
  serviceLinks ServiceLink[]
@@ -913,10 +902,9 @@ model Service {
913
902
  // bashesInterestedIn BashEventType[]
914
903
  status ServiceStatus @default(Draft)
915
904
  venues Venue[]
916
- serviceRangeId String @unique
917
- serviceRange ServiceRange @relation("ServiceRange", fields: [serviceRangeId], references: [id], onDelete: Cascade)
918
- targetAudience TargetAudience? @relation(fields: [targetAudienceId], references: [id])
919
905
  targetAudienceId String? @unique
906
+ targetAudience TargetAudience? @relation(fields: [targetAudienceId], references: [id])
907
+ volunteerService VolunteerService?
920
908
  eventServices EventService[]
921
909
  entertainmentServices EntertainmentService[]
922
910
  vendors Vendor[]
@@ -936,10 +924,16 @@ model Service {
936
924
  @@index([phone])
937
925
  }
938
926
 
927
+ model VolunteerService {
928
+ id String @id @default(cuid())
929
+ businessId String @unique
930
+ business Business @relation(fields: [businessId], references: [id])
931
+ }
932
+
939
933
  model EventService {
940
934
  id String @id @default(cuid())
941
- service Service? @relation(fields: [serviceId], references: [id])
942
- serviceId String?
935
+ business Business? @relation(fields: [businessId], references: [id])
936
+ businessId String?
943
937
  eventServiceName String
944
938
  eventServiceTypes EventServiceType[]
945
939
  eventServiceSubType String?
@@ -979,8 +973,8 @@ model EventService {
979
973
 
980
974
  model EntertainmentService {
981
975
  id String @id @default(cuid())
982
- service Service? @relation(fields: [serviceId], references: [id])
983
- serviceId String?
976
+ business Business? @relation(fields: [businessId], references: [id])
977
+ businessId String?
984
978
  entertainmentServiceName String
985
979
  entertainmentServiceTypes EntertainmentServiceType[]
986
980
  entertainmentServiceSubType String?
@@ -1020,8 +1014,8 @@ model EntertainmentService {
1020
1014
 
1021
1015
  model Vendor {
1022
1016
  id String @id @default(cuid())
1023
- service Service? @relation(fields: [serviceId], references: [id])
1024
- serviceId String?
1017
+ business Business? @relation(fields: [businessId], references: [id])
1018
+ businessId String?
1025
1019
  vendorName String
1026
1020
  email String
1027
1021
  streetAddress String
@@ -1059,8 +1053,8 @@ model Vendor {
1059
1053
 
1060
1054
  model Exhibitor {
1061
1055
  id String @id @default(cuid())
1062
- service Service? @relation(fields: [serviceId], references: [id])
1063
- serviceId String?
1056
+ business Business? @relation(fields: [businessId], references: [id])
1057
+ businessId String?
1064
1058
  exhibitorName String
1065
1059
  email String
1066
1060
  streetAddress String
@@ -1097,8 +1091,8 @@ model Exhibitor {
1097
1091
 
1098
1092
  model Sponsor {
1099
1093
  id String @id @default(cuid())
1100
- service Service? @relation(fields: [serviceId], references: [id])
1101
- serviceId String?
1094
+ business Business? @relation(fields: [businessId], references: [id])
1095
+ businessId String?
1102
1096
  sponsorName String
1103
1097
  email String
1104
1098
  streetAddress String
@@ -1136,8 +1130,8 @@ model Sponsor {
1136
1130
 
1137
1131
  model Venue {
1138
1132
  id String @id @default(cuid())
1139
- service Service @relation(fields: [serviceId], references: [id])
1140
- serviceId String
1133
+ business Business @relation(fields: [businessId], references: [id])
1134
+ businessId String
1141
1135
  venueName String
1142
1136
  email String
1143
1137
  streetAddress String
@@ -1152,6 +1146,8 @@ model Venue {
1152
1146
  status ServiceStatus @default(Draft)
1153
1147
  yearsInBusiness YearsOfExperience
1154
1148
  description String?
1149
+ serviceRangeId String @unique
1150
+ serviceRange ServiceRange @relation(fields: [serviceRangeId], references: [id], onDelete: Cascade)
1155
1151
  capacityId String? @unique
1156
1152
  capacity AmountOfGuests? @relation(fields: [capacityId], references: [id], onDelete: Cascade)
1157
1153
  amenities String[]
@@ -1179,8 +1175,8 @@ model Venue {
1179
1175
 
1180
1176
  model Organization {
1181
1177
  id String @id @default(cuid())
1182
- service Service? @relation(fields: [serviceId], references: [id])
1183
- serviceId String?
1178
+ business Business? @relation(fields: [businessId], references: [id])
1179
+ businessId String?
1184
1180
  organizationName String
1185
1181
  organizationType OrganizationType[]
1186
1182
  email String
@@ -1284,10 +1280,11 @@ enum YearsOfExperience {
1284
1280
  }
1285
1281
 
1286
1282
  model ServiceRange {
1287
- id String @id @default(cuid())
1288
- min Int @default(0)
1289
- max Int @default(50)
1290
- serviceServiceRange Service? @relation("ServiceRange")
1283
+ id String @id @default(cuid())
1284
+ min Int @default(0)
1285
+ max Int @default(50)
1286
+
1287
+ venue Venue?
1291
1288
  }
1292
1289
 
1293
1290
  model Availability {
@@ -1326,17 +1323,6 @@ enum MusicGenreType {
1326
1323
  Acoustic
1327
1324
  }
1328
1325
 
1329
- enum ServiceType {
1330
- Volunteer
1331
- EventService
1332
- EntertainmentService
1333
- Vendor
1334
- Exhibitor
1335
- Sponsor
1336
- Venue
1337
- Organization
1338
- }
1339
-
1340
1326
  enum UserRole {
1341
1327
  User
1342
1328
  Vendor
@@ -1391,8 +1377,8 @@ model VerificationToken {
1391
1377
 
1392
1378
  model ServiceLink {
1393
1379
  id String @id @default(cuid())
1394
- serviceId String
1395
- service Service @relation(fields: [serviceId], references: [id], onDelete: Cascade)
1380
+ businessId String
1381
+ business Business @relation(fields: [businessId], references: [id], onDelete: Cascade)
1396
1382
  linkId String
1397
1383
  link Link @relation(fields: [linkId], references: [id], onDelete: Cascade)
1398
1384
  eventService EventService? @relation(fields: [eventServiceId], references: [id])
@@ -1410,5 +1396,5 @@ model ServiceLink {
1410
1396
  organization Organization? @relation(fields: [organizationId], references: [id])
1411
1397
  organizationId String?
1412
1398
 
1413
- @@index([serviceId])
1399
+ @@index([businessId])
1414
1400
  }
@@ -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,17 @@ 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 const ServiceTypes: (keyof BusinessExt)[] = [
92
+ 'volunteerService',
93
+ 'eventServices',
94
+ 'organizations',
95
+ 'venues',
96
+ 'vendors',
97
+ 'sponsors',
98
+ 'exhibitors',
99
+ 'entertainmentServices',
100
+ ] as const;
101
+
92
102
  export type FilterFields = {
93
103
  price: string[];
94
104
  ageRequirement: string[];
@@ -411,20 +421,6 @@ export const BashEventTypeToString: BashEventTypeToStringType = {
411
421
  [BashEventType.Other]: "Other",
412
422
  }
413
423
 
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
424
  export type RecordKey = string | number | symbol;
429
425
  export type PartialExcept<T, K extends keyof T> = Partial<T> & {[P in K]: T[P]};
430
426
  type GetTypeOfArray<T> = T extends (infer U)[] ? U : never;
@@ -6,7 +6,7 @@ import {
6
6
  Invitation,
7
7
  Ticket,
8
8
  User,
9
- TicketTier, Service, Review, Media, BashComment, Recurrence, Contact,
9
+ TicketTier, Business, Review, Media, BashComment, Recurrence, Contact,
10
10
  BashNotification, BashEventPromoCode,
11
11
  Reminder, ServiceRange,
12
12
  Checkout,
@@ -21,7 +21,7 @@ import {
21
21
  Sponsor,
22
22
  Organization,
23
23
  Booking,
24
- ServiceType,
24
+ VolunteerService,
25
25
  } from "@prisma/client";
26
26
 
27
27
  export const FRONT_END_USER_DATA_TO_SELECT = {
@@ -132,7 +132,7 @@ export const EVENT_TASK_DATA_TO_INCLUDE = {
132
132
 
133
133
 
134
134
  export interface EventServiceExt extends EventService {
135
- service: Service;
135
+ business: Business;
136
136
  availableDateTimes: Availability[];
137
137
  targetAudience: TargetAudience;
138
138
  links: ServiceLinkExt[];
@@ -141,7 +141,7 @@ export interface EventServiceExt extends EventService {
141
141
  }
142
142
 
143
143
  export interface EntertainmentServiceExt extends EntertainmentService {
144
- service: Service;
144
+ business: Business;
145
145
  availableDateTimes: Availability[];
146
146
  targetAudience: TargetAudience;
147
147
  links: ServiceLinkExt[];
@@ -150,7 +150,7 @@ export interface EntertainmentServiceExt extends EntertainmentService {
150
150
  }
151
151
 
152
152
  export interface ExhibitorExt extends Exhibitor {
153
- service: Service;
153
+ business: Business;
154
154
  availableDateTimes: Availability[];
155
155
  targetAudience: TargetAudience;
156
156
  links: ServiceLinkExt[];
@@ -159,7 +159,7 @@ export interface ExhibitorExt extends Exhibitor {
159
159
  }
160
160
 
161
161
  export interface SponsorExt extends Sponsor {
162
- service: Service;
162
+ business: Business;
163
163
  availableDateTimes: Availability[];
164
164
  targetAudience: TargetAudience;
165
165
  links: ServiceLinkExt[];
@@ -168,7 +168,7 @@ export interface SponsorExt extends Sponsor {
168
168
  }
169
169
 
170
170
  export interface VendorExt extends Vendor {
171
- service: Service;
171
+ business: Business;
172
172
  availableDateTimes: Availability[];
173
173
  targetAudience?: TargetAudience;
174
174
  links: ServiceLinkExt[];
@@ -176,8 +176,17 @@ export interface VendorExt extends Vendor {
176
176
  media?: Media[];
177
177
  }
178
178
 
179
+ export const VENDOR_DATA_TO_INCLUDE = {
180
+ business: true,
181
+ availableDateTimes: true,
182
+ targetAudience: true,
183
+ links: true,
184
+ crowdSize: true,
185
+ media: true,
186
+ }
187
+
179
188
  export interface VenueExt extends Venue {
180
- service: Service;
189
+ business: Business;
181
190
  availableDateTimes: Availability[];
182
191
  targetAudience?: TargetAudience | null;
183
192
  links: ServiceLinkExt[];
@@ -185,8 +194,17 @@ export interface VenueExt extends Venue {
185
194
  media?: Media[];
186
195
  }
187
196
 
197
+ export const VENUE_DATA_TO_INCLUDE = {
198
+ business: true,
199
+ availableDateTimes: true,
200
+ targetAudience: true,
201
+ links: true,
202
+ capacity: true,
203
+ media: true,
204
+ }
205
+
188
206
  export interface OrganizationExt extends Organization {
189
- service: Service;
207
+ business: Business;
190
208
  availableDateTimes: Availability[];
191
209
  targetAudience: TargetAudience;
192
210
  links: ServiceLinkExt[];
@@ -195,28 +213,12 @@ export interface OrganizationExt extends Organization {
195
213
  status: ServiceStatus;
196
214
  }
197
215
 
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
216
 
215
- export interface ServiceExt extends Service {
217
+ export interface BusinessExt extends Business {
216
218
  owner: PublicUser;
217
219
  media: Media[];
218
- serviceRange: ServiceRange;
219
220
  targetAudience: TargetAudience;
221
+ volunteerService?: VolunteerService;
220
222
  serviceLinks?: ServiceLinkExt[];
221
223
  venues?: Venue[];
222
224
  eventServices?: EventService[];
@@ -226,7 +228,6 @@ export interface ServiceExt extends Service {
226
228
  sponsors?: Sponsor[];
227
229
  organizations?: Organization[];
228
230
  bookings?: Booking[];
229
- serviceTypes: ServiceType[];
230
231
  }
231
232
 
232
233
  export interface ServiceLinkExt extends ServiceLink {
@@ -237,12 +238,12 @@ export const SERVICE_LINK_DATA_TO_INCLUDE = {
237
238
  link: true,
238
239
  }
239
240
 
240
- export const SERVICE_DATA_TO_INCLUDE = {
241
+ export const BUSINESS_DATA_TO_INCLUDE = {
241
242
  owner: {
242
243
  select: FRONT_END_USER_DATA_TO_SELECT
243
244
  },
244
245
  media: true,
245
- serviceRange: true,
246
+ volunteerService: true,
246
247
  targetAudience: true,
247
248
  serviceLinks: {
248
249
  include: SERVICE_LINK_DATA_TO_INCLUDE
@@ -337,7 +338,7 @@ export interface UserExtraData extends User {
337
338
  }
338
339
 
339
340
  export interface UserExt extends User {
340
- services?: Service[] | null;
341
+ services?: Business[] | null;
341
342
 
342
343
  // Do not include in fetch as there could be thousands of these
343
344
  associatedBashes?: AssociatedBash[] | null;