@bash-app/bash-common 29.67.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 +206 -64
- package/src/definitions.ts +129 -72
- package/src/extendedSchemas.ts +160 -105
- package/src/index.ts +9 -1
- package/src/utils/generalDateTimeUtils.ts +43 -0
- package/src/utils/luxonUtils.ts +885 -0
- 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
|
@@ -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 {
|
|
@@ -862,7 +866,7 @@ model User {
|
|
|
862
866
|
stripeAccountId String? @unique
|
|
863
867
|
isSuperUser Boolean @default(false)
|
|
864
868
|
// isSuspended Boolean @default(false)
|
|
865
|
-
intent
|
|
869
|
+
intent UserIntent?
|
|
866
870
|
googleCalendarAccess String?
|
|
867
871
|
givenName String?
|
|
868
872
|
familyName String?
|
|
@@ -919,8 +923,7 @@ model User {
|
|
|
919
923
|
ticketTiersWaitListsIveJoined TicketTier[]
|
|
920
924
|
contacts Contact[]
|
|
921
925
|
bashEventPromoCodesIUsed BashEventPromoCode[]
|
|
922
|
-
|
|
923
|
-
bookingForMe Booking[]
|
|
926
|
+
// bookingForMe Booking[]
|
|
924
927
|
userSubscription UserSubscription?
|
|
925
928
|
// serviceSubcriptions ServiceSubscription[]
|
|
926
929
|
volunteerService VolunteerService[]
|
|
@@ -933,6 +936,9 @@ model User {
|
|
|
933
936
|
|
|
934
937
|
// primaryStripeAccountDBId String? @unique
|
|
935
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[]
|
|
936
942
|
}
|
|
937
943
|
|
|
938
944
|
model Contact {
|
|
@@ -1131,7 +1137,7 @@ model Service {
|
|
|
1131
1137
|
visibility VisibilityPreference @default(Public)
|
|
1132
1138
|
|
|
1133
1139
|
bashesNotInterestedIn BashEventType[]
|
|
1134
|
-
bookings Booking[]
|
|
1140
|
+
// bookings Booking[]
|
|
1135
1141
|
media Media[]
|
|
1136
1142
|
serviceLinks ServiceLink[]
|
|
1137
1143
|
|
|
@@ -1151,6 +1157,7 @@ model Service {
|
|
|
1151
1157
|
|
|
1152
1158
|
bashEvent BashEvent[] // because a service needs to be associated with a bash to post to the bashfeed
|
|
1153
1159
|
userPromoCodeRedemption UserPromoCodeRedemption[]
|
|
1160
|
+
bookings ServiceBooking[]
|
|
1154
1161
|
}
|
|
1155
1162
|
|
|
1156
1163
|
model StripeAccount {
|
|
@@ -1302,6 +1309,7 @@ model Venue {
|
|
|
1302
1309
|
bashEvents BashEvent[]
|
|
1303
1310
|
}
|
|
1304
1311
|
|
|
1312
|
+
//currently used for 1 free service listing per user
|
|
1305
1313
|
model UserPromoCodeRedemption {
|
|
1306
1314
|
id String @id @default(cuid())
|
|
1307
1315
|
serviceId String?
|
|
@@ -1485,7 +1493,7 @@ model ServiceAddon {
|
|
|
1485
1493
|
id String @id @default(cuid())
|
|
1486
1494
|
name String
|
|
1487
1495
|
description String
|
|
1488
|
-
price Int
|
|
1496
|
+
price Int
|
|
1489
1497
|
quantity Int
|
|
1490
1498
|
|
|
1491
1499
|
servicePackage ServicePackage? @relation(fields: [servicePackageId], references: [id], onDelete: Cascade)
|
|
@@ -1493,6 +1501,7 @@ model ServiceAddon {
|
|
|
1493
1501
|
|
|
1494
1502
|
serviceRatesAssociation ServiceRatesAssociation? @relation(fields: [serviceRatesAssociationId], references: [id], onDelete: Cascade)
|
|
1495
1503
|
serviceRatesAssociationId String?
|
|
1504
|
+
ServiceBookingAddOn ServiceBookingAddOn[]
|
|
1496
1505
|
}
|
|
1497
1506
|
|
|
1498
1507
|
model ServicePackage {
|
|
@@ -1505,6 +1514,7 @@ model ServicePackage {
|
|
|
1505
1514
|
|
|
1506
1515
|
serviceRatesAssociation ServiceRatesAssociation? @relation(fields: [serviceRatesAssociationId], references: [id], onDelete: Cascade)
|
|
1507
1516
|
serviceRatesAssociationId String?
|
|
1517
|
+
ServiceBookingPackage ServiceBookingPackage[]
|
|
1508
1518
|
}
|
|
1509
1519
|
|
|
1510
1520
|
model ServiceRate {
|
|
@@ -1542,11 +1552,9 @@ model ServiceSpecialRates {
|
|
|
1542
1552
|
// can have special rates on different days of the year (single or range)
|
|
1543
1553
|
// free trial period with promo code (1 or 2 months of listing for free)
|
|
1544
1554
|
model ServiceDailyRates {
|
|
1545
|
-
id
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
endDayOfWeek DayOfWeek
|
|
1549
|
-
endTime DateTime @db.Time
|
|
1555
|
+
id String @id @default(cuid())
|
|
1556
|
+
startDate DateTime
|
|
1557
|
+
endDate DateTime
|
|
1550
1558
|
|
|
1551
1559
|
serviceRateId String?
|
|
1552
1560
|
serviceRate ServiceRate? @relation(fields: [serviceRateId], references: [id], onDelete: Cascade)
|
|
@@ -1581,6 +1589,140 @@ model ServiceRatesAssociation {
|
|
|
1581
1589
|
@@unique([serviceGeneralRatesId])
|
|
1582
1590
|
}
|
|
1583
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
|
+
|
|
1584
1726
|
enum VisibilityPreference {
|
|
1585
1727
|
Public
|
|
1586
1728
|
Private
|