@bash-app/bash-common 29.49.0 → 29.51.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bash-app/bash-common",
3
- "version": "29.49.0",
3
+ "version": "29.51.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",
@@ -26,9 +26,9 @@
26
26
  "qrcode": "^1.5.3"
27
27
  },
28
28
  "peerDependencies": {
29
- "@prisma/client": "^5.18.0",
29
+ "@prisma/client": "^6.1.0",
30
30
  "dayjs": "^1.11.13",
31
- "prisma": "^5.18.0",
31
+ "prisma": "^6.1.0",
32
32
  "react-tailwindcss-datepicker": "^1.6.6",
33
33
  "tsx": "^4.10.3"
34
34
  },
@@ -187,20 +187,20 @@ model Invitation {
187
187
  }
188
188
 
189
189
  model BashEvent {
190
- id String @id @default(cuid())
190
+ id String @id @default(cuid())
191
191
  title String
192
192
  creatorId String
193
- creator User @relation("CreatedEvent", fields: [creatorId], references: [id], onDelete: Cascade)
193
+ creator User @relation("CreatedEvent", fields: [creatorId], references: [id], onDelete: Cascade)
194
194
  isApproved Boolean?
195
195
  description String?
196
- eventType String @default("Other")
197
- startDateTime DateTime? @default(now())
198
- endDateTime DateTime? @default(now())
196
+ eventType String @default("Other")
197
+ startDateTime DateTime? @default(now())
198
+ endDateTime DateTime? @default(now())
199
199
  ticketTiers TicketTier[]
200
- targetAudienceId String? @unique
201
- targetAudience TargetAudience? @relation(fields: [targetAudienceId], references: [id], onDelete: Cascade)
202
- amountOfGuestsId String? @unique
203
- amountOfGuests AmountOfGuests? @relation(fields: [amountOfGuestsId], references: [id], onDelete: Cascade)
200
+ targetAudienceId String? @unique
201
+ targetAudience TargetAudience? @relation(fields: [targetAudienceId], references: [id], onDelete: Cascade)
202
+ amountOfGuestsId String? @unique
203
+ amountOfGuests AmountOfGuests? @relation(fields: [amountOfGuestsId], references: [id], onDelete: Cascade)
204
204
  recurrence Recurrence?
205
205
  vibe String?
206
206
  occasion String?
@@ -209,18 +209,18 @@ model BashEvent {
209
209
  notAllowed String?
210
210
  nonProfit Boolean?
211
211
  nonProfitId String?
212
- privacy Privacy @default(Public)
212
+ privacy Privacy @default(Public)
213
213
  tickets Ticket[]
214
214
  reviews Review[]
215
215
  sponsorships SponsoredEvent[]
216
216
  investments Investment[]
217
217
  capacity Int?
218
218
  location String?
219
- status BashStatus @default(Draft)
219
+ status BashStatus @default(Draft)
220
220
  tags String[]
221
221
  coverPhoto String?
222
222
  media Media[]
223
- club Club? @relation(fields: [clubId], references: [id], onDelete: SetNull)
223
+ club Club? @relation(fields: [clubId], references: [id], onDelete: SetNull)
224
224
  clubId String?
225
225
  links EventLink[]
226
226
  competitions Competition[]
@@ -241,7 +241,9 @@ model BashEvent {
241
241
  // stripeAccount StripeAccount[]
242
242
  // rate Rate[]
243
243
  venueId String? // Nullable, meaning it's optional
244
- venue Venue? @relation(fields: [venueId], references: [id])
244
+ venue Venue? @relation(fields: [venueId], references: [id])
245
+ userPromoCodeRedemption UserPromoCodeRedemption[]
246
+ averageRating Float? @default(0)
245
247
  }
246
248
 
247
249
  model Coordinates {
@@ -627,6 +629,12 @@ enum ServiceCondition {
627
629
  Deactivated
628
630
  }
629
631
 
632
+ enum ServiceSubscriptionStatus {
633
+ None
634
+ Trialing
635
+ Normal
636
+ }
637
+
630
638
  enum VolunteerServiceStatus {
631
639
  Draft
632
640
  Pending
@@ -748,6 +756,10 @@ model Review {
748
756
  bashEventId String
749
757
  bashEvent BashEvent @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
750
758
  comments BashComment[]
759
+ createdAt DateTime @default(now()) // Add this for timestamps
760
+ updatedAt DateTime @updatedAt
761
+
762
+ @@unique([creatorId, bashEventId])
751
763
  }
752
764
 
753
765
  model GoogleReview {
@@ -833,12 +845,13 @@ enum SocialMediaPlatform {
833
845
  }
834
846
 
835
847
  model User {
836
- id String @id @default(cuid())
837
- email String @unique
838
- createdOn DateTime @default(now())
839
- stripeCustomerId String? @unique
840
- stripeAccountId String? @unique
841
- isSuperUser Boolean @default(false)
848
+ id String @id @default(cuid())
849
+ email String @unique
850
+ createdOn DateTime @default(now())
851
+ stripeCustomerId String? @unique
852
+ stripeAccountId String? @unique
853
+ isSuperUser Boolean @default(false)
854
+ isSuspended Boolean @default(false)
842
855
  googleCalendarAccess String?
843
856
  givenName String?
844
857
  familyName String?
@@ -849,12 +862,12 @@ model User {
849
862
  dob DateTime?
850
863
  gender Gender?
851
864
  sex Sex?
852
- roles UserRole[] @default([User])
853
- ownedServices Service[] @relation("OwnedService")
854
- createdServices Service[] @relation("CreatedService")
855
- createdEvents BashEvent[] @relation("CreatedEvent")
856
- ticketsISent Ticket[] @relation("TicketsISent")
857
- ticketsIOwn Ticket[] @relation("TicketsIOwn")
865
+ roles UserRole[] @default([User])
866
+ ownedServices Service[] @relation("OwnedService")
867
+ createdServices Service[] @relation("CreatedService")
868
+ createdEvents BashEvent[] @relation("CreatedEvent")
869
+ ticketsISent Ticket[] @relation("TicketsISent")
870
+ ticketsIOwn Ticket[] @relation("TicketsIOwn")
858
871
  reviews Review[]
859
872
  sponsorships SponsoredEvent[]
860
873
  investments Investment[]
@@ -869,6 +882,8 @@ model User {
869
882
  competitionPrizes Prize[]
870
883
  userRatingGiven UserRatingGiven[]
871
884
  userRating UserRating[]
885
+ hostRating Float?
886
+ totalRatings Int?
872
887
  magicLink String?
873
888
  magicLinkExpiration DateTime?
874
889
  magicLinkUsed DateTime?
@@ -877,20 +892,20 @@ model User {
877
892
  city String?
878
893
  state String?
879
894
  zipCode String?
880
- country String? @default("US")
895
+ country String? @default("US")
881
896
  phone String?
882
897
  socialMediaProfiles SocialMediaProfile[]
883
- documentIDId String? @unique
898
+ documentIDId String? @unique
884
899
  documentID DocumentID?
885
900
  comment BashComment[]
886
901
  associatedBashes AssociatedBash[]
887
902
  associatedServices AssociatedService[]
888
- invitationsCreatedByMe Invitation[] @relation("InvitationsCreatedByMe")
889
- invitationsSentToMe Invitation[] @relation("InvitationsSentToMe")
890
- notificationsCreatedByMe BashNotification[] @relation("NotificationsCreatedByMe")
891
- remindersCreatedByMe Reminder[] @relation("RemindersCreatedByMe")
892
- remindersAssignedToMe Reminder[] @relation("RemindersAssignedToMe")
893
- eventTasksAssignedToMe EventTask[] @relation("TasksAssignedToMe")
903
+ invitationsCreatedByMe Invitation[] @relation("InvitationsCreatedByMe")
904
+ invitationsSentToMe Invitation[] @relation("InvitationsSentToMe")
905
+ notificationsCreatedByMe BashNotification[] @relation("NotificationsCreatedByMe")
906
+ remindersCreatedByMe Reminder[] @relation("RemindersCreatedByMe")
907
+ remindersAssignedToMe Reminder[] @relation("RemindersAssignedToMe")
908
+ eventTasksAssignedToMe EventTask[] @relation("TasksAssignedToMe")
894
909
  checkouts Checkout[]
895
910
  ticketTiersWaitListsIveJoined TicketTier[]
896
911
  contacts Contact[]
@@ -901,7 +916,10 @@ model User {
901
916
  // serviceSubcriptions ServiceSubscription[]
902
917
  volunteerService VolunteerService[]
903
918
  stripeAccounts StripeAccount[]
904
- servicePromoCodeRedemption ServicePromoCodeRedemption[]
919
+ userPromoCodeRedemption UserPromoCodeRedemption[]
920
+
921
+ // primaryStripeAccountDBId String? @unique
922
+ // primaryStripeAccountDB StripeAccount? @relation("PrimaryStripeAccount", fields: [primaryStripeAccountDBId], references: [id], onDelete: Restrict, onUpdate: Restrict)
905
923
  }
906
924
 
907
925
  model Contact {
@@ -973,16 +991,26 @@ enum UserSubscriptionStatus {
973
991
  }
974
992
 
975
993
  enum UserSubscriptionType {
976
- Free
994
+ // Free
977
995
  Basic
978
- Premium
979
- VIP
996
+ // Premium
997
+ // VIP
980
998
  }
981
999
 
982
- enum ServiceSubscriptionTier {
983
- Basic
984
- Premium
985
- VIP
1000
+ // enum ServiceSubscriptionTier {
1001
+ // Ally
1002
+ // Partner
1003
+ // Patreon
1004
+ // }
1005
+
1006
+ model ServiceSubscriptionCounts {
1007
+ id String @id @default(cuid())
1008
+
1009
+ allyCount Int @default(0)
1010
+ partnerCount Int @default(0)
1011
+ patronCount Int @default(0)
1012
+ subscriptionCount UserSubscription? @relation("subscriptionCount")
1013
+ listedCount UserSubscription? @relation("listedCount")
986
1014
  }
987
1015
 
988
1016
  model UserSubscription {
@@ -994,15 +1022,29 @@ model UserSubscription {
994
1022
  stripeAccountId String @unique
995
1023
  stripeAccount StripeAccount @relation(fields: [stripeAccountId], references: [id], onDelete: Restrict, onUpdate: Restrict)
996
1024
 
997
- stripeCheckoutSessionId String? @unique
998
1025
  stripeSubscriptionId String? @unique
1026
+ stripeCheckoutSessionId String? @unique //used to set default payment method if one does not already exist on the customer
999
1027
 
1000
1028
  type UserSubscriptionType?
1001
1029
  status UserSubscriptionStatus?
1002
1030
 
1003
1031
  //price addons
1004
- serviceSubscriptionTier ServiceSubscriptionTier?
1032
+ // serviceSubscriptionTier ServiceSubscriptionTier?
1033
+ subscriptionCountId String @unique
1034
+ subscriptionCount ServiceSubscriptionCounts @relation("subscriptionCount", fields: [subscriptionCountId], references: [id], onDelete: Cascade)
1035
+
1036
+ listedCountId String @unique
1037
+ listedCount ServiceSubscriptionCounts @relation("listedCount", fields: [listedCountId], references: [id], onDelete: Cascade)
1005
1038
 
1039
+ // allySubscriptionCount Int @default(0)
1040
+ // partnerSubscriptionCount Int @default(0)
1041
+ // patreonSubscriptionCount Int @default(0)
1042
+
1043
+ // allyServicesListed Int @default(0)
1044
+ // partnerServicesListed Int @default(0)
1045
+ // patreonServicesListed Int @default(0)
1046
+
1047
+ @@index([ownerId])
1006
1048
  @@index([stripeCheckoutSessionId])
1007
1049
  @@index([stripeSubscriptionId])
1008
1050
  }
@@ -1011,9 +1053,10 @@ model UserSubscription {
1011
1053
  model Service {
1012
1054
  id String @id @default(cuid())
1013
1055
 
1014
- serviceType ServiceTypes?
1015
- serviceStatus ServiceStatus @default(Draft)
1016
- serviceCondition ServiceCondition @default(Pending)
1056
+ serviceType ServiceTypes?
1057
+ serviceStatus ServiceStatus @default(Draft)
1058
+ serviceCondition ServiceCondition @default(Pending)
1059
+ subscriptionStatus ServiceSubscriptionStatus @default(None)
1017
1060
 
1018
1061
  isApproved Boolean @default(false)
1019
1062
 
@@ -1093,8 +1136,8 @@ model Service {
1093
1136
 
1094
1137
  // googleReviews GoogleReview[]
1095
1138
 
1096
- bashEvent BashEvent[] // because a service needs to be associated with a bash to post to the bashfeed
1097
- servicePromoCodeRedemption ServicePromoCodeRedemption[]
1139
+ bashEvent BashEvent[] // because a service needs to be associated with a bash to post to the bashfeed
1140
+ userPromoCodeRedemption UserPromoCodeRedemption[]
1098
1141
  }
1099
1142
 
1100
1143
  model StripeAccount {
@@ -1246,11 +1289,14 @@ model Venue {
1246
1289
  bashEvents BashEvent[]
1247
1290
  }
1248
1291
 
1249
- model ServicePromoCodeRedemption {
1292
+ model UserPromoCodeRedemption {
1250
1293
  id String @id @default(cuid())
1251
1294
  serviceId String?
1252
1295
  service Service? @relation(fields: [serviceId], references: [id], onDelete: Cascade)
1253
1296
 
1297
+ bashEventId String?
1298
+ bashEvent BashEvent? @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
1299
+
1254
1300
  userId String?
1255
1301
  user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
1256
1302
 
@@ -0,0 +1,31 @@
1
+ # run this script after any schema change to make sure the typescript defintions are updated or
2
+ #... or if npm i is run on any of the repos, as it may overwrite the symlink
3
+
4
+ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
5
+
6
+ PATH_TO_PARENT_DIR="../.."
7
+ NODE_MODULES_PATH="node_modules/@bash-app"
8
+ FRONT_END_TARGET="$SCRIPT_DIR/$PATH_TO_PARENT_DIR/bash-app"
9
+ API_TARGET="$SCRIPT_DIR/$PATH_TO_PARENT_DIR/api"
10
+
11
+ TARGETS=(
12
+ $FRONT_END_TARGET
13
+ $API_TARGET
14
+ )
15
+
16
+ BASH_COMMON_TARGET="$SCRIPT_DIR/$PATH_TO_PARENT_DIR/bash-common"
17
+
18
+ echo "FRONT_END_TARGET: $FRONT_END_TARGET"
19
+ echo "API_TARGET: $API_TARGET"
20
+ echo "BASH_COMMON_TARGET: $BASH_COMMON_TARGET"
21
+ printf "\n\n"
22
+
23
+ cd $BASH_COMMON_TARGET && npx prisma generate
24
+
25
+ for TARGET in "${TARGETS[@]}"; do
26
+ rm -rf "$TARGET/$NODE_MODULES_PATH"
27
+ mkdir -p "$TARGET/$NODE_MODULES_PATH"
28
+
29
+ ln -s "$BASH_COMMON_TARGET" "$TARGET/$NODE_MODULES_PATH"
30
+ cd $TARGET && cp -rf "./$NODE_MODULES_PATH/bash-common/prisma" . && npm run generate
31
+ done