@bash-app/bash-common 30.2.0 → 30.3.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
package/prisma/schema.prisma
CHANGED
|
@@ -77,7 +77,7 @@ model Competition {
|
|
|
77
77
|
owner User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
78
78
|
prizes Prize[]
|
|
79
79
|
userId String
|
|
80
|
-
|
|
80
|
+
sponsor CompetitionSponsor[]
|
|
81
81
|
bashEvent BashEvent @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
|
|
82
82
|
bashEventId String
|
|
83
83
|
numberOfPrizes Int
|
|
@@ -99,7 +99,7 @@ model EventTask {
|
|
|
99
99
|
creator User @relation(fields: [creatorId], references: [id], onDelete: Cascade)
|
|
100
100
|
bashEventId String
|
|
101
101
|
bashEvent BashEvent @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
|
|
102
|
-
title String
|
|
102
|
+
title String
|
|
103
103
|
description String?
|
|
104
104
|
assignedToId String?
|
|
105
105
|
assignedTo User? @relation("TasksAssignedToMe", fields: [assignedToId], references: [id], onDelete: Cascade)
|
|
@@ -283,7 +283,7 @@ model TicketTier {
|
|
|
283
283
|
bashEvent BashEvent @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
|
|
284
284
|
tickets Ticket[]
|
|
285
285
|
waitList User[]
|
|
286
|
-
price Int @default(0) //stored
|
|
286
|
+
price Int @default(0) //stored multiplied by 100 to allow for decimals
|
|
287
287
|
title String @default("Free")
|
|
288
288
|
sortOrder Int?
|
|
289
289
|
description String?
|
|
@@ -934,7 +934,7 @@ model User {
|
|
|
934
934
|
bashEventPromoCodesIUsed BashEventPromoCode[]
|
|
935
935
|
// bookingForMe Booking[]
|
|
936
936
|
userSubscription UserSubscription?
|
|
937
|
-
//
|
|
937
|
+
// serviceSubscriptions ServiceSubscription[]
|
|
938
938
|
volunteerService VolunteerService[]
|
|
939
939
|
stripeAccounts StripeAccount[]
|
|
940
940
|
userPromoCodeRedemption UserPromoCodeRedemption[]
|
|
@@ -997,7 +997,7 @@ model AssociatedService {
|
|
|
997
997
|
@@unique([ownerEmail, serviceId])
|
|
998
998
|
}
|
|
999
999
|
|
|
1000
|
-
enum
|
|
1000
|
+
enum ServiceCancellationPolicy {
|
|
1001
1001
|
None
|
|
1002
1002
|
VeryFlexible
|
|
1003
1003
|
Flexible
|
|
@@ -1129,7 +1129,7 @@ model Service {
|
|
|
1129
1129
|
emergencyContact String?
|
|
1130
1130
|
contactDetails String?
|
|
1131
1131
|
// rates Rate[] @relation("MultipleRates")
|
|
1132
|
-
cancellationPolicy
|
|
1132
|
+
cancellationPolicy ServiceCancellationPolicy? @default(None)
|
|
1133
1133
|
// refundPolicy String?
|
|
1134
1134
|
// insurancePolicy String?
|
|
1135
1135
|
// hoursOfOperation Json? @default("{}")
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
ServiceCancellationPolicy as ServiceCancellationPolicyOption,
|
|
3
3
|
ServiceSubscriptionStatus,
|
|
4
4
|
ServiceTypes,
|
|
5
5
|
} from "@prisma/client";
|
|
6
6
|
import { ServiceExt } from "../../extendedSchemas";
|
|
7
7
|
|
|
8
|
-
export type
|
|
8
|
+
export type ServiceCancellationRefundPolicy = {
|
|
9
9
|
days?: number;
|
|
10
10
|
hours?: number;
|
|
11
11
|
refundPercentage: number;
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
-
export type
|
|
14
|
+
export type ServiceCancellationPolicyData = {
|
|
15
15
|
name: string;
|
|
16
16
|
description?: string;
|
|
17
|
-
refundPolicy:
|
|
17
|
+
refundPolicy: ServiceCancellationRefundPolicy[];
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
export type
|
|
21
|
-
[key in
|
|
20
|
+
export type ServiceCancellationPolicyMap = {
|
|
21
|
+
[key in ServiceCancellationPolicyOption]: ServiceCancellationPolicyData;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
export const
|
|
25
|
-
[
|
|
24
|
+
export const SERVICE_CANCELLATION_POLICY_DATA: ServiceCancellationPolicyMap = {
|
|
25
|
+
[ServiceCancellationPolicyOption.None]: {
|
|
26
26
|
name: "None",
|
|
27
27
|
refundPolicy: [],
|
|
28
28
|
description: "No cancellation policy.",
|
|
29
29
|
},
|
|
30
|
-
[
|
|
30
|
+
[ServiceCancellationPolicyOption.VeryFlexible]: {
|
|
31
31
|
name: "Very Flexible",
|
|
32
32
|
refundPolicy: [
|
|
33
33
|
{
|
|
@@ -36,7 +36,7 @@ export const SERVICE_CANCELATION_POLICY_DATA: ServiceCancelationPolicyMap = {
|
|
|
36
36
|
},
|
|
37
37
|
],
|
|
38
38
|
},
|
|
39
|
-
[
|
|
39
|
+
[ServiceCancellationPolicyOption.Flexible]: {
|
|
40
40
|
name: "Flexible",
|
|
41
41
|
refundPolicy: [
|
|
42
42
|
{
|
|
@@ -49,7 +49,7 @@ export const SERVICE_CANCELATION_POLICY_DATA: ServiceCancelationPolicyMap = {
|
|
|
49
49
|
},
|
|
50
50
|
],
|
|
51
51
|
},
|
|
52
|
-
[
|
|
52
|
+
[ServiceCancellationPolicyOption.Standard30Day]: {
|
|
53
53
|
name: "Standard 30 Day",
|
|
54
54
|
refundPolicy: [
|
|
55
55
|
{
|
|
@@ -62,7 +62,7 @@ export const SERVICE_CANCELATION_POLICY_DATA: ServiceCancelationPolicyMap = {
|
|
|
62
62
|
},
|
|
63
63
|
],
|
|
64
64
|
},
|
|
65
|
-
[
|
|
65
|
+
[ServiceCancellationPolicyOption.Standard90Day]: {
|
|
66
66
|
name: "Very Flexible",
|
|
67
67
|
refundPolicy: [
|
|
68
68
|
{
|
|
@@ -78,7 +78,7 @@ export const SERVICE_CANCELATION_POLICY_DATA: ServiceCancelationPolicyMap = {
|
|
|
78
78
|
} as const;
|
|
79
79
|
|
|
80
80
|
function generateDescription(
|
|
81
|
-
refundPolicy:
|
|
81
|
+
refundPolicy: ServiceCancellationRefundPolicy[]
|
|
82
82
|
): string {
|
|
83
83
|
const descriptions = refundPolicy.map((policy, index) => {
|
|
84
84
|
const unit = policy.days ? "days" : "hours";
|
|
@@ -110,16 +110,16 @@ function generateDescription(
|
|
|
110
110
|
return descriptions.join(" ");
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
Object.keys(
|
|
113
|
+
Object.keys(SERVICE_CANCELLATION_POLICY_DATA)
|
|
114
114
|
.filter(
|
|
115
115
|
(policyKey) =>
|
|
116
|
-
(policyKey as
|
|
117
|
-
|
|
116
|
+
(policyKey as ServiceCancellationPolicyOption) !=
|
|
117
|
+
ServiceCancellationPolicyOption.None
|
|
118
118
|
)
|
|
119
119
|
.forEach((policyKey) => {
|
|
120
120
|
const policy =
|
|
121
|
-
|
|
122
|
-
policyKey as
|
|
121
|
+
SERVICE_CANCELLATION_POLICY_DATA[
|
|
122
|
+
policyKey as ServiceCancellationPolicyOption
|
|
123
123
|
];
|
|
124
124
|
policy.description = generateDescription(policy.refundPolicy);
|
|
125
125
|
});
|