@bash-app/bash-common 30.3.0 → 30.4.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 +1 -1
- package/prisma/schema.prisma +140 -87
- package/scripts/symlinks.sh +2 -0
- package/src/definitions.ts +37 -43
- package/src/extendedSchemas.ts +122 -104
- package/src/index.ts +4 -3
- package/src/utils/arrayUtils.ts +8 -0
- package/src/utils/luxonUtils.ts +78 -15
- package/src/utils/service/apiServiceBookingApiUtils.ts +222 -0
- package/src/utils/service/frontendServiceBookingUtils.ts +310 -0
- package/src/utils/service/serviceBookingStatusUtils.ts +96 -27
- package/src/utils/service/serviceBookingTypes.ts +56 -0
- package/src/utils/service/serviceDBUtils.ts +35 -35
- package/src/utils/service/serviceRateDBUtils.ts +179 -179
- package/src/utils/service/serviceRateTypes.ts +18 -0
- package/src/utils/service/serviceRateUtils.ts +38 -64
- package/src/utils/service/serviceUtils.ts +35 -3
- package/src/utils/stringUtils.ts +1 -1
- package/src/utils/service/serviceBookingApiUtils.ts +0 -259
- package/src/utils/service/serviceBookingUtils.ts +0 -391
package/package.json
CHANGED
package/prisma/schema.prisma
CHANGED
|
@@ -1150,15 +1150,22 @@ model Service {
|
|
|
1150
1150
|
media Media[]
|
|
1151
1151
|
serviceLinks ServiceLink[]
|
|
1152
1152
|
|
|
1153
|
-
volunteerServiceId
|
|
1154
|
-
volunteerService
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1153
|
+
volunteerServiceId String? @unique
|
|
1154
|
+
volunteerService VolunteerService? @relation(fields: [volunteerServiceId], references: [id], onDelete: Cascade)
|
|
1155
|
+
eventServiceId String? @unique
|
|
1156
|
+
eventService EventService? @relation(fields: [eventServiceId], references: [id], onDelete: Cascade)
|
|
1157
|
+
entertainmentServiceId String? @unique
|
|
1158
|
+
entertainmentService EntertainmentService? @relation(fields: [entertainmentServiceId], references: [id], onDelete: Cascade)
|
|
1159
|
+
vendorId String? @unique
|
|
1160
|
+
vendor Vendor? @relation(fields: [vendorId], references: [id], onDelete: Cascade)
|
|
1161
|
+
exhibitorId String? @unique
|
|
1162
|
+
exhibitor Exhibitor? @relation(fields: [exhibitorId], references: [id], onDelete: Cascade)
|
|
1163
|
+
sponsorId String? @unique
|
|
1164
|
+
sponsor Sponsor? @relation(fields: [sponsorId], references: [id], onDelete: Cascade)
|
|
1165
|
+
venueId String? @unique
|
|
1166
|
+
venue Venue? @relation(fields: [venueId], references: [id], onDelete: Cascade)
|
|
1167
|
+
organizationId String? @unique
|
|
1168
|
+
organization Organization? @relation(fields: [organizationId], references: [id], onDelete: Cascade)
|
|
1162
1169
|
|
|
1163
1170
|
serviceRatesAssociation ServiceRatesAssociation?
|
|
1164
1171
|
|
|
@@ -1211,13 +1218,11 @@ model VolunteerService {
|
|
|
1211
1218
|
|
|
1212
1219
|
serviceRatesAssociation ServiceRatesAssociation?
|
|
1213
1220
|
|
|
1214
|
-
service Service
|
|
1221
|
+
service Service?
|
|
1215
1222
|
}
|
|
1216
1223
|
|
|
1217
1224
|
model EventService {
|
|
1218
1225
|
id String @id @default(cuid())
|
|
1219
|
-
serviceId String @unique
|
|
1220
|
-
service Service @relation(fields: [serviceId], references: [id], onDelete: Cascade)
|
|
1221
1226
|
serviceRangeId String?
|
|
1222
1227
|
serviceRange ServiceRange? @relation(fields: [serviceRangeId], references: [id])
|
|
1223
1228
|
eventServiceTypes EventServiceType[]
|
|
@@ -1229,12 +1234,11 @@ model EventService {
|
|
|
1229
1234
|
menuItems String?
|
|
1230
1235
|
venueTypes String[]
|
|
1231
1236
|
secondaryVenueTypes String[] @default([])
|
|
1237
|
+
service Service?
|
|
1232
1238
|
}
|
|
1233
1239
|
|
|
1234
1240
|
model EntertainmentService {
|
|
1235
1241
|
id String @id @default(cuid())
|
|
1236
|
-
serviceId String @unique
|
|
1237
|
-
service Service @relation(fields: [serviceId], references: [id], onDelete: Cascade)
|
|
1238
1242
|
serviceRangeId String?
|
|
1239
1243
|
serviceRange ServiceRange? @relation(fields: [serviceRangeId], references: [id])
|
|
1240
1244
|
entertainmentServiceTypes EntertainmentServiceType[]
|
|
@@ -1246,12 +1250,11 @@ model EntertainmentService {
|
|
|
1246
1250
|
goodsOrServices String[]
|
|
1247
1251
|
venueTypes String[]
|
|
1248
1252
|
secondaryVenueTypes String[] @default([])
|
|
1253
|
+
service Service?
|
|
1249
1254
|
}
|
|
1250
1255
|
|
|
1251
1256
|
model Vendor {
|
|
1252
1257
|
id String @id @default(cuid())
|
|
1253
|
-
serviceId String @unique
|
|
1254
|
-
service Service @relation(fields: [serviceId], references: [id], onDelete: Cascade)
|
|
1255
1258
|
serviceRangeId String?
|
|
1256
1259
|
serviceRange ServiceRange? @relation(fields: [serviceRangeId], references: [id])
|
|
1257
1260
|
yearsOfExperience YearsOfExperience
|
|
@@ -1261,12 +1264,11 @@ model Vendor {
|
|
|
1261
1264
|
menuItems String?
|
|
1262
1265
|
venueTypes String[]
|
|
1263
1266
|
secondaryVenueTypes String[] @default([])
|
|
1267
|
+
service Service?
|
|
1264
1268
|
}
|
|
1265
1269
|
|
|
1266
1270
|
model Exhibitor {
|
|
1267
1271
|
id String @id @default(cuid())
|
|
1268
|
-
serviceId String @unique
|
|
1269
|
-
service Service @relation(fields: [serviceId], references: [id], onDelete: Cascade)
|
|
1270
1272
|
serviceRangeId String?
|
|
1271
1273
|
serviceRange ServiceRange? @relation(fields: [serviceRangeId], references: [id])
|
|
1272
1274
|
yearsOfExperience YearsOfExperience
|
|
@@ -1275,12 +1277,11 @@ model Exhibitor {
|
|
|
1275
1277
|
goodsOrServices String[]
|
|
1276
1278
|
venueTypes String[]
|
|
1277
1279
|
secondaryVenueTypes String[] @default([])
|
|
1280
|
+
service Service?
|
|
1278
1281
|
}
|
|
1279
1282
|
|
|
1280
1283
|
model Sponsor {
|
|
1281
1284
|
id String @id @default(cuid())
|
|
1282
|
-
serviceId String @unique
|
|
1283
|
-
service Service @relation(fields: [serviceId], references: [id], onDelete: Cascade)
|
|
1284
1285
|
serviceRangeId String?
|
|
1285
1286
|
serviceRange ServiceRange? @relation(fields: [serviceRangeId], references: [id])
|
|
1286
1287
|
yearsOfExperience YearsOfExperience
|
|
@@ -1288,12 +1289,11 @@ model Sponsor {
|
|
|
1288
1289
|
crowdSize AmountOfGuests? @relation(fields: [crowdSizeId], references: [id])
|
|
1289
1290
|
goodsOrServices String[]
|
|
1290
1291
|
menuItems String?
|
|
1292
|
+
service Service?
|
|
1291
1293
|
}
|
|
1292
1294
|
|
|
1293
1295
|
model Venue {
|
|
1294
1296
|
id String @id @default(cuid())
|
|
1295
|
-
serviceId String @unique
|
|
1296
|
-
service Service @relation(fields: [serviceId], references: [id], onDelete: Cascade)
|
|
1297
1297
|
// serviceConnectionId String? //Check: ?
|
|
1298
1298
|
// serviceConnection String?
|
|
1299
1299
|
yearsInBusiness YearsOfExperience @default(LessThanOneYear)
|
|
@@ -1317,13 +1317,12 @@ model Venue {
|
|
|
1317
1317
|
// subscriptionStartDate DateTime?
|
|
1318
1318
|
|
|
1319
1319
|
bashEvents BashEvent[]
|
|
1320
|
+
service Service?
|
|
1320
1321
|
}
|
|
1321
1322
|
|
|
1322
1323
|
//currently used for 1 free service listing per user
|
|
1323
1324
|
model UserPromoCodeRedemption {
|
|
1324
|
-
id
|
|
1325
|
-
serviceId String?
|
|
1326
|
-
service Service? @relation(fields: [serviceId], references: [id], onDelete: Cascade)
|
|
1325
|
+
id String @id @default(cuid())
|
|
1327
1326
|
|
|
1328
1327
|
bashEventId String?
|
|
1329
1328
|
bashEvent BashEvent? @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
|
|
@@ -1336,6 +1335,8 @@ model UserPromoCodeRedemption {
|
|
|
1336
1335
|
redemptionCount Int
|
|
1337
1336
|
|
|
1338
1337
|
lastRedeemedOn DateTime
|
|
1338
|
+
service Service? @relation(fields: [serviceId], references: [id])
|
|
1339
|
+
serviceId String?
|
|
1339
1340
|
}
|
|
1340
1341
|
|
|
1341
1342
|
// model VenuePricing {
|
|
@@ -1351,12 +1352,11 @@ enum VenuePricingPlan {
|
|
|
1351
1352
|
|
|
1352
1353
|
model Organization {
|
|
1353
1354
|
id String @id @default(cuid())
|
|
1354
|
-
serviceId String @unique
|
|
1355
|
-
service Service @relation(fields: [serviceId], references: [id], onDelete: Cascade)
|
|
1356
1355
|
organizationType OrganizationType[]
|
|
1357
1356
|
goodsOrServices String[]
|
|
1358
1357
|
venueTypes String[]
|
|
1359
1358
|
secondaryVenueTypes String[] @default([])
|
|
1359
|
+
service Service?
|
|
1360
1360
|
}
|
|
1361
1361
|
|
|
1362
1362
|
enum EventServiceType {
|
|
@@ -1433,10 +1433,10 @@ model ServiceRange {
|
|
|
1433
1433
|
max Int @default(50)
|
|
1434
1434
|
volunteerServices VolunteerService[]
|
|
1435
1435
|
entertainmentServices EntertainmentService[]
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1436
|
+
eventService EventService[]
|
|
1437
|
+
vendor Vendor[]
|
|
1438
|
+
exhibitor Exhibitor[]
|
|
1439
|
+
sponsor Sponsor[]
|
|
1440
1440
|
}
|
|
1441
1441
|
|
|
1442
1442
|
// model Availability {
|
|
@@ -1503,7 +1503,7 @@ model ServiceAddon {
|
|
|
1503
1503
|
id String @id @default(cuid())
|
|
1504
1504
|
name String
|
|
1505
1505
|
description String
|
|
1506
|
-
|
|
1506
|
+
priceCents Int
|
|
1507
1507
|
quantity Int
|
|
1508
1508
|
|
|
1509
1509
|
servicePackage ServicePackage? @relation(fields: [servicePackageId], references: [id], onDelete: Cascade)
|
|
@@ -1518,7 +1518,7 @@ model ServicePackage {
|
|
|
1518
1518
|
id String @id @default(cuid())
|
|
1519
1519
|
name String
|
|
1520
1520
|
description String
|
|
1521
|
-
|
|
1521
|
+
priceCents Int
|
|
1522
1522
|
|
|
1523
1523
|
serviceAddons ServiceAddon[]
|
|
1524
1524
|
|
|
@@ -1528,15 +1528,15 @@ model ServicePackage {
|
|
|
1528
1528
|
}
|
|
1529
1529
|
|
|
1530
1530
|
model ServiceRate {
|
|
1531
|
-
id
|
|
1532
|
-
rateType
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
minimumTimeBlockHours
|
|
1537
|
-
serviceSpecialRates
|
|
1538
|
-
serviceDailyRates
|
|
1539
|
-
serviceRatesAssociation
|
|
1531
|
+
id String @id @default(cuid())
|
|
1532
|
+
rateType ServiceRateType
|
|
1533
|
+
hourlyRateCents Int?
|
|
1534
|
+
dailyRateCents Int?
|
|
1535
|
+
cleaningFeePerBookingCents Int?
|
|
1536
|
+
minimumTimeBlockHours Int?
|
|
1537
|
+
serviceSpecialRates ServiceSpecialRates?
|
|
1538
|
+
serviceDailyRates ServiceDailyRates?
|
|
1539
|
+
serviceRatesAssociation ServiceRatesAssociation?
|
|
1540
1540
|
|
|
1541
1541
|
@@index([rateType])
|
|
1542
1542
|
}
|
|
@@ -1633,36 +1633,96 @@ model ServiceRatesAssociation {
|
|
|
1633
1633
|
// Missed
|
|
1634
1634
|
// }
|
|
1635
1635
|
|
|
1636
|
+
enum ServiceBookingFeeType {
|
|
1637
|
+
// AddOn
|
|
1638
|
+
// Package
|
|
1639
|
+
CleaningFee
|
|
1640
|
+
ProcessingFee
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
enum ServiceRatePricingType {
|
|
1644
|
+
Hourly
|
|
1645
|
+
Daily
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
enum ServiceBookingStatus {
|
|
1649
|
+
Pending //pending request
|
|
1650
|
+
Approved //approved request
|
|
1651
|
+
Rejected //rejected request
|
|
1652
|
+
Confirmed //when payment is complete
|
|
1653
|
+
Canceled //canceled request or booking
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
enum ServiceBookingType {
|
|
1657
|
+
Request
|
|
1658
|
+
Instant
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1636
1661
|
model ServiceBookingAddOn {
|
|
1637
1662
|
id String @id @default(cuid())
|
|
1638
1663
|
|
|
1639
|
-
serviceBookingDay ServiceBookingDay @relation(fields: [serviceBookingDayId], references: [id])
|
|
1664
|
+
serviceBookingDay ServiceBookingDay @relation(fields: [serviceBookingDayId], references: [id], onDelete: Cascade)
|
|
1640
1665
|
serviceBookingDayId String
|
|
1641
1666
|
|
|
1642
1667
|
addOnId String
|
|
1643
1668
|
addOn ServiceAddon @relation(fields: [addOnId], references: [id])
|
|
1644
1669
|
chosenQuantity Int
|
|
1645
1670
|
|
|
1646
|
-
|
|
1671
|
+
costPQCents Int
|
|
1647
1672
|
}
|
|
1648
1673
|
|
|
1649
1674
|
model ServiceBookingPackage {
|
|
1650
1675
|
id String @id @default(cuid())
|
|
1651
1676
|
|
|
1652
|
-
serviceBookingDay ServiceBookingDay @relation(fields: [serviceBookingDayId], references: [id])
|
|
1677
|
+
serviceBookingDay ServiceBookingDay @relation(fields: [serviceBookingDayId], references: [id], onDelete: Cascade)
|
|
1653
1678
|
serviceBookingDayId String
|
|
1654
1679
|
|
|
1655
1680
|
packageId String
|
|
1656
1681
|
package ServicePackage @relation(fields: [packageId], references: [id])
|
|
1657
1682
|
chosenQuantity Int
|
|
1658
1683
|
|
|
1659
|
-
|
|
1684
|
+
costPQCents Int
|
|
1685
|
+
}
|
|
1686
|
+
|
|
1687
|
+
model ServiceBookingPriceBreakdown {
|
|
1688
|
+
id String @id @default(cuid())
|
|
1689
|
+
|
|
1690
|
+
serviceBookingDayId String
|
|
1691
|
+
serviceBookingDay ServiceBookingDay @relation(fields: [serviceBookingDayId], references: [id], onDelete: Cascade)
|
|
1692
|
+
|
|
1693
|
+
rateType ServiceRateType
|
|
1694
|
+
pricingType ServiceRatePricingType
|
|
1695
|
+
|
|
1696
|
+
startDate DateTime //start of period applicable
|
|
1697
|
+
endDate DateTime //end of period applicable
|
|
1698
|
+
|
|
1699
|
+
hours Float //number of hours removed from total
|
|
1700
|
+
unitCount Float // number of days (8 hour blocks)/hours used unitCount * rate = piTotal
|
|
1701
|
+
rateCents Int
|
|
1702
|
+
piTotalCents Int
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1705
|
+
model ServiceBookingFee {
|
|
1706
|
+
id String @id @default(cuid())
|
|
1707
|
+
|
|
1708
|
+
serviceBookingDayId String?
|
|
1709
|
+
serviceBookingDay ServiceBookingDay? @relation(fields: [serviceBookingDayId], references: [id], onDelete: Cascade)
|
|
1710
|
+
|
|
1711
|
+
serviceBooking ServiceBooking? @relation(fields: [serviceBookingId], references: [id], onDelete: Cascade)
|
|
1712
|
+
serviceBookingId String?
|
|
1713
|
+
|
|
1714
|
+
feeType ServiceBookingFeeType
|
|
1715
|
+
name String
|
|
1716
|
+
description String?
|
|
1717
|
+
quantity Int
|
|
1718
|
+
|
|
1719
|
+
costPQCents Int
|
|
1660
1720
|
}
|
|
1661
1721
|
|
|
1662
1722
|
model ServiceBookingDay {
|
|
1663
1723
|
id String @id @default(cuid())
|
|
1664
1724
|
|
|
1665
|
-
serviceBookingRequest ServiceBooking? @relation(fields: [serviceBookingRequestId], references: [id])
|
|
1725
|
+
serviceBookingRequest ServiceBooking? @relation(fields: [serviceBookingRequestId], references: [id], onDelete: Cascade)
|
|
1666
1726
|
serviceBookingRequestId String?
|
|
1667
1727
|
|
|
1668
1728
|
startDate DateTime
|
|
@@ -1671,22 +1731,47 @@ model ServiceBookingDay {
|
|
|
1671
1731
|
addOns ServiceBookingAddOn[]
|
|
1672
1732
|
packages ServiceBookingPackage[]
|
|
1673
1733
|
|
|
1674
|
-
|
|
1734
|
+
priceBreakdown ServiceBookingPriceBreakdown[]
|
|
1735
|
+
fees ServiceBookingFee[]
|
|
1736
|
+
|
|
1737
|
+
totalBeforeTaxesCents Int
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
model ServiceBookingCheckout {
|
|
1741
|
+
id String @id @default(cuid())
|
|
1742
|
+
|
|
1743
|
+
bookingDataId String @unique
|
|
1744
|
+
bookingData ServiceBooking @relation(fields: [bookingDataId], references: [id], onDelete: Cascade)
|
|
1745
|
+
|
|
1746
|
+
creatorId String
|
|
1747
|
+
creator User @relation(fields: [creatorId], references: [id], onDelete: Cascade)
|
|
1748
|
+
|
|
1749
|
+
checkoutDateTime DateTime? @default(now())
|
|
1750
|
+
stripeCheckoutSessionId String? @unique
|
|
1751
|
+
stripePaymentIntentId String? @unique
|
|
1752
|
+
|
|
1753
|
+
paidOn DateTime?
|
|
1754
|
+
refundedOn DateTime?
|
|
1755
|
+
|
|
1756
|
+
totalAmountCents Int? //stored in cents
|
|
1757
|
+
depositAmountCents Int?
|
|
1758
|
+
|
|
1759
|
+
@@index(creatorId)
|
|
1675
1760
|
}
|
|
1676
1761
|
|
|
1677
1762
|
model ServiceBooking {
|
|
1678
1763
|
id String @id @default(cuid())
|
|
1679
1764
|
|
|
1680
1765
|
creatorId String
|
|
1681
|
-
creator User @relation("BookingCreator", fields: [creatorId], references: [id], onDelete:
|
|
1766
|
+
creator User @relation("BookingCreator", fields: [creatorId], references: [id], onDelete: Restrict)
|
|
1682
1767
|
|
|
1683
1768
|
forUserId String
|
|
1684
|
-
forUser User @relation("BookingForUser", fields: [forUserId], references: [id], onDelete:
|
|
1769
|
+
forUser User @relation("BookingForUser", fields: [forUserId], references: [id], onDelete: Restrict)
|
|
1685
1770
|
|
|
1686
1771
|
bookedDays ServiceBookingDay[]
|
|
1687
1772
|
|
|
1688
1773
|
serviceId String
|
|
1689
|
-
service Service @relation(fields: [serviceId], references: [id], onDelete:
|
|
1774
|
+
service Service @relation(fields: [serviceId], references: [id], onDelete: Restrict)
|
|
1690
1775
|
|
|
1691
1776
|
status ServiceBookingStatus @default(Pending)
|
|
1692
1777
|
bookingType ServiceBookingType @default(Request)
|
|
@@ -1704,48 +1789,16 @@ model ServiceBooking {
|
|
|
1704
1789
|
checkout ServiceBookingCheckout?
|
|
1705
1790
|
bashNotification BashNotification[]
|
|
1706
1791
|
|
|
1707
|
-
|
|
1792
|
+
additionalFees ServiceBookingFee[]
|
|
1793
|
+
|
|
1794
|
+
daysTotalATBCents Int //ATB=At Time of Booking
|
|
1795
|
+
totalATBCents Int
|
|
1708
1796
|
|
|
1709
1797
|
@@index([status])
|
|
1710
1798
|
@@index([creatorId])
|
|
1711
1799
|
@@index([forUserId])
|
|
1712
1800
|
}
|
|
1713
1801
|
|
|
1714
|
-
model ServiceBookingCheckout {
|
|
1715
|
-
id String @id @default(cuid())
|
|
1716
|
-
|
|
1717
|
-
bookingDataId String @unique
|
|
1718
|
-
bookingData ServiceBooking @relation(fields: [bookingDataId], references: [id], onDelete: Cascade)
|
|
1719
|
-
|
|
1720
|
-
creatorId String
|
|
1721
|
-
creator User @relation(fields: [creatorId], references: [id], onDelete: Cascade)
|
|
1722
|
-
|
|
1723
|
-
checkoutDateTime DateTime? @default(now())
|
|
1724
|
-
stripeCheckoutSessionId String? @unique
|
|
1725
|
-
stripePaymentIntentId String? @unique
|
|
1726
|
-
|
|
1727
|
-
paidOn DateTime?
|
|
1728
|
-
refundedOn DateTime?
|
|
1729
|
-
|
|
1730
|
-
totalAmount Int? //stored in cents
|
|
1731
|
-
depositAmount Int?
|
|
1732
|
-
|
|
1733
|
-
@@index(creatorId)
|
|
1734
|
-
}
|
|
1735
|
-
|
|
1736
|
-
enum ServiceBookingStatus {
|
|
1737
|
-
Pending //pending request
|
|
1738
|
-
Approved //approved request
|
|
1739
|
-
Rejected //rejected request
|
|
1740
|
-
Confirmed //when payment is complete
|
|
1741
|
-
Canceled //canceled request or booking
|
|
1742
|
-
}
|
|
1743
|
-
|
|
1744
|
-
enum ServiceBookingType {
|
|
1745
|
-
Request
|
|
1746
|
-
Instant
|
|
1747
|
-
}
|
|
1748
|
-
|
|
1749
1802
|
enum VisibilityPreference {
|
|
1750
1803
|
Public
|
|
1751
1804
|
Private
|
package/scripts/symlinks.sh
CHANGED
package/src/definitions.ts
CHANGED
|
@@ -3,34 +3,18 @@ import {
|
|
|
3
3
|
BashEventType,
|
|
4
4
|
BashEventVibeTags,
|
|
5
5
|
Contact,
|
|
6
|
-
DayOfWeek,
|
|
7
6
|
Prisma,
|
|
8
|
-
ServiceBookingAddOn,
|
|
9
|
-
ServiceBookingDay,
|
|
10
|
-
// Rate,
|
|
11
|
-
ServiceTypes,
|
|
12
7
|
Ticket,
|
|
13
8
|
TicketTier,
|
|
14
9
|
User,
|
|
15
10
|
UserSubscriptionType,
|
|
16
11
|
YearsOfExperience,
|
|
17
12
|
} from "@prisma/client";
|
|
18
|
-
import {
|
|
19
|
-
ServiceExt,
|
|
20
|
-
CheckoutExt,
|
|
21
|
-
PublicUser,
|
|
22
|
-
VolunteerServiceExt,
|
|
23
|
-
BashEventExt,
|
|
24
|
-
ServiceBookingExt,
|
|
25
|
-
} from "./extendedSchemas";
|
|
13
|
+
import { CheckoutExt, PublicUser, ServiceBookingExt } from "./extendedSchemas";
|
|
26
14
|
import { ServiceSubscriptionTier } from "./utils/userSubscriptionUtils";
|
|
27
|
-
import {
|
|
28
|
-
ServiceAddonInput,
|
|
29
|
-
ServiceGetPriceToBookResult,
|
|
30
|
-
} from "./utils/service/serviceBookingUtils";
|
|
15
|
+
import { FrontendServiceGetPriceToBookResult } from "./utils/service/frontendServiceBookingUtils";
|
|
31
16
|
import { LuxonDateRange } from "./utils/luxonUtils";
|
|
32
|
-
import {
|
|
33
|
-
import { urlAppendQueryParam } from "./utils/urlUtils";
|
|
17
|
+
import { ApiServiceCantBookReason } from "./utils/service/apiServiceBookingApiUtils";
|
|
34
18
|
import { ServiceAttendeeOption } from "./utils/service/attendeeOptionUtils";
|
|
35
19
|
|
|
36
20
|
export const PASSWORD_MIN_LENGTH = 8 as const;
|
|
@@ -132,14 +116,24 @@ export const DONATION_CHECKOUT_RETURN_CANCEL_URL_PAGE =
|
|
|
132
116
|
// );
|
|
133
117
|
|
|
134
118
|
export const SERVICE_BOOKING_CHECKOUT_RETURN_SUCCESS_URL =
|
|
135
|
-
"/service/${SERVICE_ID}/booking/${BOOKING_ID}/checkout-return/success/{CHECKOUT_SESSION_ID}" as const; //CHECKOUT_SESSION_ID filled by stripe
|
|
119
|
+
"/service/${SERVICE_ID}/${SERVICE_TYPE}/${SPECIFIC_ID}/booking/${BOOKING_ID}/checkout-return/success/{CHECKOUT_SESSION_ID}" as const; //CHECKOUT_SESSION_ID filled by stripe
|
|
136
120
|
export const SERVICE_BOOKING_CHECKOUT_RETURN_CANCEL_URL =
|
|
137
|
-
"/service/${SERVICE_ID}/booking/${BOOKING_ID}/checkout-return/cancel/{CHECKOUT_SESSION_ID}" as const;
|
|
121
|
+
"/service/${SERVICE_ID}/${SERVICE_TYPE}/${SPECIFIC_ID}/booking/${BOOKING_ID}/checkout-return/cancel/{CHECKOUT_SESSION_ID}" as const;
|
|
138
122
|
|
|
139
123
|
export const SERVICE_BOOKING_CHECKOUT_RETURN_SUCCESS_URL_PAGE =
|
|
140
|
-
"/service
|
|
124
|
+
"/service/$serviceId/$serviceType/$specificId/booking/$bookingId/checkout-return/success/$checkoutSessionId" as const;
|
|
141
125
|
export const SERVICE_BOOKING_CHECKOUT_RETURN_CANCEL_URL_PAGE =
|
|
142
|
-
"/service
|
|
126
|
+
"/service/$serviceId/$serviceType/$specificId/booking/$bookingId/checkout-return/cancel/$checkoutSessionId" as const;
|
|
127
|
+
|
|
128
|
+
export const SERVICE_BOOKING_DETAILS_MY_VIEW_URL =
|
|
129
|
+
"/service/${SERVICE_ID}/${SERVICE_TYPE}/${SPECIFIC_ID}/booking/${BOOKING_ID}/myView" as const;
|
|
130
|
+
export const SERVICE_BOOKING_DETAILS_SERVICE_VIEW_URL =
|
|
131
|
+
"/service/${SERVICE_ID}/${SERVICE_TYPE}/${SPECIFIC_ID}/booking/${BOOKING_ID}/serviceView" as const;
|
|
132
|
+
|
|
133
|
+
export const SERVICE_BOOKING_DETAILS_MY_VIEW_URL_PAGE =
|
|
134
|
+
"/service/$serviceId/$serviceType/$specificId/booking/$bookingId/myView" as const;
|
|
135
|
+
export const SERVICE_BOOKING_DETAILS_SERVICE_VIEW_URL_PAGE =
|
|
136
|
+
"/service/$serviceId/$serviceType/$specificId/booking/$bookingId/serviceView" as const;
|
|
143
137
|
|
|
144
138
|
export const VERIFICATION_RETURN_URL = `/sign-up` as const;
|
|
145
139
|
export const MY_SERVICES_URL = "/my-services" as const;
|
|
@@ -242,69 +236,69 @@ export type TicketTierWherePriceIsAString = Omit<TicketTier, "price"> & {
|
|
|
242
236
|
price: string;
|
|
243
237
|
} & { cannotDelete: boolean };
|
|
244
238
|
|
|
245
|
-
export type
|
|
239
|
+
export type ApiServiceAddonParams = {
|
|
246
240
|
addonId: string;
|
|
247
241
|
chosenQuantity: number;
|
|
248
242
|
};
|
|
249
243
|
|
|
250
|
-
export type
|
|
244
|
+
export type ApiServiceBookedDayParams = {
|
|
251
245
|
serviceId: string;
|
|
252
246
|
forUserId: string;
|
|
253
247
|
|
|
254
248
|
startDate: string;
|
|
255
249
|
endDate: string;
|
|
256
|
-
addOns:
|
|
250
|
+
addOns: ApiServiceAddonParams[];
|
|
257
251
|
|
|
258
252
|
isFreeGuest?: boolean;
|
|
259
253
|
allowPromiseToPay?: boolean;
|
|
260
254
|
};
|
|
261
255
|
|
|
262
|
-
export type
|
|
263
|
-
|
|
256
|
+
export type ApiServiceBookedDayParamsLuxon = Omit<
|
|
257
|
+
ApiServiceBookedDayParams,
|
|
264
258
|
"startDate" | "endDate"
|
|
265
259
|
> & {
|
|
266
260
|
dateTimeRange: LuxonDateRange;
|
|
267
261
|
};
|
|
268
262
|
|
|
269
|
-
export type
|
|
270
|
-
|
|
263
|
+
export type ApiBookingParamsLuxon = Omit<
|
|
264
|
+
ApiServiceBookingParams,
|
|
271
265
|
"bookedDays"
|
|
272
266
|
> & {
|
|
273
|
-
bookedDays:
|
|
267
|
+
bookedDays: ApiServiceBookedDayParamsLuxon[];
|
|
274
268
|
};
|
|
275
269
|
|
|
276
|
-
export type
|
|
270
|
+
export type ApiServiceBookingParams = {
|
|
277
271
|
serviceId: string;
|
|
278
|
-
bookedDays:
|
|
272
|
+
bookedDays: ApiServiceBookedDayParams[];
|
|
279
273
|
timezone: string;
|
|
280
274
|
attendeeOption: ServiceAttendeeOption;
|
|
281
275
|
};
|
|
282
276
|
|
|
283
|
-
export type
|
|
277
|
+
export type ApiServiceCanBookParams = {} & ApiServiceBookingParams;
|
|
284
278
|
|
|
285
|
-
export type
|
|
279
|
+
export type ApiServicePriceToBookParams = {
|
|
286
280
|
// stripeAccountDBId: string;
|
|
287
|
-
} &
|
|
281
|
+
} & ApiServiceBookingParams;
|
|
288
282
|
|
|
289
|
-
export type
|
|
283
|
+
export type ApiServicePriceToBookResult = {
|
|
290
284
|
// taxes: number;
|
|
291
285
|
// totalAfterTaxes: number;
|
|
292
286
|
// currency: string;
|
|
293
|
-
} &
|
|
287
|
+
} & FrontendServiceGetPriceToBookResult;
|
|
294
288
|
|
|
295
289
|
// export type ServiceBookingApiResult = {
|
|
296
290
|
// serviceId: string;
|
|
297
291
|
// bookedDays: ServiceBookingDay[];
|
|
298
292
|
// };
|
|
299
293
|
|
|
300
|
-
export type
|
|
294
|
+
export type ApiServiceCanBookResult = {
|
|
301
295
|
canBook: boolean;
|
|
302
|
-
reason?:
|
|
296
|
+
reason?: ApiServiceCantBookReason;
|
|
303
297
|
};
|
|
304
298
|
|
|
305
|
-
export type
|
|
306
|
-
canBook:
|
|
307
|
-
priceToBook:
|
|
299
|
+
export type ApiServiceBookingResult = {
|
|
300
|
+
canBook: ApiServiceCanBookResult;
|
|
301
|
+
priceToBook: FrontendServiceGetPriceToBookResult;
|
|
308
302
|
booking?: ServiceBookingExt;
|
|
309
303
|
};
|
|
310
304
|
|