@bash-app/bash-common 29.49.0 → 29.50.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.50.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",
@@ -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,8 @@ 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[]
245
246
  }
246
247
 
247
248
  model Coordinates {
@@ -833,12 +834,12 @@ enum SocialMediaPlatform {
833
834
  }
834
835
 
835
836
  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)
837
+ id String @id @default(cuid())
838
+ email String @unique
839
+ createdOn DateTime @default(now())
840
+ stripeCustomerId String? @unique
841
+ stripeAccountId String? @unique
842
+ isSuperUser Boolean @default(false)
842
843
  googleCalendarAccess String?
843
844
  givenName String?
844
845
  familyName String?
@@ -849,12 +850,12 @@ model User {
849
850
  dob DateTime?
850
851
  gender Gender?
851
852
  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")
853
+ roles UserRole[] @default([User])
854
+ ownedServices Service[] @relation("OwnedService")
855
+ createdServices Service[] @relation("CreatedService")
856
+ createdEvents BashEvent[] @relation("CreatedEvent")
857
+ ticketsISent Ticket[] @relation("TicketsISent")
858
+ ticketsIOwn Ticket[] @relation("TicketsIOwn")
858
859
  reviews Review[]
859
860
  sponsorships SponsoredEvent[]
860
861
  investments Investment[]
@@ -877,20 +878,20 @@ model User {
877
878
  city String?
878
879
  state String?
879
880
  zipCode String?
880
- country String? @default("US")
881
+ country String? @default("US")
881
882
  phone String?
882
883
  socialMediaProfiles SocialMediaProfile[]
883
- documentIDId String? @unique
884
+ documentIDId String? @unique
884
885
  documentID DocumentID?
885
886
  comment BashComment[]
886
887
  associatedBashes AssociatedBash[]
887
888
  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")
889
+ invitationsCreatedByMe Invitation[] @relation("InvitationsCreatedByMe")
890
+ invitationsSentToMe Invitation[] @relation("InvitationsSentToMe")
891
+ notificationsCreatedByMe BashNotification[] @relation("NotificationsCreatedByMe")
892
+ remindersCreatedByMe Reminder[] @relation("RemindersCreatedByMe")
893
+ remindersAssignedToMe Reminder[] @relation("RemindersAssignedToMe")
894
+ eventTasksAssignedToMe EventTask[] @relation("TasksAssignedToMe")
894
895
  checkouts Checkout[]
895
896
  ticketTiersWaitListsIveJoined TicketTier[]
896
897
  contacts Contact[]
@@ -901,7 +902,7 @@ model User {
901
902
  // serviceSubcriptions ServiceSubscription[]
902
903
  volunteerService VolunteerService[]
903
904
  stripeAccounts StripeAccount[]
904
- servicePromoCodeRedemption ServicePromoCodeRedemption[]
905
+ userPromoCodeRedemption UserPromoCodeRedemption[]
905
906
  }
906
907
 
907
908
  model Contact {
@@ -973,16 +974,16 @@ enum UserSubscriptionStatus {
973
974
  }
974
975
 
975
976
  enum UserSubscriptionType {
976
- Free
977
+ // Free
977
978
  Basic
978
- Premium
979
- VIP
979
+ // Premium
980
+ // VIP
980
981
  }
981
982
 
982
983
  enum ServiceSubscriptionTier {
983
- Basic
984
- Premium
985
- VIP
984
+ Ally
985
+ Partner
986
+ Patreon
986
987
  }
987
988
 
988
989
  model UserSubscription {
@@ -1093,8 +1094,8 @@ model Service {
1093
1094
 
1094
1095
  // googleReviews GoogleReview[]
1095
1096
 
1096
- bashEvent BashEvent[] // because a service needs to be associated with a bash to post to the bashfeed
1097
- servicePromoCodeRedemption ServicePromoCodeRedemption[]
1097
+ bashEvent BashEvent[] // because a service needs to be associated with a bash to post to the bashfeed
1098
+ userPromoCodeRedemption UserPromoCodeRedemption[]
1098
1099
  }
1099
1100
 
1100
1101
  model StripeAccount {
@@ -1246,11 +1247,14 @@ model Venue {
1246
1247
  bashEvents BashEvent[]
1247
1248
  }
1248
1249
 
1249
- model ServicePromoCodeRedemption {
1250
+ model UserPromoCodeRedemption {
1250
1251
  id String @id @default(cuid())
1251
1252
  serviceId String?
1252
1253
  service Service? @relation(fields: [serviceId], references: [id], onDelete: Cascade)
1253
1254
 
1255
+ bashEventId String?
1256
+ bashEvent BashEvent? @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
1257
+
1254
1258
  userId String?
1255
1259
  user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
1256
1260
 
@@ -98,25 +98,4 @@ 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
- });
102
-
103
- export type ServicePromoCodeType = "PerUser" | "PerService";
104
-
105
- export type ServicePromoCodeDuration = {
106
- days?: number;
107
- };
108
-
109
- export type ServicePromoCode = {
110
- code?: string;
111
- maxRedemptions?: number;
112
- isTrial?: boolean;
113
- discountPercentageFee?: number;
114
- discountMonthlyFee?: number;
115
- duration: ServicePromoCodeDuration,
116
- type: ServicePromoCodeType;
117
- automaticallyApplied: boolean;
118
- };
119
-
120
- export type ServicePromoCodeMap = {
121
- [key: string]: ServicePromoCode;
122
- };
101
+ });
@@ -1,5 +1,4 @@
1
1
  import { VenuePricingPlan as VenuePricingPlanOption } from "@prisma/client";
2
- import { ServicePromoCodeMap } from "./serviceUtils";
3
2
 
4
3
  export type VenuePricingPlanData = {
5
4
  name: string,
@@ -28,19 +27,4 @@ export const VenuePricingPlanData: VenuePricingPlanMap = {
28
27
  monthlyFee: 100.0,
29
28
  flatFee: 0.0
30
29
  }
31
- } as const;
32
-
33
- export const VenuePromoCodes: ServicePromoCodeMap = {
34
- "Venue0001": {
35
- isTrial: true,
36
- duration: {
37
- days: 90
38
- },
39
- type: "PerUser",
40
- automaticallyApplied: true
41
- }
42
- } as const;
43
-
44
- Object.entries(VenuePromoCodes).forEach(promoCode => promoCode[1].code = promoCode[0]);
45
-
46
- export const VenueFreeTrialPromoCode = "Venue0001";
30
+ } as const;
@@ -0,0 +1,36 @@
1
+ export type UserPromoCodeType = "PerUser" | "PerService" | "PerBashEvent";
2
+
3
+ export type UserPromoCodeDuration = {
4
+ days?: number;
5
+ };
6
+
7
+ export type UserPromoCode = {
8
+ code?: string;
9
+ maxRedemptions?: number;
10
+ isTrial?: boolean;
11
+ discountPercentageFee?: number;
12
+ discountMonthlyFee?: number;
13
+ duration: UserPromoCodeDuration,
14
+ type: UserPromoCodeType;
15
+ automaticallyApplied: boolean;
16
+ expiresAfter?: number;
17
+ };
18
+
19
+ export type UserPromoCodeMap = {
20
+ [key: string]: UserPromoCode;
21
+ };
22
+
23
+ export const UserPromoCodes: UserPromoCodeMap = {
24
+ "Service0001": {
25
+ isTrial: true,
26
+ duration: {
27
+ days: 90
28
+ },
29
+ type: "PerUser",
30
+ automaticallyApplied: true,
31
+ }
32
+ } as const;
33
+
34
+ Object.entries(UserPromoCodes).forEach(promoCode => promoCode[1].code = promoCode[0]);
35
+
36
+ export const ServiceFreeTrialPromoCode = "Service0001";
@@ -0,0 +1,80 @@
1
+ import { ServiceSubscriptionTier, ServiceTypes, UserSubscriptionType } from "@prisma/client";
2
+
3
+ export type UserSubscriptionServiceTierInfo = {
4
+ name: string;
5
+ type?: ServiceSubscriptionTier;
6
+ description: string;
7
+ price: number;
8
+ };
9
+
10
+ export type UserSubscriptionServiceTierInfoMap = { [key in ServiceSubscriptionTier]: UserSubscriptionServiceTierInfo };
11
+
12
+ export type UserSubscriptionInfo = {
13
+ name: string;
14
+ type?: UserSubscriptionType;
15
+ description: string;
16
+ price: number;
17
+ // serviceTiers: UserSubscriptionServiceTierInfoMap;
18
+ // maxServicesToList?: number;
19
+ // maxServicesByTypeToList?:
20
+ };
21
+
22
+ export type UserSubscriptionServiceInfoMap = { [key in UserSubscriptionType]: UserSubscriptionInfo };
23
+
24
+ export type UserServiceSubscriptionTierToServiceTypes = { [key in ServiceSubscriptionTier]: ServiceTypes[] };
25
+ export type UserServiceSubscriptionTierFromServiceTypes = { [key in ServiceTypes]: ServiceSubscriptionTier };
26
+
27
+ export const serviceTierToServicesList = {
28
+ "Ally": ["EventServices", "EntertainmentServices"],
29
+ "Partner": ["Vendors", "Exhibitors", "Sponsors"],
30
+ "Patreon": ["Venues", "Organizations"]
31
+ } as UserServiceSubscriptionTierToServiceTypes;
32
+
33
+ export const serviceTierFromServicesList = Object.entries(serviceTierToServicesList).reduce((sofar, [type, serviceTypes]) => {
34
+ serviceTypes.forEach((serviceType) => sofar[serviceType] = type as ServiceSubscriptionTier);
35
+ return sofar;
36
+ }, {} as UserServiceSubscriptionTierFromServiceTypes)
37
+
38
+ export const UserSubscriptionTypes = {
39
+ // "Free": {
40
+ // name: "Free",
41
+ // description: "Free",
42
+ // price: 0,
43
+ // },
44
+ "Basic": {
45
+ name: "Basic",
46
+ description: "Basic",
47
+ price: 0,
48
+ },
49
+ // "Premium": {
50
+ // name: "Premium",
51
+ // description: "Premium",
52
+ // price: 200,
53
+ // },
54
+ // "VIP": {
55
+ // name: "VIP",
56
+ // description: "VIP",
57
+ // price: 500,
58
+ // }
59
+ } as UserSubscriptionServiceInfoMap;
60
+
61
+ export const ServiceSubscriptionTiers = {
62
+ "Ally": {
63
+ name: "Ally",
64
+ description: "Ally",
65
+ price: 15
66
+ },
67
+ "Partner": {
68
+ name: "Partner",
69
+ description: "Partner",
70
+ price: 50.00
71
+ },
72
+ "Patreon": {
73
+ name: "Patreon",
74
+ description: "Patreon",
75
+ price: 100.00
76
+ }
77
+ } as UserSubscriptionServiceTierInfoMap;
78
+
79
+ Object.entries(UserSubscriptionTypes).forEach(([type, info]) => info.type = type as UserSubscriptionType);
80
+ Object.entries(ServiceSubscriptionTiers).forEach(([type, info]) => info.type = type as ServiceSubscriptionTier);