@bash-app/bash-common 30.1.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,8 @@ 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
|
-
|
|
102
|
+
title String
|
|
103
|
+
description String?
|
|
103
104
|
assignedToId String?
|
|
104
105
|
assignedTo User? @relation("TasksAssignedToMe", fields: [assignedToId], references: [id], onDelete: Cascade)
|
|
105
106
|
status TaskStatus?
|
|
@@ -111,6 +112,8 @@ enum TaskStatus {
|
|
|
111
112
|
Accepted
|
|
112
113
|
Rejected
|
|
113
114
|
Completed
|
|
115
|
+
Assigned
|
|
116
|
+
Open
|
|
114
117
|
}
|
|
115
118
|
|
|
116
119
|
model Reminder {
|
|
@@ -280,7 +283,7 @@ model TicketTier {
|
|
|
280
283
|
bashEvent BashEvent @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
|
|
281
284
|
tickets Ticket[]
|
|
282
285
|
waitList User[]
|
|
283
|
-
price Int @default(0) //stored
|
|
286
|
+
price Int @default(0) //stored multiplied by 100 to allow for decimals
|
|
284
287
|
title String @default("Free")
|
|
285
288
|
sortOrder Int?
|
|
286
289
|
description String?
|
|
@@ -931,7 +934,7 @@ model User {
|
|
|
931
934
|
bashEventPromoCodesIUsed BashEventPromoCode[]
|
|
932
935
|
// bookingForMe Booking[]
|
|
933
936
|
userSubscription UserSubscription?
|
|
934
|
-
//
|
|
937
|
+
// serviceSubscriptions ServiceSubscription[]
|
|
935
938
|
volunteerService VolunteerService[]
|
|
936
939
|
stripeAccounts StripeAccount[]
|
|
937
940
|
userPromoCodeRedemption UserPromoCodeRedemption[]
|
|
@@ -994,7 +997,7 @@ model AssociatedService {
|
|
|
994
997
|
@@unique([ownerEmail, serviceId])
|
|
995
998
|
}
|
|
996
999
|
|
|
997
|
-
enum
|
|
1000
|
+
enum ServiceCancellationPolicy {
|
|
998
1001
|
None
|
|
999
1002
|
VeryFlexible
|
|
1000
1003
|
Flexible
|
|
@@ -1126,7 +1129,7 @@ model Service {
|
|
|
1126
1129
|
emergencyContact String?
|
|
1127
1130
|
contactDetails String?
|
|
1128
1131
|
// rates Rate[] @relation("MultipleRates")
|
|
1129
|
-
cancellationPolicy
|
|
1132
|
+
cancellationPolicy ServiceCancellationPolicy? @default(None)
|
|
1130
1133
|
// refundPolicy String?
|
|
1131
1134
|
// insurancePolicy String?
|
|
1132
1135
|
// hoursOfOperation Json? @default("{}")
|
package/src/extendedSchemas.ts
CHANGED
|
@@ -516,11 +516,12 @@ export const VENUE_DATA_TO_REMOVE: RemoveCommonProperties<
|
|
|
516
516
|
//-----------------------------------------
|
|
517
517
|
|
|
518
518
|
export interface BashNotificationExt extends BashNotification {
|
|
519
|
-
creator?: PublicUser;
|
|
520
519
|
bashEvent?: BashEvent;
|
|
520
|
+
creator?: PublicUser;
|
|
521
|
+
eventTask?: EventTask;
|
|
522
|
+
userAction?: string;
|
|
521
523
|
service?: ServiceExt;
|
|
522
524
|
serviceBooking?: ServiceBookingExt;
|
|
523
|
-
eventTask?: EventTask;
|
|
524
525
|
invitation?: Invitation;
|
|
525
526
|
reminders?: Reminder[];
|
|
526
527
|
}
|
|
@@ -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
|
});
|