@bash-app/bash-common 29.67.0 → 29.69.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 +3 -1
- package/prisma/schema.prisma +242 -80
- package/src/definitions.ts +228 -123
- package/src/extendedSchemas.ts +176 -105
- package/src/index.ts +11 -1
- package/src/utils/generalDateTimeUtils.ts +43 -0
- package/src/utils/luxonUtils.ts +906 -0
- package/src/utils/mathUtils.ts +3 -0
- package/src/utils/paymentUtils.ts +25 -10
- package/src/utils/service/attendeeOptionUtils.ts +19 -0
- package/src/utils/service/serviceBookingApiUtils.ts +259 -0
- package/src/utils/service/serviceBookingStatusUtils.ts +106 -0
- package/src/utils/service/serviceBookingUtils.ts +391 -0
- package/src/utils/service/serviceDBUtils.ts +51 -0
- package/src/utils/service/serviceRateDBUtils.ts +179 -0
- package/src/utils/service/serviceRateUtils.ts +350 -0
- package/src/utils/service/serviceUtils.ts +35 -0
- package/src/utils/stringUtils.ts +8 -0
- package/src/utils/typeUtils.ts +16 -0
- package/src/utils/urlUtils.ts +64 -5
- package/tsconfig.json +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bash-app/bash-common",
|
|
3
|
-
"version": "29.
|
|
3
|
+
"version": "29.69.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",
|
|
@@ -29,12 +29,14 @@
|
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@prisma/client": "^6.1.0",
|
|
31
31
|
"dayjs": "^1.11.13",
|
|
32
|
+
"luxon": "^3.5.0",
|
|
32
33
|
"prisma": "^6.1.0",
|
|
33
34
|
"react-tailwindcss-datepicker": "^1.6.6",
|
|
34
35
|
"tsx": "^4.10.3"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
38
|
"@types/jest": "^29.5.5",
|
|
39
|
+
"@types/luxon": "^3.4.2",
|
|
38
40
|
"@types/node": "^20.11.1",
|
|
39
41
|
"@types/react": "^18.3.2",
|
|
40
42
|
"@types/shelljs": "^0.8.15",
|
package/prisma/schema.prisma
CHANGED
|
@@ -140,25 +140,30 @@ model BashEventPromoCode {
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
model BashNotification {
|
|
143
|
-
id
|
|
144
|
-
creatorId
|
|
145
|
-
creator
|
|
146
|
-
email
|
|
147
|
-
createdDateTime
|
|
148
|
-
message
|
|
149
|
-
image
|
|
150
|
-
readDateTime
|
|
151
|
-
taskId
|
|
152
|
-
eventTask
|
|
153
|
-
invitationId
|
|
154
|
-
invitation
|
|
155
|
-
bashEventId
|
|
156
|
-
bashEvent
|
|
157
|
-
|
|
158
|
-
|
|
143
|
+
id String @id @default(cuid())
|
|
144
|
+
creatorId String
|
|
145
|
+
creator User @relation("NotificationsCreatedByMe", fields: [creatorId], references: [id], onDelete: Cascade)
|
|
146
|
+
email String
|
|
147
|
+
createdDateTime DateTime @default(now())
|
|
148
|
+
message String
|
|
149
|
+
image String?
|
|
150
|
+
readDateTime DateTime?
|
|
151
|
+
taskId String?
|
|
152
|
+
eventTask EventTask? @relation(fields: [taskId], references: [id], onDelete: Cascade)
|
|
153
|
+
invitationId String?
|
|
154
|
+
invitation Invitation? @relation(fields: [invitationId], references: [id], onDelete: Cascade)
|
|
155
|
+
bashEventId String?
|
|
156
|
+
bashEvent BashEvent? @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
|
|
157
|
+
serviceId String?
|
|
158
|
+
service Service? @relation(fields: [serviceId], references: [id], onDelete: Cascade)
|
|
159
|
+
serviceBookingId String?
|
|
160
|
+
serviceBooking ServiceBooking? @relation(fields: [serviceBookingId], references: [id], onDelete: Cascade)
|
|
161
|
+
reminders Reminder[]
|
|
162
|
+
redirectUrl String?
|
|
159
163
|
|
|
160
164
|
@@unique([creatorId, email, bashEventId])
|
|
161
165
|
@@unique([creatorId, email, invitationId])
|
|
166
|
+
@@unique([creatorId, email, serviceBookingId])
|
|
162
167
|
@@index([creatorId])
|
|
163
168
|
}
|
|
164
169
|
|
|
@@ -264,7 +269,7 @@ model Checkout {
|
|
|
264
269
|
checkoutDateTime DateTime? @default(now())
|
|
265
270
|
tickets Ticket[]
|
|
266
271
|
stripeCheckoutSessionId String? @unique
|
|
267
|
-
bookings Booking[]
|
|
272
|
+
// bookings Booking[]
|
|
268
273
|
|
|
269
274
|
@@index(bashEventId)
|
|
270
275
|
}
|
|
@@ -289,16 +294,16 @@ model TicketTier {
|
|
|
289
294
|
}
|
|
290
295
|
|
|
291
296
|
model Ticket {
|
|
292
|
-
id String
|
|
297
|
+
id String @id @default(cuid())
|
|
293
298
|
ownerId String
|
|
294
|
-
owner User
|
|
299
|
+
owner User @relation("TicketsIOwn", fields: [ownerId], references: [id])
|
|
295
300
|
bashEventId String
|
|
296
|
-
bashEvent BashEvent
|
|
301
|
+
bashEvent BashEvent @relation(fields: [bashEventId], references: [id])
|
|
297
302
|
ticketTierId String?
|
|
298
|
-
ticketTier TicketTier?
|
|
303
|
+
ticketTier TicketTier? @relation(fields: [ticketTierId], references: [id])
|
|
299
304
|
validDate DateTime?
|
|
300
305
|
forUserId String?
|
|
301
|
-
forUser User?
|
|
306
|
+
forUser User? @relation("TicketsISent", fields: [forUserId], references: [id])
|
|
302
307
|
fullName String?
|
|
303
308
|
email String?
|
|
304
309
|
paidOn DateTime?
|
|
@@ -309,11 +314,9 @@ model Ticket {
|
|
|
309
314
|
checkedInAt DateTime?
|
|
310
315
|
checkedOutAt DateTime?
|
|
311
316
|
invitationId String?
|
|
312
|
-
invitation Invitation?
|
|
317
|
+
invitation Invitation? @relation("TicketsForInvitation", fields: [invitationId], references: [id])
|
|
313
318
|
checkoutId String?
|
|
314
|
-
checkout Checkout?
|
|
315
|
-
ServiceCheckout ServiceCheckout? @relation(fields: [serviceCheckoutId], references: [id])
|
|
316
|
-
serviceCheckoutId String?
|
|
319
|
+
checkout Checkout? @relation(fields: [checkoutId], references: [id])
|
|
317
320
|
|
|
318
321
|
@@index([bashEventId])
|
|
319
322
|
}
|
|
@@ -324,43 +327,34 @@ enum TicketStatus {
|
|
|
324
327
|
Missed
|
|
325
328
|
}
|
|
326
329
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
tickets Ticket[]
|
|
333
|
-
stripeCheckoutSessionId String? @unique
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
enum BookingStatus {
|
|
337
|
-
Cancelled
|
|
338
|
-
Completed
|
|
339
|
-
Missed
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
model Booking {
|
|
343
|
-
id String @id @default(cuid())
|
|
344
|
-
serviceId String
|
|
345
|
-
service Service @relation(fields: [serviceId], references: [id])
|
|
346
|
-
validDate DateTime?
|
|
347
|
-
forUserId String?
|
|
348
|
-
forUser User? @relation(fields: [forUserId], references: [id])
|
|
349
|
-
fullName String?
|
|
350
|
-
email String?
|
|
351
|
-
paidOn DateTime?
|
|
352
|
-
requireDeposit Boolean?
|
|
353
|
-
status BookingStatus?
|
|
354
|
-
geoFenceCheckInUnnecessary Boolean?
|
|
355
|
-
checkedInAt DateTime?
|
|
356
|
-
checkedOutAt DateTime?
|
|
357
|
-
checkoutId String?
|
|
358
|
-
checkout Checkout? @relation(fields: [checkoutId], references: [id])
|
|
330
|
+
// enum BookingStatus {
|
|
331
|
+
// Cancelled
|
|
332
|
+
// Completed
|
|
333
|
+
// Missed
|
|
334
|
+
// }
|
|
359
335
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
336
|
+
// model Booking {
|
|
337
|
+
// id String @id @default(cuid())
|
|
338
|
+
// serviceId String
|
|
339
|
+
// service Service @relation(fields: [serviceId], references: [id])
|
|
340
|
+
// validDate DateTime?
|
|
341
|
+
// forUserId String?
|
|
342
|
+
// forUser User? @relation(fields: [forUserId], references: [id])
|
|
343
|
+
// fullName String?
|
|
344
|
+
// email String?
|
|
345
|
+
// paidOn DateTime?
|
|
346
|
+
// requireDeposit Boolean?
|
|
347
|
+
// status BookingStatus?
|
|
348
|
+
// geoFenceCheckInUnnecessary Boolean?
|
|
349
|
+
// checkedInAt DateTime?
|
|
350
|
+
// checkedOutAt DateTime?
|
|
351
|
+
// checkoutId String?
|
|
352
|
+
// checkout Checkout? @relation(fields: [checkoutId], references: [id])
|
|
353
|
+
|
|
354
|
+
// @@index([serviceId])
|
|
355
|
+
// @@index([forUserId])
|
|
356
|
+
// @@index([checkoutId])
|
|
357
|
+
// }
|
|
364
358
|
|
|
365
359
|
model unusedModelButNeededForSomeTypesToBeDefinedForTypescript {
|
|
366
360
|
id String @id @default(cuid())
|
|
@@ -421,8 +415,8 @@ enum BashEventType {
|
|
|
421
415
|
AfterParty
|
|
422
416
|
AnimeAndCosplayFestival
|
|
423
417
|
AnniversaryCelebration
|
|
424
|
-
ArtExhibitOpening
|
|
425
418
|
ArtAndCraftNight
|
|
419
|
+
ArtExhibitOpening
|
|
426
420
|
BBQCookout
|
|
427
421
|
BabyShower
|
|
428
422
|
BachelorOrBacheloretteParty
|
|
@@ -437,8 +431,8 @@ enum BashEventType {
|
|
|
437
431
|
CarnivalAndFair
|
|
438
432
|
CasinoNight
|
|
439
433
|
CasualMixer
|
|
440
|
-
CharityBall
|
|
441
434
|
CharityFundraiser
|
|
435
|
+
CharityGala
|
|
442
436
|
ChristmasParty
|
|
443
437
|
ChurchEvent
|
|
444
438
|
CircusOrCarnivalParty
|
|
@@ -446,6 +440,7 @@ enum BashEventType {
|
|
|
446
440
|
CollegeParty_FraternityOrSorority
|
|
447
441
|
ComedyShowOrStandUpComedyNight
|
|
448
442
|
ComicConvention
|
|
443
|
+
CommunityMovieNight
|
|
449
444
|
Competition
|
|
450
445
|
Concert
|
|
451
446
|
CookingCompetition
|
|
@@ -456,17 +451,18 @@ enum BashEventType {
|
|
|
456
451
|
DesertRave
|
|
457
452
|
DiscoNight
|
|
458
453
|
EasterGathering
|
|
459
|
-
EngagementParty
|
|
460
454
|
ESportsGamingTournament
|
|
455
|
+
EngagementParty
|
|
461
456
|
ExclusiveLuxuryRetreat
|
|
462
457
|
FantasyThemedParty
|
|
463
458
|
FashionShow
|
|
464
|
-
Fireside
|
|
465
|
-
FitnessFestival
|
|
466
|
-
FlashMob
|
|
467
459
|
Festival
|
|
468
460
|
FestivalFilm
|
|
469
461
|
FestivalFood
|
|
462
|
+
Fireside
|
|
463
|
+
FitnessFestival
|
|
464
|
+
FlashMob
|
|
465
|
+
Fundraiser
|
|
470
466
|
FundraisingEvent
|
|
471
467
|
GalaDinner
|
|
472
468
|
GameNight
|
|
@@ -474,7 +470,7 @@ enum BashEventType {
|
|
|
474
470
|
GardenParty
|
|
475
471
|
GoingAwayPartyOrFarewell
|
|
476
472
|
GraduationParty
|
|
477
|
-
|
|
473
|
+
HalloweenParty
|
|
478
474
|
HanukkahParty
|
|
479
475
|
HistoricalEraParty
|
|
480
476
|
HolidayParty
|
|
@@ -482,11 +478,14 @@ enum BashEventType {
|
|
|
482
478
|
HousewarmingParty
|
|
483
479
|
KaraokeNight
|
|
484
480
|
KiteFlyingFestival
|
|
481
|
+
LaunchParty
|
|
485
482
|
LiveBandPerformanceInALocalVenue
|
|
486
483
|
Luau
|
|
484
|
+
LuxuryRetreat
|
|
487
485
|
MansionParty
|
|
488
486
|
MardiGras
|
|
489
487
|
MasqueradeBall
|
|
488
|
+
Mastermind
|
|
490
489
|
MotorcycleRally
|
|
491
490
|
MovieNight
|
|
492
491
|
MoviePremiere
|
|
@@ -504,30 +503,40 @@ enum BashEventType {
|
|
|
504
503
|
PreParty
|
|
505
504
|
ProductLaunch
|
|
506
505
|
ProfessionalNetworkingEvent
|
|
506
|
+
PubCrawl
|
|
507
|
+
Rave
|
|
507
508
|
Rave_General
|
|
508
509
|
RetirementCelebration
|
|
510
|
+
Reunion
|
|
509
511
|
Reunion_FamilyOrSchoolOrFriends
|
|
510
512
|
SafariAdventureParty
|
|
513
|
+
SchoolEvent
|
|
511
514
|
SchoolEvent_MiddleSchoolOrHighSchoolOrCollege
|
|
512
515
|
ScienceFictionThemedParty
|
|
513
516
|
SocialClubEvent
|
|
514
517
|
SportsTournament
|
|
515
518
|
SportsWatchParty
|
|
516
519
|
SuperheroThemedParty
|
|
517
|
-
SurfCompetition
|
|
518
520
|
ThanksgivingDinner
|
|
519
521
|
ThemedCostumeParty
|
|
520
522
|
ThemedDinnerParty
|
|
521
523
|
ThemedPubCrawl
|
|
522
524
|
Tournament
|
|
525
|
+
TradeShow
|
|
523
526
|
TravelAndTradeShow
|
|
524
527
|
TriviaNight
|
|
528
|
+
UniversityEvent
|
|
525
529
|
ValentinesDayParty
|
|
526
530
|
WeddingReception
|
|
527
531
|
WelcomeHomeParty
|
|
528
532
|
WellnessFestival
|
|
529
533
|
WineTastingEvent
|
|
534
|
+
CharityBall
|
|
535
|
+
HalloweenCostumeParty
|
|
536
|
+
SurfCompetition
|
|
530
537
|
Other
|
|
538
|
+
|
|
539
|
+
// ArtAndCraftNight, BBQCookout, BabyShower, Birthday, Bonfire, BookClubMeeting, BridalShower, BrunchGathering, EasterGathering, Fireside, GameNight, GardenParty, GoingAwayPartyOrFarewell, GraduationParty, HanukkahParty, HousewarmingParty, MovieNight, OutdoorActivity, OutdoorMovieNight_WithAProjector, PotluckVegan, PreParty, RetirementCelebration, SafariAdventureParty, ScienceFictionThemedParty, SocialClubEvent, SportsWatchParty, SuperheroThemedParty, ThanksgivingDinner, ThemedDinnerParty, TriviaNight, WelcomeHomeParty
|
|
531
540
|
}
|
|
532
541
|
|
|
533
542
|
model CustomBashEventType {
|
|
@@ -624,6 +633,7 @@ enum BashStatus {
|
|
|
624
633
|
PreSale
|
|
625
634
|
Published
|
|
626
635
|
Finished
|
|
636
|
+
// should we add Approved, Rejected, Confirmed, and Canceled like services has?
|
|
627
637
|
}
|
|
628
638
|
|
|
629
639
|
enum ServiceStatus {
|
|
@@ -862,7 +872,7 @@ model User {
|
|
|
862
872
|
stripeAccountId String? @unique
|
|
863
873
|
isSuperUser Boolean @default(false)
|
|
864
874
|
// isSuspended Boolean @default(false)
|
|
865
|
-
intent
|
|
875
|
+
intent UserIntent?
|
|
866
876
|
googleCalendarAccess String?
|
|
867
877
|
givenName String?
|
|
868
878
|
familyName String?
|
|
@@ -919,8 +929,7 @@ model User {
|
|
|
919
929
|
ticketTiersWaitListsIveJoined TicketTier[]
|
|
920
930
|
contacts Contact[]
|
|
921
931
|
bashEventPromoCodesIUsed BashEventPromoCode[]
|
|
922
|
-
|
|
923
|
-
bookingForMe Booking[]
|
|
932
|
+
// bookingForMe Booking[]
|
|
924
933
|
userSubscription UserSubscription?
|
|
925
934
|
// serviceSubcriptions ServiceSubscription[]
|
|
926
935
|
volunteerService VolunteerService[]
|
|
@@ -933,6 +942,9 @@ model User {
|
|
|
933
942
|
|
|
934
943
|
// primaryStripeAccountDBId String? @unique
|
|
935
944
|
// primaryStripeAccountDB StripeAccount? @relation("PrimaryStripeAccount", fields: [primaryStripeAccountDBId], references: [id], onDelete: Restrict, onUpdate: Restrict)
|
|
945
|
+
serviceBookingForCreator ServiceBooking[] @relation("BookingCreator")
|
|
946
|
+
serviceBookingForUser ServiceBooking[] @relation("BookingForUser")
|
|
947
|
+
serviceBookingCheckout ServiceBookingCheckout[]
|
|
936
948
|
}
|
|
937
949
|
|
|
938
950
|
model Contact {
|
|
@@ -1131,7 +1143,7 @@ model Service {
|
|
|
1131
1143
|
visibility VisibilityPreference @default(Public)
|
|
1132
1144
|
|
|
1133
1145
|
bashesNotInterestedIn BashEventType[]
|
|
1134
|
-
bookings Booking[]
|
|
1146
|
+
// bookings Booking[]
|
|
1135
1147
|
media Media[]
|
|
1136
1148
|
serviceLinks ServiceLink[]
|
|
1137
1149
|
|
|
@@ -1151,6 +1163,8 @@ model Service {
|
|
|
1151
1163
|
|
|
1152
1164
|
bashEvent BashEvent[] // because a service needs to be associated with a bash to post to the bashfeed
|
|
1153
1165
|
userPromoCodeRedemption UserPromoCodeRedemption[]
|
|
1166
|
+
bookings ServiceBooking[]
|
|
1167
|
+
bashNotification BashNotification[]
|
|
1154
1168
|
}
|
|
1155
1169
|
|
|
1156
1170
|
model StripeAccount {
|
|
@@ -1302,6 +1316,7 @@ model Venue {
|
|
|
1302
1316
|
bashEvents BashEvent[]
|
|
1303
1317
|
}
|
|
1304
1318
|
|
|
1319
|
+
//currently used for 1 free service listing per user
|
|
1305
1320
|
model UserPromoCodeRedemption {
|
|
1306
1321
|
id String @id @default(cuid())
|
|
1307
1322
|
serviceId String?
|
|
@@ -1485,7 +1500,7 @@ model ServiceAddon {
|
|
|
1485
1500
|
id String @id @default(cuid())
|
|
1486
1501
|
name String
|
|
1487
1502
|
description String
|
|
1488
|
-
price Int
|
|
1503
|
+
price Int
|
|
1489
1504
|
quantity Int
|
|
1490
1505
|
|
|
1491
1506
|
servicePackage ServicePackage? @relation(fields: [servicePackageId], references: [id], onDelete: Cascade)
|
|
@@ -1493,6 +1508,7 @@ model ServiceAddon {
|
|
|
1493
1508
|
|
|
1494
1509
|
serviceRatesAssociation ServiceRatesAssociation? @relation(fields: [serviceRatesAssociationId], references: [id], onDelete: Cascade)
|
|
1495
1510
|
serviceRatesAssociationId String?
|
|
1511
|
+
ServiceBookingAddOn ServiceBookingAddOn[]
|
|
1496
1512
|
}
|
|
1497
1513
|
|
|
1498
1514
|
model ServicePackage {
|
|
@@ -1505,6 +1521,7 @@ model ServicePackage {
|
|
|
1505
1521
|
|
|
1506
1522
|
serviceRatesAssociation ServiceRatesAssociation? @relation(fields: [serviceRatesAssociationId], references: [id], onDelete: Cascade)
|
|
1507
1523
|
serviceRatesAssociationId String?
|
|
1524
|
+
ServiceBookingPackage ServiceBookingPackage[]
|
|
1508
1525
|
}
|
|
1509
1526
|
|
|
1510
1527
|
model ServiceRate {
|
|
@@ -1542,11 +1559,9 @@ model ServiceSpecialRates {
|
|
|
1542
1559
|
// can have special rates on different days of the year (single or range)
|
|
1543
1560
|
// free trial period with promo code (1 or 2 months of listing for free)
|
|
1544
1561
|
model ServiceDailyRates {
|
|
1545
|
-
id
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
endDayOfWeek DayOfWeek
|
|
1549
|
-
endTime DateTime @db.Time
|
|
1562
|
+
id String @id @default(cuid())
|
|
1563
|
+
startDate DateTime
|
|
1564
|
+
endDate DateTime
|
|
1550
1565
|
|
|
1551
1566
|
serviceRateId String?
|
|
1552
1567
|
serviceRate ServiceRate? @relation(fields: [serviceRateId], references: [id], onDelete: Cascade)
|
|
@@ -1581,6 +1596,153 @@ model ServiceRatesAssociation {
|
|
|
1581
1596
|
@@unique([serviceGeneralRatesId])
|
|
1582
1597
|
}
|
|
1583
1598
|
|
|
1599
|
+
// model ServiceTicket {
|
|
1600
|
+
// id String @id @default(cuid())
|
|
1601
|
+
// ownerId String
|
|
1602
|
+
// owner User @relation("TicketsIOwn", fields: [ownerId], references: [id])
|
|
1603
|
+
// bashEventId String
|
|
1604
|
+
// bashEvent BashEvent @relation(fields: [bashEventId], references: [id])
|
|
1605
|
+
// ticketTierId String?
|
|
1606
|
+
// ticketTier TicketTier? @relation(fields: [ticketTierId], references: [id])
|
|
1607
|
+
// validDate DateTime?
|
|
1608
|
+
// forUserId String?
|
|
1609
|
+
// forUser User? @relation("TicketsISent", fields: [forUserId], references: [id])
|
|
1610
|
+
// fullName String?
|
|
1611
|
+
// email String?
|
|
1612
|
+
// paidOn DateTime?
|
|
1613
|
+
// allowPromiseToPay Boolean?
|
|
1614
|
+
// status TicketStatus?
|
|
1615
|
+
// isFreeGuest Boolean?
|
|
1616
|
+
// geoFenceCheckInUnnecessary Boolean?
|
|
1617
|
+
// checkedInAt DateTime?
|
|
1618
|
+
// checkedOutAt DateTime?
|
|
1619
|
+
// invitationId String?
|
|
1620
|
+
// invitation Invitation? @relation("TicketsForInvitation", fields: [invitationId], references: [id])
|
|
1621
|
+
// checkoutId String?
|
|
1622
|
+
// checkout Checkout? @relation(fields: [checkoutId], references: [id])
|
|
1623
|
+
|
|
1624
|
+
// @@index([bashEventId])
|
|
1625
|
+
// }
|
|
1626
|
+
|
|
1627
|
+
// enum ServiceTicketStatus {
|
|
1628
|
+
// Cancelled
|
|
1629
|
+
// Attended
|
|
1630
|
+
// Missed
|
|
1631
|
+
// }
|
|
1632
|
+
|
|
1633
|
+
model ServiceBookingAddOn {
|
|
1634
|
+
id String @id @default(cuid())
|
|
1635
|
+
|
|
1636
|
+
serviceBookingDay ServiceBookingDay @relation(fields: [serviceBookingDayId], references: [id])
|
|
1637
|
+
serviceBookingDayId String
|
|
1638
|
+
|
|
1639
|
+
addOnId String
|
|
1640
|
+
addOn ServiceAddon @relation(fields: [addOnId], references: [id])
|
|
1641
|
+
chosenQuantity Int
|
|
1642
|
+
|
|
1643
|
+
// costATBCents Int
|
|
1644
|
+
}
|
|
1645
|
+
|
|
1646
|
+
model ServiceBookingPackage {
|
|
1647
|
+
id String @id @default(cuid())
|
|
1648
|
+
|
|
1649
|
+
serviceBookingDay ServiceBookingDay @relation(fields: [serviceBookingDayId], references: [id])
|
|
1650
|
+
serviceBookingDayId String
|
|
1651
|
+
|
|
1652
|
+
packageId String
|
|
1653
|
+
package ServicePackage @relation(fields: [packageId], references: [id])
|
|
1654
|
+
chosenQuantity Int
|
|
1655
|
+
|
|
1656
|
+
// costATBCents Int
|
|
1657
|
+
}
|
|
1658
|
+
|
|
1659
|
+
model ServiceBookingDay {
|
|
1660
|
+
id String @id @default(cuid())
|
|
1661
|
+
|
|
1662
|
+
serviceBookingRequest ServiceBooking? @relation(fields: [serviceBookingRequestId], references: [id])
|
|
1663
|
+
serviceBookingRequestId String?
|
|
1664
|
+
|
|
1665
|
+
startDate DateTime
|
|
1666
|
+
endDate DateTime
|
|
1667
|
+
|
|
1668
|
+
addOns ServiceBookingAddOn[]
|
|
1669
|
+
packages ServiceBookingPackage[]
|
|
1670
|
+
|
|
1671
|
+
// costATBCents Int
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
model ServiceBooking {
|
|
1675
|
+
id String @id @default(cuid())
|
|
1676
|
+
|
|
1677
|
+
creatorId String
|
|
1678
|
+
creator User @relation("BookingCreator", fields: [creatorId], references: [id], onDelete: Cascade)
|
|
1679
|
+
|
|
1680
|
+
forUserId String
|
|
1681
|
+
forUser User @relation("BookingForUser", fields: [forUserId], references: [id], onDelete: Cascade)
|
|
1682
|
+
|
|
1683
|
+
bookedDays ServiceBookingDay[]
|
|
1684
|
+
|
|
1685
|
+
serviceId String
|
|
1686
|
+
service Service @relation(fields: [serviceId], references: [id], onDelete: Cascade)
|
|
1687
|
+
|
|
1688
|
+
status ServiceBookingStatus @default(Pending)
|
|
1689
|
+
bookingType ServiceBookingType @default(Request)
|
|
1690
|
+
|
|
1691
|
+
timezone String //stored here instead of service incase different service types operate in multiple timezones (requesters timezone would matter)
|
|
1692
|
+
|
|
1693
|
+
requestedOn DateTime?
|
|
1694
|
+
requestDecisionOn DateTime?
|
|
1695
|
+
bookedOn DateTime?
|
|
1696
|
+
canceledOn DateTime?
|
|
1697
|
+
|
|
1698
|
+
isFreeGuest Boolean @default(false)
|
|
1699
|
+
allowPromiseToPay Boolean @default(false)
|
|
1700
|
+
|
|
1701
|
+
checkout ServiceBookingCheckout?
|
|
1702
|
+
bashNotification BashNotification[]
|
|
1703
|
+
|
|
1704
|
+
// costATBCents Int
|
|
1705
|
+
|
|
1706
|
+
@@index([status])
|
|
1707
|
+
@@index([creatorId])
|
|
1708
|
+
@@index([forUserId])
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
model ServiceBookingCheckout {
|
|
1712
|
+
id String @id @default(cuid())
|
|
1713
|
+
|
|
1714
|
+
bookingDataId String @unique
|
|
1715
|
+
bookingData ServiceBooking @relation(fields: [bookingDataId], references: [id], onDelete: Cascade)
|
|
1716
|
+
|
|
1717
|
+
creatorId String
|
|
1718
|
+
creator User @relation(fields: [creatorId], references: [id], onDelete: Cascade)
|
|
1719
|
+
|
|
1720
|
+
checkoutDateTime DateTime? @default(now())
|
|
1721
|
+
stripeCheckoutSessionId String? @unique
|
|
1722
|
+
stripePaymentIntentId String? @unique
|
|
1723
|
+
|
|
1724
|
+
paidOn DateTime?
|
|
1725
|
+
refundedOn DateTime?
|
|
1726
|
+
|
|
1727
|
+
totalAmount Int? //stored in cents
|
|
1728
|
+
depositAmount Int?
|
|
1729
|
+
|
|
1730
|
+
@@index(creatorId)
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1733
|
+
enum ServiceBookingStatus {
|
|
1734
|
+
Pending //pending request
|
|
1735
|
+
Approved //approved request
|
|
1736
|
+
Rejected //rejected request
|
|
1737
|
+
Confirmed //when payment is complete
|
|
1738
|
+
Canceled //canceled request or booking
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1741
|
+
enum ServiceBookingType {
|
|
1742
|
+
Request
|
|
1743
|
+
Instant
|
|
1744
|
+
}
|
|
1745
|
+
|
|
1584
1746
|
enum VisibilityPreference {
|
|
1585
1747
|
Public
|
|
1586
1748
|
Private
|