@bash-app/bash-common 29.48.1 → 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.
|
|
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",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"@prisma/client": "^5.18.0",
|
|
30
|
-
"dayjs": "^1.11.
|
|
30
|
+
"dayjs": "^1.11.13",
|
|
31
31
|
"prisma": "^5.18.0",
|
|
32
32
|
"react-tailwindcss-datepicker": "^1.6.6",
|
|
33
33
|
"tsx": "^4.10.3"
|
package/prisma/schema.prisma
CHANGED
|
@@ -187,20 +187,20 @@ model Invitation {
|
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
model BashEvent {
|
|
190
|
-
id String
|
|
190
|
+
id String @id @default(cuid())
|
|
191
191
|
title String
|
|
192
192
|
creatorId String
|
|
193
|
-
creator User
|
|
193
|
+
creator User @relation("CreatedEvent", fields: [creatorId], references: [id], onDelete: Cascade)
|
|
194
194
|
isApproved Boolean?
|
|
195
195
|
description String?
|
|
196
|
-
eventType String
|
|
197
|
-
startDateTime DateTime?
|
|
198
|
-
endDateTime DateTime?
|
|
196
|
+
eventType String @default("Other")
|
|
197
|
+
startDateTime DateTime? @default(now())
|
|
198
|
+
endDateTime DateTime? @default(now())
|
|
199
199
|
ticketTiers TicketTier[]
|
|
200
|
-
targetAudienceId String?
|
|
201
|
-
targetAudience TargetAudience?
|
|
202
|
-
amountOfGuestsId String?
|
|
203
|
-
amountOfGuests AmountOfGuests?
|
|
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
|
|
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
|
|
219
|
+
status BashStatus @default(Draft)
|
|
220
220
|
tags String[]
|
|
221
221
|
coverPhoto String?
|
|
222
222
|
media Media[]
|
|
223
|
-
club Club?
|
|
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?
|
|
244
|
+
venue Venue? @relation(fields: [venueId], references: [id])
|
|
245
|
+
userPromoCodeRedemption UserPromoCodeRedemption[]
|
|
245
246
|
}
|
|
246
247
|
|
|
247
248
|
model Coordinates {
|
|
@@ -330,19 +331,6 @@ model ServiceCheckout {
|
|
|
330
331
|
stripeCheckoutSessionId String? @unique
|
|
331
332
|
}
|
|
332
333
|
|
|
333
|
-
model UserSubscription {
|
|
334
|
-
id String @id @default(cuid())
|
|
335
|
-
ownerId String @unique
|
|
336
|
-
owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)
|
|
337
|
-
type UserSubscriptionType
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
enum UserSubscriptionType {
|
|
341
|
-
Free
|
|
342
|
-
Premium
|
|
343
|
-
VIP
|
|
344
|
-
}
|
|
345
|
-
|
|
346
334
|
enum BookingStatus {
|
|
347
335
|
Cancelled
|
|
348
336
|
Completed
|
|
@@ -846,12 +834,12 @@ enum SocialMediaPlatform {
|
|
|
846
834
|
}
|
|
847
835
|
|
|
848
836
|
model User {
|
|
849
|
-
id String
|
|
850
|
-
email String
|
|
851
|
-
createdOn DateTime
|
|
852
|
-
stripeCustomerId String?
|
|
853
|
-
stripeAccountId String?
|
|
854
|
-
isSuperUser Boolean
|
|
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)
|
|
855
843
|
googleCalendarAccess String?
|
|
856
844
|
givenName String?
|
|
857
845
|
familyName String?
|
|
@@ -862,12 +850,12 @@ model User {
|
|
|
862
850
|
dob DateTime?
|
|
863
851
|
gender Gender?
|
|
864
852
|
sex Sex?
|
|
865
|
-
roles UserRole[]
|
|
866
|
-
ownedServices Service[]
|
|
867
|
-
createdServices Service[]
|
|
868
|
-
createdEvents BashEvent[]
|
|
869
|
-
ticketsISent Ticket[]
|
|
870
|
-
ticketsIOwn Ticket[]
|
|
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")
|
|
871
859
|
reviews Review[]
|
|
872
860
|
sponsorships SponsoredEvent[]
|
|
873
861
|
investments Investment[]
|
|
@@ -890,20 +878,20 @@ model User {
|
|
|
890
878
|
city String?
|
|
891
879
|
state String?
|
|
892
880
|
zipCode String?
|
|
893
|
-
country String?
|
|
881
|
+
country String? @default("US")
|
|
894
882
|
phone String?
|
|
895
883
|
socialMediaProfiles SocialMediaProfile[]
|
|
896
|
-
documentIDId String?
|
|
884
|
+
documentIDId String? @unique
|
|
897
885
|
documentID DocumentID?
|
|
898
886
|
comment BashComment[]
|
|
899
887
|
associatedBashes AssociatedBash[]
|
|
900
888
|
associatedServices AssociatedService[]
|
|
901
|
-
invitationsCreatedByMe Invitation[]
|
|
902
|
-
invitationsSentToMe Invitation[]
|
|
903
|
-
notificationsCreatedByMe BashNotification[]
|
|
904
|
-
remindersCreatedByMe Reminder[]
|
|
905
|
-
remindersAssignedToMe Reminder[]
|
|
906
|
-
eventTasksAssignedToMe EventTask[]
|
|
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")
|
|
907
895
|
checkouts Checkout[]
|
|
908
896
|
ticketTiersWaitListsIveJoined TicketTier[]
|
|
909
897
|
contacts Contact[]
|
|
@@ -911,10 +899,10 @@ model User {
|
|
|
911
899
|
serviceCheckouts ServiceCheckout[]
|
|
912
900
|
bookingForMe Booking[]
|
|
913
901
|
userSubscription UserSubscription?
|
|
914
|
-
serviceSubcriptions ServiceSubscription[]
|
|
902
|
+
// serviceSubcriptions ServiceSubscription[]
|
|
915
903
|
volunteerService VolunteerService[]
|
|
916
904
|
stripeAccounts StripeAccount[]
|
|
917
|
-
|
|
905
|
+
userPromoCodeRedemption UserPromoCodeRedemption[]
|
|
918
906
|
}
|
|
919
907
|
|
|
920
908
|
model Contact {
|
|
@@ -972,30 +960,52 @@ enum ServiceCancelationPolicy {
|
|
|
972
960
|
Standard30Day
|
|
973
961
|
}
|
|
974
962
|
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
963
|
+
enum UserSubscriptionStatus {
|
|
964
|
+
Active
|
|
965
|
+
Trialing
|
|
966
|
+
Paused
|
|
967
|
+
Canceled
|
|
968
|
+
Incomplete
|
|
969
|
+
IncompleteExpired
|
|
970
|
+
Unpaid
|
|
971
|
+
PastDue
|
|
972
|
+
Suspended
|
|
973
|
+
Expired
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
enum UserSubscriptionType {
|
|
977
|
+
// Free
|
|
978
|
+
Basic
|
|
979
|
+
// Premium
|
|
980
|
+
// VIP
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
enum ServiceSubscriptionTier {
|
|
984
|
+
Ally
|
|
985
|
+
Partner
|
|
986
|
+
Patreon
|
|
981
987
|
}
|
|
982
988
|
|
|
983
|
-
model
|
|
984
|
-
id
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
+
model UserSubscription {
|
|
990
|
+
id String @id @default(cuid())
|
|
991
|
+
|
|
992
|
+
ownerId String @unique
|
|
993
|
+
owner User @relation(fields: [ownerId], references: [id], onDelete: Restrict, onUpdate: Restrict)
|
|
994
|
+
|
|
995
|
+
stripeAccountId String @unique
|
|
996
|
+
stripeAccount StripeAccount @relation(fields: [stripeAccountId], references: [id], onDelete: Restrict, onUpdate: Restrict)
|
|
989
997
|
|
|
990
|
-
|
|
991
|
-
|
|
998
|
+
stripeCheckoutSessionId String? @unique
|
|
999
|
+
stripeSubscriptionId String? @unique
|
|
992
1000
|
|
|
993
|
-
|
|
1001
|
+
type UserSubscriptionType?
|
|
1002
|
+
status UserSubscriptionStatus?
|
|
994
1003
|
|
|
995
|
-
|
|
996
|
-
|
|
1004
|
+
//price addons
|
|
1005
|
+
serviceSubscriptionTier ServiceSubscriptionTier?
|
|
997
1006
|
|
|
998
|
-
@@index([stripeCheckoutSessionId
|
|
1007
|
+
@@index([stripeCheckoutSessionId])
|
|
1008
|
+
@@index([stripeSubscriptionId])
|
|
999
1009
|
}
|
|
1000
1010
|
|
|
1001
1011
|
// Common data for all services; 1-1 relation between each individual service model such as Venue
|
|
@@ -1060,8 +1070,6 @@ model Service {
|
|
|
1060
1070
|
stripeAccountId String?
|
|
1061
1071
|
stripeAccount StripeAccount? @relation(fields: [stripeAccountId], references: [id], onDelete: Restrict)
|
|
1062
1072
|
|
|
1063
|
-
serviceListingSubscription ServiceListingSubscription?
|
|
1064
|
-
|
|
1065
1073
|
targetAudienceId String? @unique
|
|
1066
1074
|
targetAudience TargetAudience? @relation(fields: [targetAudienceId], references: [id], onDelete: Cascade)
|
|
1067
1075
|
|
|
@@ -1086,8 +1094,8 @@ model Service {
|
|
|
1086
1094
|
|
|
1087
1095
|
// googleReviews GoogleReview[]
|
|
1088
1096
|
|
|
1089
|
-
bashEvent
|
|
1090
|
-
|
|
1097
|
+
bashEvent BashEvent[] // because a service needs to be associated with a bash to post to the bashfeed
|
|
1098
|
+
userPromoCodeRedemption UserPromoCodeRedemption[]
|
|
1091
1099
|
}
|
|
1092
1100
|
|
|
1093
1101
|
model StripeAccount {
|
|
@@ -1105,8 +1113,8 @@ model StripeAccount {
|
|
|
1105
1113
|
createdAt DateTime @default(now())
|
|
1106
1114
|
updatedAt DateTime @updatedAt
|
|
1107
1115
|
|
|
1108
|
-
service
|
|
1109
|
-
|
|
1116
|
+
service Service[]
|
|
1117
|
+
userSubscription UserSubscription?
|
|
1110
1118
|
|
|
1111
1119
|
@@index([ownerId])
|
|
1112
1120
|
}
|
|
@@ -1239,11 +1247,14 @@ model Venue {
|
|
|
1239
1247
|
bashEvents BashEvent[]
|
|
1240
1248
|
}
|
|
1241
1249
|
|
|
1242
|
-
model
|
|
1250
|
+
model UserPromoCodeRedemption {
|
|
1243
1251
|
id String @id @default(cuid())
|
|
1244
1252
|
serviceId String?
|
|
1245
1253
|
service Service? @relation(fields: [serviceId], references: [id], onDelete: Cascade)
|
|
1246
1254
|
|
|
1255
|
+
bashEventId String?
|
|
1256
|
+
bashEvent BashEvent? @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
|
|
1257
|
+
|
|
1247
1258
|
userId String?
|
|
1248
1259
|
user User? @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
1249
1260
|
|
|
@@ -1265,20 +1276,6 @@ enum VenuePricingPlan {
|
|
|
1265
1276
|
Subscription
|
|
1266
1277
|
}
|
|
1267
1278
|
|
|
1268
|
-
enum ServiceSubscriptionStatus {
|
|
1269
|
-
None
|
|
1270
|
-
Active
|
|
1271
|
-
Trialing
|
|
1272
|
-
Paused
|
|
1273
|
-
Canceled
|
|
1274
|
-
Incomplete
|
|
1275
|
-
IncompleteExpired
|
|
1276
|
-
Unpaid
|
|
1277
|
-
PastDue
|
|
1278
|
-
Suspended
|
|
1279
|
-
Expired
|
|
1280
|
-
}
|
|
1281
|
-
|
|
1282
1279
|
model Organization {
|
|
1283
1280
|
id String @id @default(cuid())
|
|
1284
1281
|
serviceId String @unique
|
package/src/extendedSchemas.ts
CHANGED
|
@@ -36,12 +36,30 @@ import {
|
|
|
36
36
|
ServiceSpecialRates,
|
|
37
37
|
ServiceAddon,
|
|
38
38
|
ServicePackage,
|
|
39
|
-
|
|
39
|
+
UserSubscription,
|
|
40
40
|
SocialMediaProfile,
|
|
41
41
|
SocialMediaPlatform,
|
|
42
42
|
} from "@prisma/client";
|
|
43
43
|
import { SERVICE_LINK_DATA_TO_INCLUDE, UnionFromArray } from "./definitions";
|
|
44
44
|
|
|
45
|
+
//------------------------------------------------------user subscriptions------------------------------------------------------
|
|
46
|
+
export const PRIVATE_USER_SUBSCRIPTION_DATA_TO_SELECT = {
|
|
47
|
+
type: true,
|
|
48
|
+
status: true,
|
|
49
|
+
serviceSubscriptionTier: true,
|
|
50
|
+
ownerId: true,
|
|
51
|
+
stripeAccountId: true
|
|
52
|
+
} satisfies Prisma.UserSubscriptionSelect;
|
|
53
|
+
|
|
54
|
+
export type UserSubscriptionExt = {
|
|
55
|
+
stripeAccount: StripeAccountExt;
|
|
56
|
+
} & UserSubscription;
|
|
57
|
+
|
|
58
|
+
export const USER_SUBSCRIPTION_DATA_TO_INCLUDE = {
|
|
59
|
+
stripeAccount: true
|
|
60
|
+
} satisfies Prisma.UserSubscriptionInclude;
|
|
61
|
+
//-------------------------------------------------------------------------------------------------------------------------------
|
|
62
|
+
|
|
45
63
|
export const FRONT_END_USER_DATA_TO_SELECT = {
|
|
46
64
|
id: true,
|
|
47
65
|
email: true,
|
|
@@ -61,6 +79,9 @@ export const PRIVATE_USER_ACCOUNT_TO_SELECT = {
|
|
|
61
79
|
zipCode: true,
|
|
62
80
|
country: true,
|
|
63
81
|
phone: true,
|
|
82
|
+
userSubscription: {
|
|
83
|
+
select: PRIVATE_USER_SUBSCRIPTION_DATA_TO_SELECT
|
|
84
|
+
}
|
|
64
85
|
} satisfies Prisma.UserSelect;
|
|
65
86
|
|
|
66
87
|
export interface BashEventExt extends BashEvent {
|
|
@@ -119,7 +140,6 @@ export interface ServiceExt extends Service {
|
|
|
119
140
|
creator?: PublicUser | null;
|
|
120
141
|
|
|
121
142
|
stripeAccount?: PublicStripeAccount | null;
|
|
122
|
-
serviceListingSubscription?: PublicServiceListingSubscription | null;
|
|
123
143
|
|
|
124
144
|
// availableDateTimes?: Availability[];
|
|
125
145
|
|
|
@@ -294,13 +314,6 @@ export const SERVICE_RATES_ASSOCIATION_DATA_TO_INCLUDE = {
|
|
|
294
314
|
} satisfies Prisma.ServiceRatesAssociationInclude;
|
|
295
315
|
|
|
296
316
|
//------------Stripe Accounts--------------
|
|
297
|
-
export const STRIPE_ACCOUNT_DATA_TO_INCLUDE = {
|
|
298
|
-
logo: true,
|
|
299
|
-
owner: {
|
|
300
|
-
select: FRONT_END_USER_DATA_TO_SELECT
|
|
301
|
-
}
|
|
302
|
-
} satisfies Prisma.StripeAccountInclude;
|
|
303
|
-
|
|
304
317
|
export const PUBLIC_STRIPE_ACCOUNT_DATA_TO_SELECT = {
|
|
305
318
|
logo: true,
|
|
306
319
|
logoId: true,
|
|
@@ -308,9 +321,15 @@ export const PUBLIC_STRIPE_ACCOUNT_DATA_TO_SELECT = {
|
|
|
308
321
|
updatedAt: true
|
|
309
322
|
} satisfies Prisma.StripeAccountSelect;
|
|
310
323
|
|
|
311
|
-
export const
|
|
312
|
-
|
|
313
|
-
|
|
324
|
+
export const STRIPE_ACCOUNT_DATA_TO_INCLUDE = {
|
|
325
|
+
logo: true,
|
|
326
|
+
owner: {
|
|
327
|
+
select: FRONT_END_USER_DATA_TO_SELECT
|
|
328
|
+
},
|
|
329
|
+
userSubscription: {
|
|
330
|
+
select: PRIVATE_USER_SUBSCRIPTION_DATA_TO_SELECT
|
|
331
|
+
}
|
|
332
|
+
} satisfies Prisma.StripeAccountInclude;
|
|
314
333
|
|
|
315
334
|
export interface StripeAccountExt extends StripeAccount {
|
|
316
335
|
logo?: Media | null;
|
|
@@ -335,9 +354,6 @@ export const SERVICE_DATA_TO_INCLUDE = {
|
|
|
335
354
|
// ...STRIPE_ACCOUNT_DATA_TO_INCLUDE,
|
|
336
355
|
select: PUBLIC_STRIPE_ACCOUNT_DATA_TO_SELECT
|
|
337
356
|
},
|
|
338
|
-
serviceListingSubscription: {
|
|
339
|
-
select: PUBLIC_SERVICE_LISTING_SUBSCRIPTION_DATA_TO_SELECT
|
|
340
|
-
},
|
|
341
357
|
// availableDateTimes: true,
|
|
342
358
|
serviceLinks: {
|
|
343
359
|
include: SERVICE_LINK_DATA_TO_INCLUDE
|
|
@@ -524,6 +540,7 @@ export interface UserExt extends User {
|
|
|
524
540
|
services?: Service[] | null;
|
|
525
541
|
|
|
526
542
|
// Do not include in fetch as there could be thousands of these
|
|
543
|
+
userSubscription?: UserSubscriptionExt | null;
|
|
527
544
|
associatedBashes?: AssociatedBash[] | null;
|
|
528
545
|
associatedServices?: AssociatedService[] | null;
|
|
529
546
|
socialMediaProfiles?: SocialMediaProfile[] | null;
|
|
@@ -549,6 +566,4 @@ export const USER_DATA_SELECT_REVIEWS_COMMENTS = {
|
|
|
549
566
|
export type PublicUser = Pick<UserExt, keyof typeof FRONT_END_USER_DATA_TO_SELECT>
|
|
550
567
|
& Partial<Pick<UserExt, keyof typeof USER_DATA_SELECT_REVIEWS_COMMENTS>>;
|
|
551
568
|
|
|
552
|
-
export type PublicStripeAccount = Pick<StripeAccountExt, keyof typeof PUBLIC_STRIPE_ACCOUNT_DATA_TO_SELECT>;
|
|
553
|
-
|
|
554
|
-
export type PublicServiceListingSubscription = Pick<ServiceListingSubscription, keyof typeof PUBLIC_SERVICE_LISTING_SUBSCRIPTION_DATA_TO_SELECT>;
|
|
569
|
+
export type PublicStripeAccount = Pick<StripeAccountExt, keyof typeof PUBLIC_STRIPE_ACCOUNT_DATA_TO_SELECT>;
|
|
@@ -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);
|