@bash-app/bash-common 29.19.23 → 29.19.24

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.19.23",
3
+ "version": "29.19.24",
4
4
  "description": "Common data and scripts to use on the frontend and backend",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -238,7 +238,7 @@ model BashEvent {
238
238
  isTrending Boolean?
239
239
  coordinates Coordinates[] // A BashEvent can have multiple sets of coordinates
240
240
  // stripeAccount StripeAccount[]
241
- rate Rate[]
241
+ // rate Rate[]
242
242
  venueId String? // Nullable, meaning it's optional
243
243
  venue Venue? @relation(fields: [venueId], references: [id])
244
244
  }
@@ -271,7 +271,7 @@ model TicketTier {
271
271
  bashEvent BashEvent @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
272
272
  tickets Ticket[]
273
273
  waitList User[]
274
- price Int @default(0)
274
+ price Int @default(0) //stored multipled by 100 to allow for decimals
275
275
  title String @default("Free")
276
276
  sortOrder Int?
277
277
  description String?
@@ -356,26 +356,6 @@ enum BookingStatus {
356
356
  Missed
357
357
  }
358
358
 
359
- model Rate {
360
- id String @id @default(cuid())
361
- serviceMultipleRatesId String?
362
- serviceMultipleRates Service? @relation("MultipleRates", fields: [serviceMultipleRatesId], references: [id], onDelete: Cascade)
363
- bashEventId String?
364
- bashEvent BashEvent? @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
365
- waitList User[]
366
- price Int @default(0)
367
- title String @default("Free")
368
- sortOrder Int?
369
- description String?
370
- maximumNumberOfHours Int @default(24)
371
- maximumHourCount Int @default(24)
372
- isDonationTier Boolean?
373
- hidden Boolean?
374
-
375
- // promoCodes BashEventPromoCode[]
376
- @@unique([bashEventId, title])
377
- }
378
-
379
359
  model Booking {
380
360
  id String @id @default(cuid())
381
361
  serviceId String
@@ -838,7 +818,7 @@ model User {
838
818
  createdOn DateTime @default(now())
839
819
  stripeCustomerId String? @unique
840
820
  stripeAccountId String? @unique
841
- isSuperUser Boolean @default(false)
821
+ isSuperUser Boolean? @default(false)
842
822
  googleCalendarAccess String?
843
823
  givenName String?
844
824
  familyName String?
@@ -899,7 +879,7 @@ model User {
899
879
  userSubscription UserSubscription?
900
880
  serviceSubcriptions ServiceSubscription[]
901
881
  volunteerService VolunteerService[]
902
- rate Rate[]
882
+ // rate Rate[]
903
883
  stripeAccounts StripeAccount[]
904
884
  }
905
885
 
@@ -998,7 +978,7 @@ model Service {
998
978
  communityInvolvement String?
999
979
  emergencyContact String?
1000
980
  contactDetails String?
1001
- rates Rate[] @relation("MultipleRates")
981
+ // rates Rate[] @relation("MultipleRates")
1002
982
  cancellationPolicy String?
1003
983
  refundPolicy String?
1004
984
  insurancePolicy String?
@@ -1010,8 +990,7 @@ model Service {
1010
990
  targetAudienceId String? @unique
1011
991
  targetAudience TargetAudience? @relation(fields: [targetAudienceId], references: [id], onDelete: Cascade)
1012
992
 
1013
- visibility VisibilityPreference @default(Public)
1014
- availableDateTimes Availability[] @relation("AvailableDateTimes")
993
+ visibility VisibilityPreference @default(Public)
1015
994
 
1016
995
  bashesInterestedIn BashEventType[]
1017
996
  bookings Booking[]
@@ -1028,6 +1007,8 @@ model Service {
1028
1007
  venue Venue?
1029
1008
  organization Organization?
1030
1009
 
1010
+ serviceRatesAssociation ServiceRatesAssociation?
1011
+
1031
1012
  // googleReviews GoogleReview[]
1032
1013
 
1033
1014
  bashEvent BashEvent[] // because a service needs to be associated with a bash to post to the bashfeed
@@ -1050,23 +1031,26 @@ model StripeAccount {
1050
1031
  }
1051
1032
 
1052
1033
  model VolunteerService {
1053
- id String @id @default(cuid())
1034
+ id String @id @default(cuid())
1054
1035
  // service Service
1055
- userId String?
1056
- user User? @relation(fields: [userId], references: [id])
1057
- serviceRangeId String?
1058
- serviceRange ServiceRange? @relation(fields: [serviceRangeId], references: [id])
1059
- links Link[] @relation("VolunteerServiceLinks")
1060
- availableDateTimes Availability[] @relation("AvailableDateTimes")
1061
- fullName String?
1062
- address String?
1063
- email String?
1064
- phone String?
1065
- agreedToAgreement Boolean? @default(false)
1066
- description String?
1067
- status VolunteerServiceStatus?
1068
- media Media[]
1069
- Service Service[]
1036
+ userId String?
1037
+ user User? @relation(fields: [userId], references: [id])
1038
+ serviceRangeId String?
1039
+ serviceRange ServiceRange? @relation(fields: [serviceRangeId], references: [id])
1040
+ links Link[] @relation("VolunteerServiceLinks")
1041
+ // availableDateTimes ServiceAvailability[] @relation("AvailableDateTimes")
1042
+ fullName String?
1043
+ address String?
1044
+ email String?
1045
+ phone String?
1046
+ agreedToAgreement Boolean? @default(false)
1047
+ description String?
1048
+ status VolunteerServiceStatus?
1049
+ media Media[]
1050
+
1051
+ serviceRatesAssociation ServiceRatesAssociation?
1052
+
1053
+ service Service[]
1070
1054
  }
1071
1055
 
1072
1056
  model EventService {
@@ -1281,18 +1265,161 @@ model ServiceRange {
1281
1265
  Sponsor Sponsor[]
1282
1266
  }
1283
1267
 
1268
+ // model Availability {
1269
+ // id String @id @default(cuid())
1270
+ // dayOfWeek Int
1271
+ // startDateTime DateTime @db.Time
1272
+ // endDateTime DateTime @db.Time
1273
+ // // Rate Rate? @relation(fields: [rateId], references: [id])
1274
+ // rateId String?
1275
+ // }
1276
+
1277
+ // model Rate {
1278
+ // id String @id @default(cuid())
1279
+ // serviceMultipleRatesId String?
1280
+ // serviceMultipleRates Service? @relation("MultipleRates", fields: [serviceMultipleRatesId], references: [id], onDelete: Cascade)
1281
+ // bashEventId String?
1282
+ // bashEvent BashEvent? @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
1283
+ // waitList User[]
1284
+ // price Int @default(0)
1285
+ // title String @default("Free")
1286
+ // sortOrder Int?
1287
+ // description String?
1288
+ // maximumNumberOfHours Int @default(24)
1289
+ // maximumHourCount Int @default(24)
1290
+ // isDonationTier Boolean?
1291
+ // hidden Boolean?
1292
+ // Availability Availability[]
1293
+
1294
+ // // promoCodes BashEventPromoCode[]
1295
+ // @@unique([bashEventId, title])
1296
+ // }
1297
+
1298
+ // model ServiceRate {
1299
+ // id String @id @default(cuid())
1300
+ // rateType ServiceRateType
1301
+ // rate Int?
1302
+ // ServiceSpecialRates ServiceSpecialRates[]
1303
+ // }
1304
+
1305
+ // model ServiceGeneralRates {
1306
+ // id String @id @default(cuid())
1307
+
1308
+ // serviceRateId String?
1309
+ // serviceRate ServiceRate? @relation(fields: [serviceRateId], references: [id], onDelete: Cascade)
1310
+
1311
+ // // generalHourlyRate Int
1312
+ // // generalDailyRate Int
1313
+ // // generalWeeklyRate Int
1314
+ // // generalMonthlyRate Int
1315
+ // }
1316
+
1317
+ enum ServiceRateType {
1318
+ General
1319
+ Weekday
1320
+ Special
1321
+ // CLOSED
1322
+ // HOURLY
1323
+ // DAILY
1324
+ // WEEKLY
1325
+ }
1326
+
1327
+ //can optionally be associated with a package
1328
+ model ServiceAddon {
1329
+ id String @id @default(cuid())
1330
+ name String
1331
+ description String
1332
+ price Int?
1333
+ quantity Int
1334
+
1335
+ servicePackage ServicePackage? @relation(fields: [servicePackageId], references: [id], onDelete: Cascade)
1336
+ servicePackageId String?
1337
+
1338
+ serviceRatesAssociation ServiceRatesAssociation? @relation(fields: [serviceRatesAssociationId], references: [id], onDelete: Cascade)
1339
+ serviceRatesAssociationId String?
1340
+ }
1341
+
1342
+ model ServicePackage {
1343
+ id String @id @default(cuid())
1344
+ name String
1345
+ description String
1346
+ price Int
1347
+
1348
+ serviceAddons ServiceAddon[]
1349
+
1350
+ serviceRatesAssociation ServiceRatesAssociation? @relation(fields: [serviceRatesAssociationId], references: [id], onDelete: Cascade)
1351
+ serviceRatesAssociationId String?
1352
+ }
1353
+
1354
+ model ServiceRate {
1355
+ id String @id @default(cuid())
1356
+ rateType ServiceRateType
1357
+ hourlyRate Int?
1358
+ dailyRate Int?
1359
+ serviceSpecialRates ServiceSpecialRates?
1360
+ serviceDailyRates ServiceDailyRates?
1361
+ serviceRatesAssociation ServiceRatesAssociation?
1362
+
1363
+ @@index([rateType])
1364
+ }
1365
+
1366
+ model ServiceSpecialRates {
1367
+ id String @id @default(cuid())
1368
+ startDate DateTime @db.Date
1369
+ endDate DateTime @db.Date
1370
+
1371
+ serviceRateId String?
1372
+ serviceRate ServiceRate? @relation(fields: [serviceRateId], references: [id], onDelete: Cascade)
1373
+ isAvailable Boolean
1374
+
1375
+ serviceRatesAssociation ServiceRatesAssociation?
1376
+
1377
+ @@unique([serviceRateId])
1378
+ }
1379
+
1284
1380
  // different days of the week have different rates
1285
1381
  // can block of certain dates of the year and days of the week as being closed
1286
1382
  // can have special rates on different days of the year (single or range)
1287
- model Availability {
1288
- id String @id @default(cuid())
1289
- dayOfWeek Int
1290
- startDateTime DateTime @db.Time
1291
- endDateTime DateTime @db.Time
1383
+ // free trial period with promo code (1 or 2 months of listing for free)
1384
+ model ServiceDailyRates {
1385
+ id String @id @default(cuid())
1386
+ dayOfWeek Int
1387
+ startTime DateTime @db.Time
1388
+ endTime DateTime @db.Time
1389
+
1390
+ serviceRateId String?
1391
+ serviceRate ServiceRate? @relation(fields: [serviceRateId], references: [id], onDelete: Cascade)
1392
+
1393
+ serviceRatesAssociation ServiceRatesAssociation?
1394
+
1395
+ @@unique([serviceRateId])
1396
+ }
1397
+
1398
+ model ServiceRatesAssociation {
1399
+ id String @id @default(cuid())
1400
+
1292
1401
  serviceId String?
1293
- service Service? @relation("AvailableDateTimes", fields: [serviceId], references: [id])
1402
+ service Service? @relation(fields: [serviceId], references: [id], onDelete: Cascade)
1294
1403
  volunteerServiceId String?
1295
- volunteerService VolunteerService? @relation("AvailableDateTimes", fields: [volunteerServiceId], references: [id])
1404
+ volunteerService VolunteerService? @relation(fields: [volunteerServiceId], references: [id], onDelete: Cascade)
1405
+
1406
+ serviceGeneralRatesId String?
1407
+ serviceGeneralRates ServiceRate? @relation(fields: [serviceGeneralRatesId], references: [id], onDelete: Cascade)
1408
+
1409
+ serviceDailyRatesId String?
1410
+ serviceDailyRates ServiceDailyRates? @relation(fields: [serviceDailyRatesId], references: [id], onDelete: Cascade)
1411
+
1412
+ serviceSpecialRatesId String?
1413
+ serviceSpecialRates ServiceSpecialRates? @relation(fields: [serviceSpecialRatesId], references: [id], onDelete: Cascade)
1414
+
1415
+ addons ServiceAddon[]
1416
+ packages ServicePackage[]
1417
+
1418
+ @@unique([serviceId])
1419
+ @@unique([volunteerServiceId])
1420
+ @@unique([serviceGeneralRatesId])
1421
+ @@unique([serviceDailyRatesId])
1422
+ @@unique([serviceSpecialRatesId])
1296
1423
  }
1297
1424
 
1298
1425
  enum VisibilityPreference {
@@ -5,7 +5,7 @@ import {
5
5
  Contact,
6
6
  DayOfWeek,
7
7
  Prisma,
8
- Rate,
8
+ // Rate,
9
9
  ServiceTypes,
10
10
  Ticket,
11
11
  TicketTier,
@@ -203,26 +203,26 @@ export interface NumberOfHoursForDate {
203
203
  bookingDateTime: DateTimeArgType;
204
204
  }
205
205
 
206
- export interface AvailableNumberOfHoursForRate {
207
- rate: Rate;
208
- availableHours: NumberOfHoursForDate[];
209
- }
206
+ // export interface AvailableNumberOfHoursForRate {
207
+ // rate: Rate;
208
+ // availableHours: NumberOfHoursForDate[];
209
+ // }
210
210
 
211
- export interface AvailableHoursForRateForDate {
212
- rate: Rate,
213
- availableHoursForDate: NumberOfHoursForDate;
214
- }
211
+ // export interface AvailableHoursForRateForDate {
212
+ // rate: Rate,
213
+ // availableHoursForDate: NumberOfHoursForDate;
214
+ // }
215
215
 
216
- export interface AvailableHoursForRate {
217
- rate: Rate;
218
- availableHours: NumberOfHoursForDate[];
219
- }
216
+ // export interface AvailableHoursForRate {
217
+ // rate: Rate;
218
+ // availableHours: NumberOfHoursForDate[];
219
+ // }
220
220
 
221
- export interface DeletedAndHiddenRates {
222
- deletedRates: Rate[];
223
- hiddenRates: Rate[];
224
- errorType?: ApiErrorType;
225
- }
221
+ // export interface DeletedAndHiddenRates {
222
+ // deletedRates: Rate[];
223
+ // hiddenRates: Rate[];
224
+ // errorType?: ApiErrorType;
225
+ // }
226
226
 
227
227
  export interface SignInEmailWithPassword {
228
228
  email: string;
@@ -12,7 +12,8 @@ import {
12
12
  Reminder,
13
13
  Checkout,
14
14
  ServiceLink,
15
- Link, Venue, Availability,
15
+ Link, Venue,
16
+ // Availability,
16
17
  TargetAudience,
17
18
  Vendor,
18
19
  EventService,
@@ -26,9 +27,14 @@ import {
26
27
  VisibilityPreference,
27
28
  BashEventType,
28
29
  Coordinates,
29
- Rate,
30
+ // Rate,
30
31
  GoogleReview,
31
32
  ServiceTypes,
33
+ ServiceRatesAssociation,
34
+ ServiceRate,
35
+ ServiceDailyRates,
36
+ ServiceSpecialRates,
37
+ ServiceAddon,
32
38
  } from "@prisma/client";
33
39
  import { SERVICE_LINK_DATA_TO_INCLUDE, UnionFromArray } from "./definitions";
34
40
 
@@ -117,10 +123,11 @@ export const SERVICE_DATA_TO_INCLUDE = {
117
123
  // eventTasks: true,
118
124
  media: true,
119
125
  stripeAccount: true,
120
- availableDateTimes: true,
126
+ // availableDateTimes: true,
121
127
  serviceLinks: {
122
128
  include: SERVICE_LINK_DATA_TO_INCLUDE
123
129
  },
130
+ serviceRatesAssociation: true
124
131
  } satisfies Prisma.ServiceInclude;
125
132
 
126
133
  // Create the final object dynamically
@@ -169,6 +176,26 @@ export const SERVICE_FULL_DATA_TO_INCLUDE = {
169
176
  ...createAllTrueObject(serviceKeysArray)
170
177
  } satisfies Prisma.ServiceInclude;
171
178
 
179
+ export const SERVICE_PACKAGE_TO_INCLUDE = {
180
+ serviceAddons: true
181
+ } satisfies Prisma.ServicePackageInclude;
182
+
183
+ export const SERVICE_DAILYRATES_DATA_TO_INCLUDE = {
184
+ serviceRate: true
185
+ } satisfies Prisma.ServiceDailyRatesInclude;
186
+
187
+ export const SERVICE_SPECIALRATES_DATA_TO_INCLUDE = {
188
+ serviceRate: true
189
+ } satisfies Prisma.ServiceSpecialRatesInclude;
190
+
191
+ export const SERVICE_RATES_ASSOCIATION_DATA_TO_INCLUDE = {
192
+ serviceGeneralRates: true,
193
+ serviceDailyRates: true,
194
+ serviceSpecialRates: true,
195
+ addons: true,
196
+ packages: true
197
+ } satisfies Prisma.ServiceRatesAssociationInclude;
198
+
172
199
  export interface BashNotificationExt extends BashNotification {
173
200
  creator?: PublicUser;
174
201
  bashEvent?: BashEvent;
@@ -229,10 +256,10 @@ export interface ServiceExt extends Service {
229
256
 
230
257
  stripeAccount?: StripeAccount | null;
231
258
 
232
- availableDateTimes?: Availability[];
259
+ // availableDateTimes?: Availability[];
233
260
 
234
261
  bookings?: Booking[];
235
- rates?: Rate[];
262
+ // rates?: Rate[];
236
263
  targetAudience?: TargetAudience | null;
237
264
  media?: Media[];
238
265
  serviceLinks?: ServiceLinkExt[];
@@ -245,8 +272,30 @@ export interface ServiceExt extends Service {
245
272
  venue?: Venue;
246
273
  organization?: Organization;
247
274
 
275
+ serviceRatesAssociation?: ServiceRatesAssociationExt;
276
+
248
277
  // googleReviews: GoogleReview[];
249
278
  }
279
+ export interface ServicePackageExt extends ServiceDailyRates {
280
+ serviceAddons: ServiceAddon[]
281
+ }
282
+
283
+ export interface ServiceDailyRatesExt extends ServiceDailyRates {
284
+ serviceRate?: ServiceRate;
285
+ }
286
+ export interface ServiceSpecialRatesExt extends ServiceRatesAssociation {
287
+ serviceRate?: ServiceRate;
288
+ }
289
+
290
+ export interface ServiceRatesAssociationExt extends ServiceRatesAssociation {
291
+ serviceGeneralRates?: ServiceRate;
292
+ serviceDailyRates?: ServiceDailyRates;
293
+ serviceSpecialRates?: ServiceSpecialRates;
294
+
295
+ packages?: ServicePackageExt;
296
+ addons: ServiceAddon[];
297
+ }
298
+
250
299
 
251
300
  export interface EventServiceExt extends EventService {
252
301
  service: ServiceExt;
@@ -293,7 +342,7 @@ export interface VolunteerServiceExt extends VolunteerService {
293
342
  serviceRange?: ServiceRange | null;
294
343
  media?: Media[];
295
344
  links?: Link[];
296
- availableDateTimes?: Availability[];
345
+ // availableDateTimes?: Availability[];
297
346
  }
298
347
 
299
348
  export interface ServiceLinkExt extends ServiceLink {
@@ -14,8 +14,8 @@ export type VenuePricingPlanMap = {
14
14
 
15
15
  export const VenuePricingPlanData: VenuePricingPlanMap = {
16
16
  [VenuePricingPlanOption.Percentage]: {
17
- name: "Pay per booking",
18
- description: "15% of each booking goes to Bash",
17
+ name: "Pay per booking,",
18
+ description: "15% of each booking goes to Bash.",
19
19
  percentageFee: 0.15,
20
20
  monthlyFee: 0.0,
21
21
  flatFee: 0.0