@sellout/models 0.0.56 → 0.0.58
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/.dist/graphql/fragments/event.fragment.js +8 -0
- package/.dist/graphql/fragments/event.fragment.js.map +1 -1
- package/.dist/graphql/mutations/createArtist.mutation.d.ts +2 -0
- package/.dist/graphql/mutations/createArtist.mutation.js +52 -0
- package/.dist/graphql/mutations/createArtist.mutation.js.map +1 -0
- package/.dist/graphql/mutations/createFee.mutation.d.ts +2 -0
- package/.dist/graphql/mutations/createFee.mutation.js +30 -0
- package/.dist/graphql/mutations/createFee.mutation.js.map +1 -0
- package/.dist/graphql/mutations/deleteFee.mutation.d.ts +2 -0
- package/.dist/graphql/mutations/deleteFee.mutation.js +13 -0
- package/.dist/graphql/mutations/deleteFee.mutation.js.map +1 -0
- package/.dist/graphql/mutations/updateArtist.mutation.d.ts +2 -0
- package/.dist/graphql/mutations/updateArtist.mutation.js +52 -0
- package/.dist/graphql/mutations/updateArtist.mutation.js.map +1 -0
- package/.dist/graphql/mutations/updateFee.mutation.d.ts +2 -0
- package/.dist/graphql/mutations/updateFee.mutation.js +30 -0
- package/.dist/graphql/mutations/updateFee.mutation.js.map +1 -0
- package/.dist/graphql/queries/artist.query.js +11 -2
- package/.dist/graphql/queries/artist.query.js.map +1 -1
- package/.dist/graphql/queries/artists.query.js +11 -10
- package/.dist/graphql/queries/artists.query.js.map +1 -1
- package/.dist/graphql/queries/fee.query.d.ts +2 -0
- package/.dist/graphql/queries/fee.query.js +30 -0
- package/.dist/graphql/queries/fee.query.js.map +1 -0
- package/.dist/interfaces/IArtist.d.ts +9 -0
- package/.dist/interfaces/IArtist.js +9 -0
- package/.dist/interfaces/IArtist.js.map +1 -1
- package/.dist/interfaces/IArtistPressKit.d.ts +1 -0
- package/.dist/interfaces/IEvent.js +1 -1
- package/.dist/interfaces/IEvent.js.map +1 -1
- package/.dist/interfaces/IEventCustomField.d.ts +4 -1
- package/.dist/interfaces/IEventCustomField.js +2 -0
- package/.dist/interfaces/IEventCustomField.js.map +1 -1
- package/.dist/interfaces/IEventPromotion.d.ts +12 -2
- package/.dist/interfaces/IEventPromotion.js +9 -3
- package/.dist/interfaces/IEventPromotion.js.map +1 -1
- package/.dist/interfaces/IFee.d.ts +5 -6
- package/.dist/interfaces/IFee.js +1 -1
- package/.dist/interfaces/IFee.js.map +1 -1
- package/.dist/interfaces/IPerformance.d.ts +1 -1
- package/.dist/schemas/Artist.d.ts +12 -0
- package/.dist/schemas/Artist.js +12 -0
- package/.dist/schemas/Artist.js.map +1 -1
- package/.dist/schemas/Event.d.ts +36 -0
- package/.dist/schemas/Event.js +44 -8
- package/.dist/schemas/Event.js.map +1 -1
- package/.dist/sellout-proto.js +276 -39
- package/.dist/utils/EventUtil.d.ts +8 -0
- package/.dist/utils/EventUtil.js +68 -36
- package/.dist/utils/EventUtil.js.map +1 -1
- package/.dist/utils/fee-util-broken-but-why.d.ts +8 -0
- package/.dist/utils/fee-util-broken-but-why.js +38 -0
- package/.dist/utils/fee-util-broken-but-why.js.map +1 -0
- package/package.json +4 -4
- package/src/graphql/fragments/event.fragment.ts +8 -0
- package/src/graphql/mutations/createArtist.mutation.ts +48 -0
- package/src/graphql/mutations/createFee.mutation.ts +26 -0
- package/src/graphql/mutations/deleteFee.mutation.ts +9 -0
- package/src/graphql/mutations/updateArtist.mutation.ts +48 -0
- package/src/graphql/mutations/updateFee.mutation.ts +25 -0
- package/src/graphql/queries/artist.query.ts +11 -2
- package/src/graphql/queries/artists.query.ts +12 -10
- package/src/graphql/queries/fee.query.ts +26 -0
- package/src/interfaces/IArtist.ts +11 -1
- package/src/interfaces/IArtistPressKit.ts +1 -0
- package/src/interfaces/IEvent.ts +1 -1
- package/src/interfaces/IEventCustomField.ts +3 -0
- package/src/interfaces/IEventPromotion.ts +13 -2
- package/src/interfaces/IFee.ts +5 -5
- package/src/interfaces/IPerformance.ts +1 -1
- package/src/proto/artist.proto +9 -7
- package/src/proto/event.proto +13 -5
- package/src/schemas/Artist.ts +12 -0
- package/src/schemas/Event.ts +44 -8
- package/src/utils/EventUtil.ts +129 -44
- package/src/utils/fee-util-broken-but-why +36 -0
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export enum EventCustomFieldTypeEnum {
|
|
2
2
|
Text = 'Text',
|
|
3
3
|
Number = 'Number',
|
|
4
|
+
Address = 'Address',
|
|
5
|
+
Dropdown = 'Dropdown',
|
|
4
6
|
}
|
|
5
7
|
|
|
6
8
|
export default interface IEventCustomFields {
|
|
@@ -12,5 +14,6 @@ export default interface IEventCustomFields {
|
|
|
12
14
|
maxValue: number;
|
|
13
15
|
minValue: number;
|
|
14
16
|
required: boolean;
|
|
17
|
+
options: string[];
|
|
15
18
|
active: boolean;
|
|
16
19
|
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
export enum EventPromotionTypeEnum {
|
|
2
|
-
PreSale = "Pre-Sale
|
|
3
|
-
|
|
2
|
+
PreSale = "Pre-Sale",
|
|
3
|
+
Unlock = "Unlock",
|
|
4
|
+
Discount = 'Discount',
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export enum EventPromotionDiscountTypeEnum {
|
|
8
|
+
Flat = "Flat",
|
|
9
|
+
Percent = "Percent",
|
|
4
10
|
}
|
|
5
11
|
|
|
6
12
|
export default interface IEventPromotion {
|
|
@@ -12,4 +18,9 @@ export default interface IEventPromotion {
|
|
|
12
18
|
ticketTypeIds: string[];
|
|
13
19
|
upgradeIds: string[];
|
|
14
20
|
active: boolean;
|
|
21
|
+
startsAt: number;
|
|
22
|
+
endsAt: number;
|
|
23
|
+
useLimit: number;
|
|
24
|
+
discountType: EventPromotionDiscountTypeEnum;
|
|
25
|
+
discountValue: number;
|
|
15
26
|
}
|
package/src/interfaces/IFee.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export enum FeeTypeEnum {
|
|
2
2
|
Flat = 'Flat',
|
|
3
3
|
Percent = 'Percent',
|
|
4
|
-
FlatPlusPercent = 'Flat + Percent',
|
|
4
|
+
// FlatPlusPercent = 'Flat + Percent',
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
export enum FeeAppliedToEnum {
|
|
@@ -35,10 +35,10 @@ export default interface IFee {
|
|
|
35
35
|
minAppliedToPrice?: number;
|
|
36
36
|
maxAppliedToPrice?: number;
|
|
37
37
|
filters?: FeeFilters[];
|
|
38
|
-
createdBy
|
|
39
|
-
createdAt
|
|
40
|
-
updatedBy
|
|
41
|
-
updatedAt
|
|
38
|
+
createdBy?: string;
|
|
39
|
+
createdAt?: number;
|
|
40
|
+
updatedBy?: string;
|
|
41
|
+
updatedAt?: number;
|
|
42
42
|
disabled: boolean;
|
|
43
43
|
// disableable: boolean;
|
|
44
44
|
// editable: boolean;
|
package/src/proto/artist.proto
CHANGED
|
@@ -6,13 +6,15 @@ import "common.proto";
|
|
|
6
6
|
message Artist {
|
|
7
7
|
string _id = 1;
|
|
8
8
|
string name = 2;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
repeated
|
|
12
|
-
repeated
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
string orgId = 3;
|
|
10
|
+
string type = 4;
|
|
11
|
+
repeated string genres = 5;
|
|
12
|
+
repeated SocialAccountLink socialAccounts = 6;
|
|
13
|
+
repeated ArtistPressKit pressKits = 7;
|
|
14
|
+
repeated ArtistContact contacts = 8;
|
|
15
|
+
string artistGlobalId = 9;
|
|
16
|
+
Metrics metrics = 10;
|
|
17
|
+
int32 createdAt = 11;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
message SocialAccountLink {
|
package/src/proto/event.proto
CHANGED
|
@@ -95,10 +95,12 @@ message EventUpgrade {
|
|
|
95
95
|
int32 remainingQty = 4;
|
|
96
96
|
int32 purchaseLimit = 5;
|
|
97
97
|
bool complimentary = 6;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
string
|
|
101
|
-
|
|
98
|
+
string complimentaryWith = 7;
|
|
99
|
+
int32 complimentaryQty = 8;
|
|
100
|
+
repeated string ticketTypeIds = 9;
|
|
101
|
+
string imageUrl = 10;
|
|
102
|
+
string description = 11;
|
|
103
|
+
bool visible = 12;
|
|
102
104
|
}
|
|
103
105
|
|
|
104
106
|
message EventPromotion {
|
|
@@ -110,6 +112,11 @@ message EventPromotion {
|
|
|
110
112
|
repeated string ticketTypeIds = 5;
|
|
111
113
|
repeated string upgradeIds = 6;
|
|
112
114
|
bool active = 7;
|
|
115
|
+
int32 startsAt = 8;
|
|
116
|
+
int32 endsAt = 9;
|
|
117
|
+
int32 useLimit = 10;
|
|
118
|
+
string discountType = 11;
|
|
119
|
+
int32 discountValue = 12;
|
|
113
120
|
}
|
|
114
121
|
|
|
115
122
|
message EventCustomFields {
|
|
@@ -121,7 +128,8 @@ message EventCustomFields {
|
|
|
121
128
|
int32 minValue = 5;
|
|
122
129
|
int32 maxValue = 6;
|
|
123
130
|
bool required = 7;
|
|
124
|
-
|
|
131
|
+
repeated string options = 8;
|
|
132
|
+
bool active = 9;
|
|
125
133
|
}
|
|
126
134
|
|
|
127
135
|
message TicketExchange {
|
package/src/schemas/Artist.ts
CHANGED
|
@@ -2,6 +2,10 @@ import shortid from 'shortid';
|
|
|
2
2
|
import Metrics from './Metrics';
|
|
3
3
|
|
|
4
4
|
const ArtistPressKit = {
|
|
5
|
+
_id: {
|
|
6
|
+
type: String,
|
|
7
|
+
default: shortid.generate,
|
|
8
|
+
},
|
|
5
9
|
title: {
|
|
6
10
|
type: String,
|
|
7
11
|
required: false,
|
|
@@ -31,6 +35,10 @@ const ArtistPressKit = {
|
|
|
31
35
|
};
|
|
32
36
|
|
|
33
37
|
const ArtistContact = {
|
|
38
|
+
_id: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: shortid.generate,
|
|
41
|
+
},
|
|
34
42
|
firstName: {
|
|
35
43
|
type: String,
|
|
36
44
|
required: false,
|
|
@@ -58,6 +66,10 @@ const ArtistContact = {
|
|
|
58
66
|
};
|
|
59
67
|
|
|
60
68
|
const SocialLink = {
|
|
69
|
+
_id: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: shortid.generate,
|
|
72
|
+
},
|
|
61
73
|
platform: {
|
|
62
74
|
type: String,
|
|
63
75
|
required: false,
|
package/src/schemas/Event.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import shortid from 'shortid';
|
|
2
2
|
import { EventAgeEnum, SendQRCodeEnum, EventProcessAsEnum } from '../interfaces/IEvent';
|
|
3
|
+
import { UpgradeTypeComplimentaryWithEnum } from "../interfaces/IEventUpgrade";
|
|
3
4
|
import Address from './Address';
|
|
4
5
|
import Metrics from './Metrics';
|
|
5
6
|
|
|
@@ -41,6 +42,11 @@ const EventCustomFields = {
|
|
|
41
42
|
required: true,
|
|
42
43
|
default: false,
|
|
43
44
|
},
|
|
45
|
+
options: [{
|
|
46
|
+
type: String,
|
|
47
|
+
required: true,
|
|
48
|
+
default: [],
|
|
49
|
+
}],
|
|
44
50
|
active: {
|
|
45
51
|
type: Boolean,
|
|
46
52
|
required: true,
|
|
@@ -59,35 +65,55 @@ const EventPromotion = {
|
|
|
59
65
|
},
|
|
60
66
|
type: {
|
|
61
67
|
type: String,
|
|
62
|
-
required: true
|
|
68
|
+
required: true,
|
|
63
69
|
},
|
|
64
70
|
totalQty: {
|
|
65
71
|
type: Number,
|
|
66
|
-
required: true
|
|
72
|
+
required: true,
|
|
67
73
|
},
|
|
68
74
|
remainingQty: {
|
|
69
75
|
type: Number,
|
|
70
|
-
required: true
|
|
76
|
+
required: true,
|
|
71
77
|
},
|
|
72
78
|
ticketTypeIds: [
|
|
73
79
|
{
|
|
74
80
|
type: String,
|
|
75
81
|
required: true,
|
|
76
|
-
default: []
|
|
77
|
-
}
|
|
82
|
+
default: [],
|
|
83
|
+
},
|
|
78
84
|
],
|
|
79
85
|
upgradeIds: [
|
|
80
86
|
{
|
|
81
87
|
type: String,
|
|
82
88
|
required: true,
|
|
83
|
-
default: []
|
|
84
|
-
}
|
|
89
|
+
default: [],
|
|
90
|
+
},
|
|
85
91
|
],
|
|
86
92
|
active: {
|
|
87
93
|
type: Boolean,
|
|
88
94
|
required: true,
|
|
89
95
|
default: true,
|
|
90
|
-
}
|
|
96
|
+
},
|
|
97
|
+
startsAt: {
|
|
98
|
+
type: Number,
|
|
99
|
+
required: true,
|
|
100
|
+
},
|
|
101
|
+
endsAt: {
|
|
102
|
+
type: Number,
|
|
103
|
+
required: true,
|
|
104
|
+
},
|
|
105
|
+
useLimit: {
|
|
106
|
+
type: Number,
|
|
107
|
+
required: true,
|
|
108
|
+
},
|
|
109
|
+
discountType: {
|
|
110
|
+
type: String,
|
|
111
|
+
required: true,
|
|
112
|
+
},
|
|
113
|
+
discountValue: {
|
|
114
|
+
type: String,
|
|
115
|
+
required: true,
|
|
116
|
+
},
|
|
91
117
|
};
|
|
92
118
|
|
|
93
119
|
// I'm not sure why this is here or if we need it
|
|
@@ -161,6 +187,16 @@ const EventUpgrade = {
|
|
|
161
187
|
required: true,
|
|
162
188
|
default: false,
|
|
163
189
|
},
|
|
190
|
+
complimentaryWith: {
|
|
191
|
+
type: String,
|
|
192
|
+
required: false,
|
|
193
|
+
default: UpgradeTypeComplimentaryWithEnum.Order,
|
|
194
|
+
},
|
|
195
|
+
complimentaryQty: {
|
|
196
|
+
type: String,
|
|
197
|
+
required: false,
|
|
198
|
+
default: 1,
|
|
199
|
+
},
|
|
164
200
|
ticketTypeIds: [
|
|
165
201
|
{
|
|
166
202
|
type: String,
|
package/src/utils/EventUtil.ts
CHANGED
|
@@ -2,69 +2,86 @@ import * as Time from '@sellout/utils/.dist/time';
|
|
|
2
2
|
|
|
3
3
|
export default {
|
|
4
4
|
hasBeenAnnouced(event): boolean {
|
|
5
|
-
const {
|
|
5
|
+
const {
|
|
6
|
+
schedule: { announceAt },
|
|
7
|
+
} = event;
|
|
6
8
|
const now = Time.now();
|
|
7
9
|
return announceAt < now;
|
|
8
|
-
},
|
|
10
|
+
},
|
|
9
11
|
isAnnounced(event): boolean {
|
|
10
|
-
const {
|
|
12
|
+
const {
|
|
13
|
+
schedule: { announceAt, ticketsAt },
|
|
14
|
+
} = event;
|
|
11
15
|
const now = Time.now();
|
|
12
|
-
return announceAt <
|
|
16
|
+
return announceAt < now && now < ticketsAt;
|
|
13
17
|
},
|
|
14
18
|
isOnSale(event): boolean {
|
|
15
|
-
const {
|
|
19
|
+
const {
|
|
20
|
+
schedule: { ticketsAt, ticketsEndAt },
|
|
21
|
+
} = event;
|
|
16
22
|
const now = Time.now();
|
|
17
23
|
return ticketsAt < now && now < ticketsEndAt;
|
|
18
24
|
},
|
|
19
25
|
isInProgress(event): boolean {
|
|
20
|
-
const {
|
|
26
|
+
const {
|
|
27
|
+
schedule: { startsAt, endsAt },
|
|
28
|
+
} = event;
|
|
21
29
|
const now = Time.now();
|
|
22
30
|
return startsAt < now && now < endsAt;
|
|
23
31
|
},
|
|
24
32
|
saleHasEnded(event): boolean {
|
|
25
|
-
const {
|
|
33
|
+
const {
|
|
34
|
+
schedule: { ticketsEndAt },
|
|
35
|
+
} = event;
|
|
26
36
|
const now = Time.now();
|
|
27
37
|
return ticketsEndAt < now;
|
|
28
38
|
},
|
|
29
39
|
hasEnded(event): boolean {
|
|
30
|
-
const {
|
|
40
|
+
const {
|
|
41
|
+
schedule: { endsAt },
|
|
42
|
+
} = event;
|
|
31
43
|
const now = Time.now();
|
|
32
44
|
return endsAt < now;
|
|
33
45
|
},
|
|
34
|
-
hasActivePreSalePromotions(event): boolean{
|
|
35
|
-
return
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
46
|
+
hasActivePreSalePromotions(event): boolean {
|
|
47
|
+
return (
|
|
48
|
+
event.promotions
|
|
49
|
+
.filter((promotion) => promotion.type === "Pre-Sale Code")
|
|
50
|
+
.filter((promotion) => promotion.active).length > 0
|
|
51
|
+
);
|
|
39
52
|
},
|
|
40
53
|
qrCodeEmailAt(event): number {
|
|
41
|
-
const {
|
|
42
|
-
|
|
54
|
+
const {
|
|
55
|
+
performances: [performance],
|
|
56
|
+
} = event;
|
|
57
|
+
const {
|
|
58
|
+
schedule: { doorsAt, startsAt },
|
|
59
|
+
} = performance;
|
|
43
60
|
|
|
44
|
-
if(event.sendQRCode ===
|
|
61
|
+
if (event.sendQRCode === "Upon Order") {
|
|
45
62
|
return Time.now();
|
|
46
63
|
}
|
|
47
64
|
|
|
48
|
-
if(event.sendQRCode ===
|
|
65
|
+
if (event.sendQRCode === "Two Weeks Before Show") {
|
|
49
66
|
const TWO_WEEKS = 14 * 24 * 60 * 60;
|
|
50
67
|
return startsAt - TWO_WEEKS;
|
|
51
68
|
}
|
|
52
69
|
|
|
53
|
-
return doorsAt -
|
|
70
|
+
return doorsAt - 600;
|
|
54
71
|
},
|
|
55
72
|
shouldSendOrderReceipt(event): boolean {
|
|
56
73
|
const now = Time.now();
|
|
57
74
|
const qrCodeEmailAt = this.qrCodeEmailAt(event);
|
|
58
75
|
|
|
59
|
-
// Never send a receipt if we are
|
|
76
|
+
// Never send a receipt if we are
|
|
60
77
|
// send a qr code upon order
|
|
61
|
-
if (event.sendQRCode ===
|
|
78
|
+
if (event.sendQRCode === "Upon Order") {
|
|
62
79
|
return false;
|
|
63
80
|
}
|
|
64
81
|
|
|
65
82
|
// Only send a receipt if QR codes for
|
|
66
83
|
// the event haven't already gone out
|
|
67
|
-
if(qrCodeEmailAt > now) {
|
|
84
|
+
if (qrCodeEmailAt > now) {
|
|
68
85
|
return true;
|
|
69
86
|
}
|
|
70
87
|
|
|
@@ -75,59 +92,61 @@ export default {
|
|
|
75
92
|
****************************************************************************************/
|
|
76
93
|
venueIds(event): string[] {
|
|
77
94
|
let venueIds = [event.venueId];
|
|
78
|
-
event.performances.forEach(performance => {
|
|
79
|
-
venueIds = venueIds.concat(performance.venueStageId)
|
|
95
|
+
event.performances.forEach((performance) => {
|
|
96
|
+
venueIds = venueIds.concat(performance.venueStageId);
|
|
80
97
|
});
|
|
81
98
|
venueIds = [...new Set(venueIds)];
|
|
82
|
-
venueIds = venueIds.filter(v => !!v);
|
|
99
|
+
venueIds = venueIds.filter((v) => !!v);
|
|
83
100
|
return venueIds;
|
|
84
101
|
},
|
|
85
102
|
seatingId(event): string {
|
|
86
|
-
return event._id.replace(
|
|
103
|
+
return event._id.replace("_", "SAMH");
|
|
87
104
|
},
|
|
88
105
|
/****************************************************************************************
|
|
89
106
|
Artist
|
|
90
107
|
****************************************************************************************/
|
|
91
108
|
artistIds(event): string[] {
|
|
92
109
|
let artistIds = [];
|
|
93
|
-
event.performances.forEach(performance => {
|
|
110
|
+
event.performances.forEach((performance) => {
|
|
94
111
|
artistIds = artistIds
|
|
95
112
|
.concat(performance.headliningArtistIds)
|
|
96
113
|
.concat(performance.openingArtistIds);
|
|
97
|
-
});
|
|
114
|
+
});
|
|
98
115
|
artistIds = [...new Set(artistIds)];
|
|
99
|
-
artistIds = artistIds.filter(a => !!a);
|
|
116
|
+
artistIds = artistIds.filter((a) => !!a);
|
|
100
117
|
return artistIds;
|
|
101
118
|
},
|
|
102
119
|
headliningArtistIds(event): string[] {
|
|
103
120
|
let artistIds = [];
|
|
104
|
-
event.performances.forEach(performance => {
|
|
105
|
-
artistIds = artistIds
|
|
106
|
-
.concat(performance.headliningArtistIds)
|
|
121
|
+
event.performances.forEach((performance) => {
|
|
122
|
+
artistIds = artistIds.concat(performance.headliningArtistIds);
|
|
107
123
|
});
|
|
108
124
|
artistIds = [...new Set(artistIds)];
|
|
109
|
-
artistIds = artistIds.filter(a => !!a);
|
|
125
|
+
artistIds = artistIds.filter((a) => !!a);
|
|
110
126
|
return artistIds;
|
|
111
127
|
},
|
|
112
128
|
openingArtistIds(event): string[] {
|
|
113
129
|
let artistIds = [];
|
|
114
|
-
event.performances.forEach(performance => {
|
|
115
|
-
artistIds = artistIds
|
|
116
|
-
.concat(performance.openingArtistIds);
|
|
130
|
+
event.performances.forEach((performance) => {
|
|
131
|
+
artistIds = artistIds.concat(performance.openingArtistIds);
|
|
117
132
|
});
|
|
118
133
|
artistIds = [...new Set(artistIds)];
|
|
119
|
-
artistIds = artistIds.filter(a => !!a);
|
|
134
|
+
artistIds = artistIds.filter((a) => !!a);
|
|
120
135
|
return artistIds;
|
|
121
136
|
},
|
|
122
137
|
/****************************************************************************************
|
|
123
138
|
Tickets
|
|
124
139
|
****************************************************************************************/
|
|
125
140
|
ticketType(event, ticketTypeId): any {
|
|
126
|
-
return event.ticketTypes.find(
|
|
141
|
+
return event.ticketTypes.find(
|
|
142
|
+
(ticketType) => ticketType._id === ticketTypeId
|
|
143
|
+
);
|
|
127
144
|
},
|
|
128
145
|
remainingTicketQty(event, ticketTypeId: string | null = null): number {
|
|
129
146
|
if (ticketTypeId) {
|
|
130
|
-
let ticketType = event.ticketTypes.find(
|
|
147
|
+
let ticketType = event.ticketTypes.find(
|
|
148
|
+
(ticketType) => ticketType._id === ticketTypeId
|
|
149
|
+
);
|
|
131
150
|
if (!ticketType) return 0;
|
|
132
151
|
else return ticketType.remainingQty;
|
|
133
152
|
} else {
|
|
@@ -149,20 +168,24 @@ export default {
|
|
|
149
168
|
}, {});
|
|
150
169
|
},
|
|
151
170
|
getCurrentTierId(event, ticketTypeId: string): string {
|
|
152
|
-
const ticketType = event.ticketTypes.find(
|
|
171
|
+
const ticketType = event.ticketTypes.find(
|
|
172
|
+
(t) => t._id.toString() === ticketTypeId
|
|
173
|
+
);
|
|
153
174
|
const now = Time.now();
|
|
154
|
-
const tier = ticketType.tiers.find(
|
|
175
|
+
const tier = ticketType.tiers.find(
|
|
176
|
+
(tier) => tier.startsAt < now && now < tier.endsAt
|
|
177
|
+
);
|
|
155
178
|
return tier._id;
|
|
156
|
-
},
|
|
179
|
+
},
|
|
157
180
|
/****************************************************************************************
|
|
158
181
|
Upgrades
|
|
159
182
|
****************************************************************************************/
|
|
160
183
|
upgrade(event, upgradeId): any {
|
|
161
|
-
return event.upgrades.find(upgrades => upgrades._id === upgradeId);
|
|
184
|
+
return event.upgrades.find((upgrades) => upgrades._id === upgradeId);
|
|
162
185
|
},
|
|
163
186
|
remainingUpgradeQty(event, upgradeId: string | null = null): number {
|
|
164
187
|
if (upgradeId) {
|
|
165
|
-
let upgrade = event.upgrades.find(upgrade => upgrade._id === upgradeId);
|
|
188
|
+
let upgrade = event.upgrades.find((upgrade) => upgrade._id === upgradeId);
|
|
166
189
|
if (!upgrade) return 0;
|
|
167
190
|
else return upgrade.remainingQty;
|
|
168
191
|
} else {
|
|
@@ -183,4 +206,66 @@ export default {
|
|
|
183
206
|
return cur;
|
|
184
207
|
}, {});
|
|
185
208
|
},
|
|
186
|
-
|
|
209
|
+
/****************************************************************************************
|
|
210
|
+
Promotion
|
|
211
|
+
****************************************************************************************/
|
|
212
|
+
promotion(event, promotionId: string): any {
|
|
213
|
+
return event.promotions.find(
|
|
214
|
+
(promotions) => promotions._id === promotionId
|
|
215
|
+
);
|
|
216
|
+
},
|
|
217
|
+
// remainingUpgradeQty(event, upgradeId: string | null = null): number {
|
|
218
|
+
// if (upgradeId) {
|
|
219
|
+
// let upgrade = event.upgrades.find((upgrade) => upgrade._id === upgradeId);
|
|
220
|
+
// if (!upgrade) return 0;
|
|
221
|
+
// else return upgrade.remainingQty;
|
|
222
|
+
// } else {
|
|
223
|
+
// return event.upgrades.reduce((cur, next) => {
|
|
224
|
+
// return cur + next.remainingQty;
|
|
225
|
+
// }, 0);
|
|
226
|
+
// }
|
|
227
|
+
// },
|
|
228
|
+
// remainingQtyByUpgrades(event): object {
|
|
229
|
+
// return event.upgrades.reduce((cur, upgrade) => {
|
|
230
|
+
// cur[upgrade._id] = this.remainingUpgradeQty(event, upgrade._id);
|
|
231
|
+
// return cur;
|
|
232
|
+
// }, {});
|
|
233
|
+
// },
|
|
234
|
+
// purchaseLimitByUpgrades(event): object {
|
|
235
|
+
// return event.upgrades.reduce((cur, upgrade) => {
|
|
236
|
+
// cur[upgrade._id] = upgrade.purchaseLimit;
|
|
237
|
+
// return cur;
|
|
238
|
+
// }, {});
|
|
239
|
+
// },
|
|
240
|
+
/****************************************************************************************
|
|
241
|
+
Promotion
|
|
242
|
+
****************************************************************************************/
|
|
243
|
+
customField(event, customFieldId: string): any {
|
|
244
|
+
return event.customFields.find(
|
|
245
|
+
(customField) => customField._id === customFieldId
|
|
246
|
+
);
|
|
247
|
+
},
|
|
248
|
+
// remainingUpgradeQty(event, upgradeId: string | null = null): number {
|
|
249
|
+
// if (upgradeId) {
|
|
250
|
+
// let upgrade = event.upgrades.find((upgrade) => upgrade._id === upgradeId);
|
|
251
|
+
// if (!upgrade) return 0;
|
|
252
|
+
// else return upgrade.remainingQty;
|
|
253
|
+
// } else {
|
|
254
|
+
// return event.upgrades.reduce((cur, next) => {
|
|
255
|
+
// return cur + next.remainingQty;
|
|
256
|
+
// }, 0);
|
|
257
|
+
// }
|
|
258
|
+
// },
|
|
259
|
+
// remainingQtyByUpgrades(event): object {
|
|
260
|
+
// return event.upgrades.reduce((cur, upgrade) => {
|
|
261
|
+
// cur[upgrade._id] = this.remainingUpgradeQty(event, upgrade._id);
|
|
262
|
+
// return cur;
|
|
263
|
+
// }, {});
|
|
264
|
+
// },
|
|
265
|
+
// purchaseLimitByUpgrades(event): object {
|
|
266
|
+
// return event.upgrades.reduce((cur, upgrade) => {
|
|
267
|
+
// cur[upgrade._id] = upgrade.purchaseLimit;
|
|
268
|
+
// return cur;
|
|
269
|
+
// }, {});
|
|
270
|
+
// },
|
|
271
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import IFee, { FeeAppliedByEnum } from '../interfaces/IFee";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
processingFees(fees: IFee[]) {
|
|
5
|
+
return fees.filter((fee: IFee) => {
|
|
6
|
+
if (fee.appliedBy === FeeAppliedByEnum.Sellout || fee.appliedBy === FeeAppliedByEnum.Stripe) {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
return false;
|
|
10
|
+
});
|
|
11
|
+
},
|
|
12
|
+
selloutFees(fees: IFee[]) {
|
|
13
|
+
return fees.filter((fee: IFee) => {
|
|
14
|
+
if (fee.appliedBy === FeeAppliedByEnum.Sellout) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
return false;
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
stripeFees(fees: IFee[]) {
|
|
21
|
+
return fees.filter((fee: IFee) => {
|
|
22
|
+
if (fee.appliedBy === FeeAppliedByEnum.Stripe) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
return true;
|
|
26
|
+
});
|
|
27
|
+
},
|
|
28
|
+
promoterFees(fees: IFee[]) {
|
|
29
|
+
return fees.filter((fee: IFee) => {
|
|
30
|
+
if (fee.appliedBy === FeeAppliedByEnum.Sellout || fee.appliedBy === FeeAppliedByEnum.Stripe) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
return true;
|
|
34
|
+
});
|
|
35
|
+
},
|
|
36
|
+
};
|