@bash-app/bash-common 29.66.0 → 29.68.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 +217 -67
- package/src/definitions.ts +131 -60
- package/src/extendedSchemas.ts +166 -111
- package/src/index.ts +9 -0
- package/src/utils/dateTimeUtils.ts +120 -60
- package/src/utils/generalDateTimeUtils.ts +43 -0
- package/src/utils/luxonUtils.ts +871 -72
- package/src/utils/mathUtils.ts +3 -0
- package/src/utils/service/attendeeOptionUtils.ts +19 -0
- package/src/utils/service/serviceBookingApiUtils.ts +116 -0
- package/src/utils/service/serviceBookingUtils.ts +321 -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/typeUtils.ts +16 -0
- 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.68.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
|
@@ -191,7 +191,8 @@ model BashEvent {
|
|
|
191
191
|
title String
|
|
192
192
|
creatorId String
|
|
193
193
|
creator User @relation("CreatedEvent", fields: [creatorId], references: [id], onDelete: Cascade)
|
|
194
|
-
|
|
194
|
+
createdAt DateTime @default(now())
|
|
195
|
+
isApproved Boolean? @default(false)
|
|
195
196
|
description String?
|
|
196
197
|
eventType String @default("Other")
|
|
197
198
|
startDateTime DateTime? @default(now())
|
|
@@ -244,7 +245,6 @@ model BashEvent {
|
|
|
244
245
|
venue Venue? @relation(fields: [venueId], references: [id])
|
|
245
246
|
userPromoCodeRedemption UserPromoCodeRedemption[]
|
|
246
247
|
averageRating Float? @default(0)
|
|
247
|
-
createdAt DateTime @default(now()) // Timestamp for when the review was created
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
model Coordinates {
|
|
@@ -264,7 +264,7 @@ model Checkout {
|
|
|
264
264
|
checkoutDateTime DateTime? @default(now())
|
|
265
265
|
tickets Ticket[]
|
|
266
266
|
stripeCheckoutSessionId String? @unique
|
|
267
|
-
bookings Booking[]
|
|
267
|
+
// bookings Booking[]
|
|
268
268
|
|
|
269
269
|
@@index(bashEventId)
|
|
270
270
|
}
|
|
@@ -289,16 +289,16 @@ model TicketTier {
|
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
model Ticket {
|
|
292
|
-
id String
|
|
292
|
+
id String @id @default(cuid())
|
|
293
293
|
ownerId String
|
|
294
|
-
owner User
|
|
294
|
+
owner User @relation("TicketsIOwn", fields: [ownerId], references: [id])
|
|
295
295
|
bashEventId String
|
|
296
|
-
bashEvent BashEvent
|
|
296
|
+
bashEvent BashEvent @relation(fields: [bashEventId], references: [id])
|
|
297
297
|
ticketTierId String?
|
|
298
|
-
ticketTier TicketTier?
|
|
298
|
+
ticketTier TicketTier? @relation(fields: [ticketTierId], references: [id])
|
|
299
299
|
validDate DateTime?
|
|
300
300
|
forUserId String?
|
|
301
|
-
forUser User?
|
|
301
|
+
forUser User? @relation("TicketsISent", fields: [forUserId], references: [id])
|
|
302
302
|
fullName String?
|
|
303
303
|
email String?
|
|
304
304
|
paidOn DateTime?
|
|
@@ -309,11 +309,9 @@ model Ticket {
|
|
|
309
309
|
checkedInAt DateTime?
|
|
310
310
|
checkedOutAt DateTime?
|
|
311
311
|
invitationId String?
|
|
312
|
-
invitation Invitation?
|
|
312
|
+
invitation Invitation? @relation("TicketsForInvitation", fields: [invitationId], references: [id])
|
|
313
313
|
checkoutId String?
|
|
314
|
-
checkout Checkout?
|
|
315
|
-
ServiceCheckout ServiceCheckout? @relation(fields: [serviceCheckoutId], references: [id])
|
|
316
|
-
serviceCheckoutId String?
|
|
314
|
+
checkout Checkout? @relation(fields: [checkoutId], references: [id])
|
|
317
315
|
|
|
318
316
|
@@index([bashEventId])
|
|
319
317
|
}
|
|
@@ -324,43 +322,34 @@ enum TicketStatus {
|
|
|
324
322
|
Missed
|
|
325
323
|
}
|
|
326
324
|
|
|
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])
|
|
325
|
+
// enum BookingStatus {
|
|
326
|
+
// Cancelled
|
|
327
|
+
// Completed
|
|
328
|
+
// Missed
|
|
329
|
+
// }
|
|
359
330
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
331
|
+
// model Booking {
|
|
332
|
+
// id String @id @default(cuid())
|
|
333
|
+
// serviceId String
|
|
334
|
+
// service Service @relation(fields: [serviceId], references: [id])
|
|
335
|
+
// validDate DateTime?
|
|
336
|
+
// forUserId String?
|
|
337
|
+
// forUser User? @relation(fields: [forUserId], references: [id])
|
|
338
|
+
// fullName String?
|
|
339
|
+
// email String?
|
|
340
|
+
// paidOn DateTime?
|
|
341
|
+
// requireDeposit Boolean?
|
|
342
|
+
// status BookingStatus?
|
|
343
|
+
// geoFenceCheckInUnnecessary Boolean?
|
|
344
|
+
// checkedInAt DateTime?
|
|
345
|
+
// checkedOutAt DateTime?
|
|
346
|
+
// checkoutId String?
|
|
347
|
+
// checkout Checkout? @relation(fields: [checkoutId], references: [id])
|
|
348
|
+
|
|
349
|
+
// @@index([serviceId])
|
|
350
|
+
// @@index([forUserId])
|
|
351
|
+
// @@index([checkoutId])
|
|
352
|
+
// }
|
|
364
353
|
|
|
365
354
|
model unusedModelButNeededForSomeTypesToBeDefinedForTypescript {
|
|
366
355
|
id String @id @default(cuid())
|
|
@@ -421,8 +410,8 @@ enum BashEventType {
|
|
|
421
410
|
AfterParty
|
|
422
411
|
AnimeAndCosplayFestival
|
|
423
412
|
AnniversaryCelebration
|
|
424
|
-
ArtExhibitOpening
|
|
425
413
|
ArtAndCraftNight
|
|
414
|
+
ArtExhibitOpening
|
|
426
415
|
BBQCookout
|
|
427
416
|
BabyShower
|
|
428
417
|
BachelorOrBacheloretteParty
|
|
@@ -437,8 +426,8 @@ enum BashEventType {
|
|
|
437
426
|
CarnivalAndFair
|
|
438
427
|
CasinoNight
|
|
439
428
|
CasualMixer
|
|
440
|
-
CharityBall
|
|
441
429
|
CharityFundraiser
|
|
430
|
+
CharityGala
|
|
442
431
|
ChristmasParty
|
|
443
432
|
ChurchEvent
|
|
444
433
|
CircusOrCarnivalParty
|
|
@@ -446,6 +435,7 @@ enum BashEventType {
|
|
|
446
435
|
CollegeParty_FraternityOrSorority
|
|
447
436
|
ComedyShowOrStandUpComedyNight
|
|
448
437
|
ComicConvention
|
|
438
|
+
CommunityMovieNight
|
|
449
439
|
Competition
|
|
450
440
|
Concert
|
|
451
441
|
CookingCompetition
|
|
@@ -456,17 +446,18 @@ enum BashEventType {
|
|
|
456
446
|
DesertRave
|
|
457
447
|
DiscoNight
|
|
458
448
|
EasterGathering
|
|
459
|
-
EngagementParty
|
|
460
449
|
ESportsGamingTournament
|
|
450
|
+
EngagementParty
|
|
461
451
|
ExclusiveLuxuryRetreat
|
|
462
452
|
FantasyThemedParty
|
|
463
453
|
FashionShow
|
|
464
|
-
Fireside
|
|
465
|
-
FitnessFestival
|
|
466
|
-
FlashMob
|
|
467
454
|
Festival
|
|
468
455
|
FestivalFilm
|
|
469
456
|
FestivalFood
|
|
457
|
+
Fireside
|
|
458
|
+
FitnessFestival
|
|
459
|
+
FlashMob
|
|
460
|
+
Fundraiser
|
|
470
461
|
FundraisingEvent
|
|
471
462
|
GalaDinner
|
|
472
463
|
GameNight
|
|
@@ -474,7 +465,7 @@ enum BashEventType {
|
|
|
474
465
|
GardenParty
|
|
475
466
|
GoingAwayPartyOrFarewell
|
|
476
467
|
GraduationParty
|
|
477
|
-
|
|
468
|
+
HalloweenParty
|
|
478
469
|
HanukkahParty
|
|
479
470
|
HistoricalEraParty
|
|
480
471
|
HolidayParty
|
|
@@ -482,11 +473,14 @@ enum BashEventType {
|
|
|
482
473
|
HousewarmingParty
|
|
483
474
|
KaraokeNight
|
|
484
475
|
KiteFlyingFestival
|
|
476
|
+
LaunchParty
|
|
485
477
|
LiveBandPerformanceInALocalVenue
|
|
486
478
|
Luau
|
|
479
|
+
LuxuryRetreat
|
|
487
480
|
MansionParty
|
|
488
481
|
MardiGras
|
|
489
482
|
MasqueradeBall
|
|
483
|
+
Mastermind
|
|
490
484
|
MotorcycleRally
|
|
491
485
|
MovieNight
|
|
492
486
|
MoviePremiere
|
|
@@ -504,30 +498,40 @@ enum BashEventType {
|
|
|
504
498
|
PreParty
|
|
505
499
|
ProductLaunch
|
|
506
500
|
ProfessionalNetworkingEvent
|
|
501
|
+
PubCrawl
|
|
502
|
+
Rave
|
|
507
503
|
Rave_General
|
|
508
504
|
RetirementCelebration
|
|
505
|
+
Reunion
|
|
509
506
|
Reunion_FamilyOrSchoolOrFriends
|
|
510
507
|
SafariAdventureParty
|
|
508
|
+
SchoolEvent
|
|
511
509
|
SchoolEvent_MiddleSchoolOrHighSchoolOrCollege
|
|
512
510
|
ScienceFictionThemedParty
|
|
513
511
|
SocialClubEvent
|
|
514
512
|
SportsTournament
|
|
515
513
|
SportsWatchParty
|
|
516
514
|
SuperheroThemedParty
|
|
517
|
-
SurfCompetition
|
|
518
515
|
ThanksgivingDinner
|
|
519
516
|
ThemedCostumeParty
|
|
520
517
|
ThemedDinnerParty
|
|
521
518
|
ThemedPubCrawl
|
|
522
519
|
Tournament
|
|
520
|
+
TradeShow
|
|
523
521
|
TravelAndTradeShow
|
|
524
522
|
TriviaNight
|
|
523
|
+
UniversityEvent
|
|
525
524
|
ValentinesDayParty
|
|
526
525
|
WeddingReception
|
|
527
526
|
WelcomeHomeParty
|
|
528
527
|
WellnessFestival
|
|
529
528
|
WineTastingEvent
|
|
529
|
+
CharityBall
|
|
530
|
+
HalloweenCostumeParty
|
|
531
|
+
SurfCompetition
|
|
530
532
|
Other
|
|
533
|
+
|
|
534
|
+
// 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
535
|
}
|
|
532
536
|
|
|
533
537
|
model CustomBashEventType {
|
|
@@ -612,11 +616,17 @@ enum Education {
|
|
|
612
616
|
NoPreference
|
|
613
617
|
}
|
|
614
618
|
|
|
619
|
+
enum UserIntent {
|
|
620
|
+
EventSeeker
|
|
621
|
+
EventOrganizer
|
|
622
|
+
VenueOwner
|
|
623
|
+
}
|
|
624
|
+
|
|
615
625
|
enum BashStatus {
|
|
616
626
|
Draft
|
|
627
|
+
Pending
|
|
617
628
|
PreSale
|
|
618
629
|
Published
|
|
619
|
-
Pending
|
|
620
630
|
Finished
|
|
621
631
|
}
|
|
622
632
|
|
|
@@ -856,6 +866,7 @@ model User {
|
|
|
856
866
|
stripeAccountId String? @unique
|
|
857
867
|
isSuperUser Boolean @default(false)
|
|
858
868
|
// isSuspended Boolean @default(false)
|
|
869
|
+
intent UserIntent?
|
|
859
870
|
googleCalendarAccess String?
|
|
860
871
|
givenName String?
|
|
861
872
|
familyName String?
|
|
@@ -912,8 +923,7 @@ model User {
|
|
|
912
923
|
ticketTiersWaitListsIveJoined TicketTier[]
|
|
913
924
|
contacts Contact[]
|
|
914
925
|
bashEventPromoCodesIUsed BashEventPromoCode[]
|
|
915
|
-
|
|
916
|
-
bookingForMe Booking[]
|
|
926
|
+
// bookingForMe Booking[]
|
|
917
927
|
userSubscription UserSubscription?
|
|
918
928
|
// serviceSubcriptions ServiceSubscription[]
|
|
919
929
|
volunteerService VolunteerService[]
|
|
@@ -926,6 +936,9 @@ model User {
|
|
|
926
936
|
|
|
927
937
|
// primaryStripeAccountDBId String? @unique
|
|
928
938
|
// primaryStripeAccountDB StripeAccount? @relation("PrimaryStripeAccount", fields: [primaryStripeAccountDBId], references: [id], onDelete: Restrict, onUpdate: Restrict)
|
|
939
|
+
serviceBookingForCreator ServiceBooking[] @relation("BookingCreator")
|
|
940
|
+
serviceBookingForUser ServiceBooking[] @relation("BookingForUser")
|
|
941
|
+
serviceBookingCheckout ServiceBookingCheckout[]
|
|
929
942
|
}
|
|
930
943
|
|
|
931
944
|
model Contact {
|
|
@@ -1124,7 +1137,7 @@ model Service {
|
|
|
1124
1137
|
visibility VisibilityPreference @default(Public)
|
|
1125
1138
|
|
|
1126
1139
|
bashesNotInterestedIn BashEventType[]
|
|
1127
|
-
bookings Booking[]
|
|
1140
|
+
// bookings Booking[]
|
|
1128
1141
|
media Media[]
|
|
1129
1142
|
serviceLinks ServiceLink[]
|
|
1130
1143
|
|
|
@@ -1144,6 +1157,7 @@ model Service {
|
|
|
1144
1157
|
|
|
1145
1158
|
bashEvent BashEvent[] // because a service needs to be associated with a bash to post to the bashfeed
|
|
1146
1159
|
userPromoCodeRedemption UserPromoCodeRedemption[]
|
|
1160
|
+
bookings ServiceBooking[]
|
|
1147
1161
|
}
|
|
1148
1162
|
|
|
1149
1163
|
model StripeAccount {
|
|
@@ -1295,6 +1309,7 @@ model Venue {
|
|
|
1295
1309
|
bashEvents BashEvent[]
|
|
1296
1310
|
}
|
|
1297
1311
|
|
|
1312
|
+
//currently used for 1 free service listing per user
|
|
1298
1313
|
model UserPromoCodeRedemption {
|
|
1299
1314
|
id String @id @default(cuid())
|
|
1300
1315
|
serviceId String?
|
|
@@ -1478,7 +1493,7 @@ model ServiceAddon {
|
|
|
1478
1493
|
id String @id @default(cuid())
|
|
1479
1494
|
name String
|
|
1480
1495
|
description String
|
|
1481
|
-
price Int
|
|
1496
|
+
price Int
|
|
1482
1497
|
quantity Int
|
|
1483
1498
|
|
|
1484
1499
|
servicePackage ServicePackage? @relation(fields: [servicePackageId], references: [id], onDelete: Cascade)
|
|
@@ -1486,6 +1501,7 @@ model ServiceAddon {
|
|
|
1486
1501
|
|
|
1487
1502
|
serviceRatesAssociation ServiceRatesAssociation? @relation(fields: [serviceRatesAssociationId], references: [id], onDelete: Cascade)
|
|
1488
1503
|
serviceRatesAssociationId String?
|
|
1504
|
+
ServiceBookingAddOn ServiceBookingAddOn[]
|
|
1489
1505
|
}
|
|
1490
1506
|
|
|
1491
1507
|
model ServicePackage {
|
|
@@ -1498,6 +1514,7 @@ model ServicePackage {
|
|
|
1498
1514
|
|
|
1499
1515
|
serviceRatesAssociation ServiceRatesAssociation? @relation(fields: [serviceRatesAssociationId], references: [id], onDelete: Cascade)
|
|
1500
1516
|
serviceRatesAssociationId String?
|
|
1517
|
+
ServiceBookingPackage ServiceBookingPackage[]
|
|
1501
1518
|
}
|
|
1502
1519
|
|
|
1503
1520
|
model ServiceRate {
|
|
@@ -1517,8 +1534,8 @@ model ServiceRate {
|
|
|
1517
1534
|
// if isAvailable is false it is closed
|
|
1518
1535
|
model ServiceSpecialRates {
|
|
1519
1536
|
id String @id @default(cuid())
|
|
1520
|
-
startDate DateTime
|
|
1521
|
-
endDate DateTime
|
|
1537
|
+
startDate DateTime //needs to be DateTime and not just Date because of timezone conversions
|
|
1538
|
+
endDate DateTime
|
|
1522
1539
|
|
|
1523
1540
|
serviceRateId String?
|
|
1524
1541
|
serviceRate ServiceRate? @relation(fields: [serviceRateId], references: [id], onDelete: Cascade)
|
|
@@ -1535,10 +1552,9 @@ model ServiceSpecialRates {
|
|
|
1535
1552
|
// can have special rates on different days of the year (single or range)
|
|
1536
1553
|
// free trial period with promo code (1 or 2 months of listing for free)
|
|
1537
1554
|
model ServiceDailyRates {
|
|
1538
|
-
id String
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
endTime DateTime @db.Time
|
|
1555
|
+
id String @id @default(cuid())
|
|
1556
|
+
startDate DateTime
|
|
1557
|
+
endDate DateTime
|
|
1542
1558
|
|
|
1543
1559
|
serviceRateId String?
|
|
1544
1560
|
serviceRate ServiceRate? @relation(fields: [serviceRateId], references: [id], onDelete: Cascade)
|
|
@@ -1573,6 +1589,140 @@ model ServiceRatesAssociation {
|
|
|
1573
1589
|
@@unique([serviceGeneralRatesId])
|
|
1574
1590
|
}
|
|
1575
1591
|
|
|
1592
|
+
// model ServiceTicket {
|
|
1593
|
+
// id String @id @default(cuid())
|
|
1594
|
+
// ownerId String
|
|
1595
|
+
// owner User @relation("TicketsIOwn", fields: [ownerId], references: [id])
|
|
1596
|
+
// bashEventId String
|
|
1597
|
+
// bashEvent BashEvent @relation(fields: [bashEventId], references: [id])
|
|
1598
|
+
// ticketTierId String?
|
|
1599
|
+
// ticketTier TicketTier? @relation(fields: [ticketTierId], references: [id])
|
|
1600
|
+
// validDate DateTime?
|
|
1601
|
+
// forUserId String?
|
|
1602
|
+
// forUser User? @relation("TicketsISent", fields: [forUserId], references: [id])
|
|
1603
|
+
// fullName String?
|
|
1604
|
+
// email String?
|
|
1605
|
+
// paidOn DateTime?
|
|
1606
|
+
// allowPromiseToPay Boolean?
|
|
1607
|
+
// status TicketStatus?
|
|
1608
|
+
// isFreeGuest Boolean?
|
|
1609
|
+
// geoFenceCheckInUnnecessary Boolean?
|
|
1610
|
+
// checkedInAt DateTime?
|
|
1611
|
+
// checkedOutAt DateTime?
|
|
1612
|
+
// invitationId String?
|
|
1613
|
+
// invitation Invitation? @relation("TicketsForInvitation", fields: [invitationId], references: [id])
|
|
1614
|
+
// checkoutId String?
|
|
1615
|
+
// checkout Checkout? @relation(fields: [checkoutId], references: [id])
|
|
1616
|
+
|
|
1617
|
+
// @@index([bashEventId])
|
|
1618
|
+
// }
|
|
1619
|
+
|
|
1620
|
+
// enum ServiceTicketStatus {
|
|
1621
|
+
// Cancelled
|
|
1622
|
+
// Attended
|
|
1623
|
+
// Missed
|
|
1624
|
+
// }
|
|
1625
|
+
|
|
1626
|
+
model ServiceBookingAddOn {
|
|
1627
|
+
id String @id @default(cuid())
|
|
1628
|
+
|
|
1629
|
+
serviceBookingDay ServiceBookingDay @relation(fields: [serviceBookingDayId], references: [id])
|
|
1630
|
+
serviceBookingDayId String
|
|
1631
|
+
|
|
1632
|
+
addOnId String
|
|
1633
|
+
addOn ServiceAddon @relation(fields: [addOnId], references: [id])
|
|
1634
|
+
chosenQuantity Int
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1637
|
+
model ServiceBookingPackage {
|
|
1638
|
+
id String @id @default(cuid())
|
|
1639
|
+
|
|
1640
|
+
serviceBookingDay ServiceBookingDay @relation(fields: [serviceBookingDayId], references: [id])
|
|
1641
|
+
serviceBookingDayId String
|
|
1642
|
+
|
|
1643
|
+
packageId String
|
|
1644
|
+
package ServicePackage @relation(fields: [packageId], references: [id])
|
|
1645
|
+
chosenQuantity Int
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
model ServiceBookingDay {
|
|
1649
|
+
id String @id @default(cuid())
|
|
1650
|
+
|
|
1651
|
+
serviceBookingRequest ServiceBooking? @relation(fields: [serviceBookingRequestId], references: [id])
|
|
1652
|
+
serviceBookingRequestId String?
|
|
1653
|
+
|
|
1654
|
+
startDate DateTime
|
|
1655
|
+
endDate DateTime
|
|
1656
|
+
|
|
1657
|
+
addOns ServiceBookingAddOn[]
|
|
1658
|
+
packages ServiceBookingPackage[]
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
model ServiceBooking {
|
|
1662
|
+
id String @id @default(cuid())
|
|
1663
|
+
|
|
1664
|
+
creatorId String
|
|
1665
|
+
creator User @relation("BookingCreator", fields: [creatorId], references: [id], onDelete: Cascade)
|
|
1666
|
+
|
|
1667
|
+
forUserId String
|
|
1668
|
+
forUser User @relation("BookingForUser", fields: [forUserId], references: [id], onDelete: Cascade)
|
|
1669
|
+
|
|
1670
|
+
bookedDays ServiceBookingDay[]
|
|
1671
|
+
|
|
1672
|
+
serviceId String
|
|
1673
|
+
service Service @relation(fields: [serviceId], references: [id], onDelete: Cascade)
|
|
1674
|
+
|
|
1675
|
+
status ServiceBookingStatus @default(Pending)
|
|
1676
|
+
bookingType ServiceBookingType @default(Request)
|
|
1677
|
+
|
|
1678
|
+
requestedOn DateTime?
|
|
1679
|
+
confirmedOn DateTime?
|
|
1680
|
+
paidOn DateTime?
|
|
1681
|
+
refundedOn DateTime?
|
|
1682
|
+
|
|
1683
|
+
isFreeGuest Boolean @default(false)
|
|
1684
|
+
allowPromiseToPay Boolean @default(false)
|
|
1685
|
+
|
|
1686
|
+
totalAmount Int //stored in cents
|
|
1687
|
+
depositAmount Int
|
|
1688
|
+
checkout ServiceBookingCheckout?
|
|
1689
|
+
|
|
1690
|
+
@@index([status])
|
|
1691
|
+
@@index([creatorId])
|
|
1692
|
+
@@index([forUserId])
|
|
1693
|
+
}
|
|
1694
|
+
|
|
1695
|
+
model ServiceBookingCheckout {
|
|
1696
|
+
id String @id @default(cuid())
|
|
1697
|
+
|
|
1698
|
+
bookingDataId String @unique
|
|
1699
|
+
bookingData ServiceBooking @relation(fields: [bookingDataId], references: [id], onDelete: Cascade)
|
|
1700
|
+
|
|
1701
|
+
creatorId String
|
|
1702
|
+
creator User @relation(fields: [creatorId], references: [id], onDelete: Cascade)
|
|
1703
|
+
|
|
1704
|
+
checkoutDateTime DateTime? @default(now())
|
|
1705
|
+
stripeCheckoutSessionId String? @unique
|
|
1706
|
+
|
|
1707
|
+
totalAmount Int //stored in cents
|
|
1708
|
+
depositAmount Int
|
|
1709
|
+
|
|
1710
|
+
@@index(creatorId)
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1713
|
+
enum ServiceBookingStatus {
|
|
1714
|
+
Pending //pending request
|
|
1715
|
+
Approved //approved request
|
|
1716
|
+
Rejected //rejected request
|
|
1717
|
+
Confirmed //when payment is complete
|
|
1718
|
+
Canceled //canceled request or booking
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
enum ServiceBookingType {
|
|
1722
|
+
Request
|
|
1723
|
+
Instant
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1576
1726
|
enum VisibilityPreference {
|
|
1577
1727
|
Public
|
|
1578
1728
|
Private
|