@bash-app/bash-common 29.35.3 → 29.36.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.35.3",
3
+ "version": "29.36.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",
@@ -816,50 +816,13 @@ enum SponsorType {
816
816
  CompetitionPrizeProvider
817
817
  }
818
818
 
819
- model SocialMediaProfile {
820
- id String @id @default(uuid())
821
- platform SocialMediaPlatform
822
- url String
823
- visibility VisibilityPreference @default(Private)
824
- user User @relation(fields: [userId], references: [id])
825
- userId String
826
-
827
- @@unique([userId, platform])
828
- }
829
-
830
- enum SocialMediaPlatform {
831
- Facebook
832
- Instagram
833
- LinkedIn
834
- TikTok
835
- X
836
- YouTube
837
- Snapchat
838
- Pinterest
839
- Reddit
840
- WhatsApp
841
- Messenger
842
- Telegram
843
- Discord
844
- Clubhouse
845
- Twitch
846
- Medium
847
- BeReal
848
- Mastodon
849
- Tumblr
850
- Threads
851
- WeChat
852
- Vk
853
- Line
854
- }
855
-
856
819
  model User {
857
- id String @id @default(cuid())
858
- email String @unique
859
- createdOn DateTime @default(now())
860
- stripeCustomerId String? @unique
861
- stripeAccountId String? @unique
862
- isSuperUser Boolean @default(false)
820
+ id String @id @default(cuid())
821
+ email String @unique
822
+ createdOn DateTime @default(now())
823
+ stripeCustomerId String? @unique
824
+ stripeAccountId String? @unique
825
+ isSuperUser Boolean @default(false)
863
826
  googleCalendarAccess String?
864
827
  givenName String?
865
828
  familyName String?
@@ -870,12 +833,12 @@ model User {
870
833
  dob DateTime?
871
834
  gender Gender?
872
835
  sex Sex?
873
- roles UserRole[] @default([User])
874
- ownedServices Service[] @relation("OwnedService")
875
- createdServices Service[] @relation("CreatedService")
876
- createdEvents BashEvent[] @relation("CreatedEvent")
877
- ticketsISent Ticket[] @relation("TicketsISent")
878
- ticketsIOwn Ticket[] @relation("TicketsIOwn")
836
+ roles UserRole[] @default([User])
837
+ ownedServices Service[] @relation("OwnedService")
838
+ createdServices Service[] @relation("CreatedService")
839
+ createdEvents BashEvent[] @relation("CreatedEvent")
840
+ ticketsISent Ticket[] @relation("TicketsISent")
841
+ ticketsIOwn Ticket[] @relation("TicketsIOwn")
879
842
  reviews Review[]
880
843
  sponsorships SponsoredEvent[]
881
844
  investments Investment[]
@@ -898,20 +861,19 @@ model User {
898
861
  city String?
899
862
  state String?
900
863
  zipCode String?
901
- country String? @default("US")
864
+ country String? @default("US")
902
865
  phone String?
903
- socialMediaProfiles SocialMediaProfile[]
904
- documentIDId String? @unique
866
+ documentIDId String? @unique
905
867
  documentID DocumentID?
906
868
  comment BashComment[]
907
869
  associatedBashes AssociatedBash[]
908
870
  associatedServices AssociatedService[]
909
- invitationsCreatedByMe Invitation[] @relation("InvitationsCreatedByMe")
910
- invitationsSentToMe Invitation[] @relation("InvitationsSentToMe")
911
- notificationsCreatedByMe BashNotification[] @relation("NotificationsCreatedByMe")
912
- remindersCreatedByMe Reminder[] @relation("RemindersCreatedByMe")
913
- remindersAssignedToMe Reminder[] @relation("RemindersAssignedToMe")
914
- eventTasksAssignedToMe EventTask[] @relation("TasksAssignedToMe")
871
+ invitationsCreatedByMe Invitation[] @relation("InvitationsCreatedByMe")
872
+ invitationsSentToMe Invitation[] @relation("InvitationsSentToMe")
873
+ notificationsCreatedByMe BashNotification[] @relation("NotificationsCreatedByMe")
874
+ remindersCreatedByMe Reminder[] @relation("RemindersCreatedByMe")
875
+ remindersAssignedToMe Reminder[] @relation("RemindersAssignedToMe")
876
+ eventTasksAssignedToMe EventTask[] @relation("TasksAssignedToMe")
915
877
  checkouts Checkout[]
916
878
  ticketTiersWaitListsIveJoined TicketTier[]
917
879
  contacts Contact[]
@@ -922,6 +884,7 @@ model User {
922
884
  serviceSubcriptions ServiceSubscription[]
923
885
  volunteerService VolunteerService[]
924
886
  stripeAccounts StripeAccount[]
887
+ ServicePromoCodeRedemption ServicePromoCodeRedemption[]
925
888
  }
926
889
 
927
890
  model Contact {
@@ -1063,7 +1026,8 @@ model Service {
1063
1026
 
1064
1027
  // googleReviews GoogleReview[]
1065
1028
 
1066
- bashEvent BashEvent[] // because a service needs to be associated with a bash to post to the bashfeed
1029
+ bashEvent BashEvent[] // because a service needs to be associated with a bash to post to the bashfeed
1030
+ servicePromoCodeRedemption ServicePromoCodeRedemption[]
1067
1031
  }
1068
1032
 
1069
1033
  model StripeAccount {
@@ -1072,7 +1036,8 @@ model StripeAccount {
1072
1036
  ownerId String
1073
1037
  owner User @relation(fields: [ownerId], references: [id], onDelete: Restrict)
1074
1038
 
1075
- stripeAccountId String
1039
+ stripeAccountId String @unique
1040
+ stripeCustomerId String? @unique
1076
1041
 
1077
1042
  logoId String?
1078
1043
  logo Media? @relation(fields: [logoId], references: [id], onDelete: SetNull)
@@ -1213,6 +1178,21 @@ model Venue {
1213
1178
  bashEvents BashEvent[]
1214
1179
  }
1215
1180
 
1181
+ model ServicePromoCodeRedemption {
1182
+ id String @id @default(cuid())
1183
+ serviceId String?
1184
+ service Service? @relation(fields: [serviceId], references: [id], onDelete: Cascade)
1185
+
1186
+ userId String?
1187
+ user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
1188
+
1189
+ code String
1190
+ stripeCouponId String
1191
+ redemptionCount Int
1192
+
1193
+ lastRedeemedOn DateTime
1194
+ }
1195
+
1216
1196
  // model VenuePricing {
1217
1197
  // id String @id @default(cuid())
1218
1198
  // venuePricingPlan VenuePricingPlan
@@ -283,6 +283,14 @@ export interface StripeCreateBashEventDonationCheckoutSessionArgs {
283
283
  donationAmount: number;
284
284
  }
285
285
 
286
+ export interface StripeCreateServiceSubscriptionCheckoutSessionArgs {
287
+ serviceId: string;
288
+ currency: string;
289
+ paymentMethodType: string;
290
+ promoCode?: string;
291
+ }
292
+
293
+
286
294
  export type StripeSessionRedirect = {
287
295
  stripeAccountIdDB: string;
288
296
  redirectUrl: string;
@@ -36,7 +36,6 @@ import {
36
36
  ServiceSpecialRates,
37
37
  ServiceAddon,
38
38
  ServicePackage,
39
- SocialMediaProfile,
40
39
  } from "@prisma/client";
41
40
  import { SERVICE_LINK_DATA_TO_INCLUDE, UnionFromArray, VENUE_DATA_TO_INCLUDE } from "./definitions";
42
41
 
@@ -511,7 +510,6 @@ export interface UserExt extends User {
511
510
  ticketsIOwn?: TicketExt[] | null;
512
511
  ownedServices?: ServiceExt[];
513
512
  createdServices?: ServiceExt[];
514
- socialMediaProfiles?: SocialMediaProfile[] | null;
515
513
  }
516
514
 
517
515
  export const USER_DATA_SELECT_REVIEWS_COMMENTS = {
@@ -98,4 +98,22 @@ function generateDescription(refundPolicy: ServiceCancelationRefundPolicy[]): st
98
98
  Object.keys(ServiceCancelationPolicyData).filter((policyKey) => policyKey as ServiceCancelationPolicyOption != ServiceCancelationPolicyOption.None).forEach((policyKey) => {
99
99
  const policy = ServiceCancelationPolicyData[policyKey as ServiceCancelationPolicyOption];
100
100
  policy.description = generateDescription(policy.refundPolicy);
101
- });
101
+ });
102
+
103
+ export type ServicePromoCodeType = "PerUser" | "PerService";
104
+
105
+ export type ServicePromoCode = {
106
+ code?: string;
107
+ maxRedemptions?: number;
108
+ isTrial?: boolean;
109
+ discountPercentageFee?: number;
110
+ discountMonthlyFee?: number;
111
+ duration: {
112
+ days?: number;
113
+ },
114
+ type: ServicePromoCodeType;
115
+ };
116
+
117
+ export type ServicePromoCodeMap = {
118
+ [key: string]: ServicePromoCode;
119
+ };
@@ -1,4 +1,5 @@
1
1
  import { VenuePricingPlan as VenuePricingPlanOption } from "@prisma/client";
2
+ import { ServicePromoCodeMap } from "./serviceUtils";
2
3
 
3
4
  export type VenuePricingPlanData = {
4
5
  name: string,
@@ -27,4 +28,16 @@ export const VenuePricingPlanData: VenuePricingPlanMap = {
27
28
  monthlyFee: 100.0,
28
29
  flatFee: 0.0
29
30
  }
30
- } as const;
31
+ } as const;
32
+
33
+ export const VenuePromoCodes: ServicePromoCodeMap = {
34
+ "Vnue3345": {
35
+ isTrial: true,
36
+ duration: {
37
+ days: 90
38
+ },
39
+ type: "PerUser"
40
+ }
41
+ };
42
+
43
+ Object.entries(VenuePromoCodes).forEach(promoCode => promoCode[1].code = promoCode[0]);