@bash-app/bash-common 21.0.0 → 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": "21.0.0",
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",
@@ -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?
@@ -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[]
@@ -824,26 +824,26 @@ model User {
824
824
  city String?
825
825
  state String?
826
826
  postalCode String?
827
- country String? @default("US")
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
845
  bashSubscription UserSubscription?
846
- subServiceSubcriptions SubServiceSubscription[]
846
+ serviceSubcriptions ServiceSubscription[]
847
847
  }
848
848
 
849
849
  model Contact {
@@ -888,11 +888,10 @@ model Business {
888
888
  postalCode String
889
889
  country String
890
890
  phone String
891
- name String @default("New Service")
891
+ name String @default("New Business")
892
892
  coverPhoto String?
893
893
  agreedToAgreement Boolean?
894
894
  media Media[]
895
- serviceTypes ServiceType[]
896
895
  customServiceTag String[]
897
896
  yearsOfExperince YearsOfExperience @default(LessThanOneYear)
898
897
  serviceLinks ServiceLink[]
@@ -903,10 +902,9 @@ model Business {
903
902
  // bashesInterestedIn BashEventType[]
904
903
  status ServiceStatus @default(Draft)
905
904
  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
905
  targetAudienceId String? @unique
906
+ targetAudience TargetAudience? @relation(fields: [targetAudienceId], references: [id])
907
+ volunteerService VolunteerService?
910
908
  eventServices EventService[]
911
909
  entertainmentServices EntertainmentService[]
912
910
  vendors Vendor[]
@@ -926,10 +924,16 @@ model Business {
926
924
  @@index([phone])
927
925
  }
928
926
 
927
+ model VolunteerService {
928
+ id String @id @default(cuid())
929
+ businessId String @unique
930
+ business Business @relation(fields: [businessId], references: [id])
931
+ }
932
+
929
933
  model EventService {
930
934
  id String @id @default(cuid())
931
- service Business? @relation(fields: [serviceId], references: [id])
932
- serviceId String?
935
+ business Business? @relation(fields: [businessId], references: [id])
936
+ businessId String?
933
937
  eventServiceName String
934
938
  eventServiceTypes EventServiceType[]
935
939
  eventServiceSubType String?
@@ -969,8 +973,8 @@ model EventService {
969
973
 
970
974
  model EntertainmentService {
971
975
  id String @id @default(cuid())
972
- service Business? @relation(fields: [serviceId], references: [id])
973
- serviceId String?
976
+ business Business? @relation(fields: [businessId], references: [id])
977
+ businessId String?
974
978
  entertainmentServiceName String
975
979
  entertainmentServiceTypes EntertainmentServiceType[]
976
980
  entertainmentServiceSubType String?
@@ -1010,8 +1014,8 @@ model EntertainmentService {
1010
1014
 
1011
1015
  model Vendor {
1012
1016
  id String @id @default(cuid())
1013
- service Business? @relation(fields: [serviceId], references: [id])
1014
- serviceId String?
1017
+ business Business? @relation(fields: [businessId], references: [id])
1018
+ businessId String?
1015
1019
  vendorName String
1016
1020
  email String
1017
1021
  streetAddress String
@@ -1049,8 +1053,8 @@ model Vendor {
1049
1053
 
1050
1054
  model Exhibitor {
1051
1055
  id String @id @default(cuid())
1052
- service Business? @relation(fields: [serviceId], references: [id])
1053
- serviceId String?
1056
+ business Business? @relation(fields: [businessId], references: [id])
1057
+ businessId String?
1054
1058
  exhibitorName String
1055
1059
  email String
1056
1060
  streetAddress String
@@ -1087,8 +1091,8 @@ model Exhibitor {
1087
1091
 
1088
1092
  model Sponsor {
1089
1093
  id String @id @default(cuid())
1090
- service Business? @relation(fields: [serviceId], references: [id])
1091
- serviceId String?
1094
+ business Business? @relation(fields: [businessId], references: [id])
1095
+ businessId String?
1092
1096
  sponsorName String
1093
1097
  email String
1094
1098
  streetAddress String
@@ -1126,8 +1130,8 @@ model Sponsor {
1126
1130
 
1127
1131
  model Venue {
1128
1132
  id String @id @default(cuid())
1129
- service Business @relation(fields: [serviceId], references: [id])
1130
- serviceId String
1133
+ business Business @relation(fields: [businessId], references: [id])
1134
+ businessId String
1131
1135
  venueName String
1132
1136
  email String
1133
1137
  streetAddress String
@@ -1142,6 +1146,8 @@ model Venue {
1142
1146
  status ServiceStatus @default(Draft)
1143
1147
  yearsInBusiness YearsOfExperience
1144
1148
  description String?
1149
+ serviceRangeId String @unique
1150
+ serviceRange ServiceRange @relation(fields: [serviceRangeId], references: [id], onDelete: Cascade)
1145
1151
  capacityId String? @unique
1146
1152
  capacity AmountOfGuests? @relation(fields: [capacityId], references: [id], onDelete: Cascade)
1147
1153
  amenities String[]
@@ -1169,8 +1175,8 @@ model Venue {
1169
1175
 
1170
1176
  model Organization {
1171
1177
  id String @id @default(cuid())
1172
- service Business? @relation(fields: [serviceId], references: [id])
1173
- serviceId String?
1178
+ business Business? @relation(fields: [businessId], references: [id])
1179
+ businessId String?
1174
1180
  organizationName String
1175
1181
  organizationType OrganizationType[]
1176
1182
  email String
@@ -1274,10 +1280,11 @@ enum YearsOfExperience {
1274
1280
  }
1275
1281
 
1276
1282
  model ServiceRange {
1277
- id String @id @default(cuid())
1278
- min Int @default(0)
1279
- max Int @default(50)
1280
- serviceServiceRange Business? @relation("ServiceRange")
1283
+ id String @id @default(cuid())
1284
+ min Int @default(0)
1285
+ max Int @default(50)
1286
+
1287
+ venue Venue?
1281
1288
  }
1282
1289
 
1283
1290
  model Availability {
@@ -1316,17 +1323,6 @@ enum MusicGenreType {
1316
1323
  Acoustic
1317
1324
  }
1318
1325
 
1319
- enum ServiceType {
1320
- Volunteer
1321
- EventService
1322
- EntertainmentService
1323
- Vendor
1324
- Exhibitor
1325
- Sponsor
1326
- Venue
1327
- Organization
1328
- }
1329
-
1330
1326
  enum UserRole {
1331
1327
  User
1332
1328
  Vendor
@@ -1381,8 +1377,8 @@ model VerificationToken {
1381
1377
 
1382
1378
  model ServiceLink {
1383
1379
  id String @id @default(cuid())
1384
- serviceId String
1385
- service Business @relation(fields: [serviceId], references: [id], onDelete: Cascade)
1380
+ businessId String
1381
+ business Business @relation(fields: [businessId], references: [id], onDelete: Cascade)
1386
1382
  linkId String
1387
1383
  link Link @relation(fields: [linkId], references: [id], onDelete: Cascade)
1388
1384
  eventService EventService? @relation(fields: [eventServiceId], references: [id])
@@ -1400,5 +1396,5 @@ model ServiceLink {
1400
1396
  organization Organization? @relation(fields: [organizationId], references: [id])
1401
1397
  organizationId String?
1402
1398
 
1403
- @@index([serviceId])
1399
+ @@index([businessId])
1404
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;
@@ -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 = {
@@ -176,6 +176,15 @@ 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
189
  business: Business;
181
190
  availableDateTimes: Availability[];
@@ -185,6 +194,15 @@ 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
207
  business: Business;
190
208
  availableDateTimes: Availability[];
@@ -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 Business {
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 Business {
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