@chevre/domain 21.2.0-alpha.1 → 21.2.0-alpha.2
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/lib/chevre/repo/itemAvailability/screeningEvent.d.ts +0 -2
- package/lib/chevre/repo/itemAvailability/screeningEvent.js +17 -5
- package/lib/chevre/service/assetTransaction/reserve.js +66 -3
- package/lib/chevre/service/offer.d.ts +11 -24
- package/lib/chevre/service/offer.js +16 -114
- package/package.json +1 -1
|
@@ -163,15 +163,27 @@ class RedisRepository {
|
|
|
163
163
|
const fields = params.offers.map((o) => {
|
|
164
164
|
return RedisRepository.offer2field(o);
|
|
165
165
|
});
|
|
166
|
+
// Array reply: list of values associated with the given fields, in the same order as they are requested.
|
|
166
167
|
const result = yield this.redisClient.hmGet(key, fields);
|
|
167
168
|
if (!Array.isArray(result)) {
|
|
168
169
|
throw new factory.errors.ServiceUnavailable(`searchAvailability got non-array: ${typeof result}`);
|
|
169
170
|
}
|
|
170
|
-
return params.offers.map((o, index) => {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
171
|
+
// return params.offers.map((o, index) => {
|
|
172
|
+
// const value4offer = result[index];
|
|
173
|
+
// return {
|
|
174
|
+
// ...o,
|
|
175
|
+
// availability: (typeof value4offer === 'string')
|
|
176
|
+
// ? factory.itemAvailability.OutOfStock // ホルダーが存在すればOutOfStock
|
|
177
|
+
// : factory.itemAvailability.InStock
|
|
178
|
+
// };
|
|
179
|
+
// });
|
|
180
|
+
// availabilityのみ返却(2023-04-17~)
|
|
181
|
+
return result.map((holder) => {
|
|
182
|
+
return {
|
|
183
|
+
availability: (typeof holder === 'string')
|
|
184
|
+
? factory.itemAvailability.OutOfStock // ホルダーが存在すればOutOfStock
|
|
185
|
+
: factory.itemAvailability.InStock
|
|
186
|
+
};
|
|
175
187
|
});
|
|
176
188
|
});
|
|
177
189
|
}
|
|
@@ -119,7 +119,7 @@ function addReservations(params) {
|
|
|
119
119
|
ticketOffers = searchEventTicketOffersResult.ticketOffers;
|
|
120
120
|
availableOffers = searchEventTicketOffersResult.unitPriceOffers;
|
|
121
121
|
}
|
|
122
|
-
const availableSeatOffers = yield searchAvailableSeatOffers({ acceptedOffers, event
|
|
122
|
+
const availableSeatOffers = yield searchAvailableSeatOffers({ acceptedOffers, event })(repos);
|
|
123
123
|
// 仮予約作成
|
|
124
124
|
const { acceptedOffers4transactionObject, objectSubReservations } = yield createAcceptedOffers4transactionObject({
|
|
125
125
|
acceptedOffers,
|
|
@@ -171,14 +171,77 @@ function addReservations(params) {
|
|
|
171
171
|
return transaction;
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* イベントに対する座席オファーを座席コードとセクションコード指定で検索する
|
|
176
|
+
*/
|
|
177
|
+
function searchEventSeatOffers(params) {
|
|
178
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
179
|
+
var _a, _b, _c, _d, _e, _f;
|
|
180
|
+
let offers = [];
|
|
181
|
+
// 座席指定利用可能かどうか
|
|
182
|
+
const eventOffers = params.event.offers;
|
|
183
|
+
const reservedSeatsAvailable = ((_b = (_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered.serviceOutput) === null || _a === void 0 ? void 0 : _a.reservedTicket) === null || _b === void 0 ? void 0 : _b.ticketedSeat) !== undefined;
|
|
184
|
+
if (reservedSeatsAvailable) {
|
|
185
|
+
// 座席タイプ価格仕様を検索
|
|
186
|
+
const priceSpecs = yield repos.priceSpecification.search({
|
|
187
|
+
project: { id: { $eq: params.event.project.id } },
|
|
188
|
+
typeOf: factory.priceSpecificationType.CategoryCodeChargeSpecification,
|
|
189
|
+
appliesToCategoryCode: {
|
|
190
|
+
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
const roomBranchCode = String((_d = (_c = eventOffers.itemOffered) === null || _c === void 0 ? void 0 : _c.availableChannel) === null || _d === void 0 ? void 0 : _d.serviceLocation.branchCode);
|
|
194
|
+
const movieTheaterBranchCode = String((_f = (_e = eventOffers.itemOffered) === null || _e === void 0 ? void 0 : _e.availableChannel) === null || _f === void 0 ? void 0 : _f.serviceLocation.containedInPlace.branchCode);
|
|
195
|
+
const seats = yield repos.place.searchSeats({
|
|
196
|
+
project: { id: { $eq: params.event.project.id } },
|
|
197
|
+
branchCode: { $in: params.branchCode.$in },
|
|
198
|
+
containedInPlace: {
|
|
199
|
+
branchCode: {
|
|
200
|
+
$in: params.containedInPlace.branchCode.$in
|
|
201
|
+
},
|
|
202
|
+
containedInPlace: {
|
|
203
|
+
branchCode: { $eq: roomBranchCode },
|
|
204
|
+
containedInPlace: {
|
|
205
|
+
branchCode: { $eq: movieTheaterBranchCode }
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
$projection: params.$projection
|
|
210
|
+
});
|
|
211
|
+
if (seats.length > 0) {
|
|
212
|
+
const availabilities = yield repos.eventAvailability.searchAvailability({
|
|
213
|
+
eventId: params.event.id,
|
|
214
|
+
startDate: moment(params.event.startDate)
|
|
215
|
+
.toDate(),
|
|
216
|
+
offers: seats.map((s) => {
|
|
217
|
+
var _a;
|
|
218
|
+
return {
|
|
219
|
+
seatNumber: s.branchCode,
|
|
220
|
+
seatSection: (_a = s.containedInPlace) === null || _a === void 0 ? void 0 : _a.branchCode
|
|
221
|
+
};
|
|
222
|
+
})
|
|
223
|
+
});
|
|
224
|
+
offers = seats.map((seat, index) => {
|
|
225
|
+
return OfferService.addOffers2Seat({
|
|
226
|
+
seat,
|
|
227
|
+
// unavailableOffers: [],
|
|
228
|
+
availability: availabilities[index].availability,
|
|
229
|
+
priceSpecs
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return offers;
|
|
235
|
+
});
|
|
236
|
+
}
|
|
174
237
|
function searchAvailableSeatOffers(params) {
|
|
175
238
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
176
239
|
// 座席オファー検索(必要な分だけ)
|
|
177
240
|
const { acceptedSeatNumbers, acceptedSeatSections } = getAcceptedSeatNumbersAndSeatSections({ acceptedOffers: params.acceptedOffers });
|
|
178
|
-
return
|
|
241
|
+
return searchEventSeatOffers({
|
|
179
242
|
branchCode: { $in: acceptedSeatNumbers },
|
|
180
243
|
containedInPlace: { branchCode: { $in: acceptedSeatSections } },
|
|
181
|
-
event:
|
|
244
|
+
event: params.event,
|
|
182
245
|
// 試しに冗長な情報を非取得にしてみる
|
|
183
246
|
$projection: {
|
|
184
247
|
'containedInPlace.containedInPlace': 0
|
|
@@ -11,35 +11,22 @@ import * as MoneyTransferOfferService from './offer/moneyTransfer';
|
|
|
11
11
|
import * as ProductOfferService from './offer/product';
|
|
12
12
|
export { EventOfferService as event, EventServiceByCOAOfferService as eventServiceByCOA, MoneyTransferOfferService as moneyTransfer, ProductOfferService as product };
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* 座席にオファー情報を付加する
|
|
15
15
|
*/
|
|
16
|
-
export declare function
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
event: {
|
|
26
|
-
id: string;
|
|
27
|
-
};
|
|
28
|
-
$projection?: {
|
|
29
|
-
[key: string]: number;
|
|
30
|
-
};
|
|
31
|
-
}): (repos: {
|
|
32
|
-
event: EventRepo;
|
|
33
|
-
priceSpecification: PriceSpecificationRepo;
|
|
34
|
-
eventAvailability: EventAvailabilityRepo;
|
|
35
|
-
place: PlaceRepo;
|
|
36
|
-
}) => Promise<factory.place.seat.IPlaceWithOffer[]>;
|
|
16
|
+
export declare function addOffers2Seat(params: {
|
|
17
|
+
seat: factory.place.seat.IPlace;
|
|
18
|
+
availability: factory.itemAvailability;
|
|
19
|
+
/**
|
|
20
|
+
* 座席区分加算料金
|
|
21
|
+
*/
|
|
22
|
+
priceSpecs: factory.priceSpecification.IPriceSpecification<factory.priceSpecificationType.CategoryCodeChargeSpecification>[];
|
|
23
|
+
}): factory.place.seat.IPlaceWithOffer;
|
|
37
24
|
/**
|
|
38
25
|
* イベントに対する座席オファーを検索する
|
|
39
26
|
*/
|
|
40
27
|
export declare function searchEventSeatOffersWithPaging(params: {
|
|
41
|
-
limit
|
|
42
|
-
page
|
|
28
|
+
limit: number;
|
|
29
|
+
page: number;
|
|
43
30
|
branchCode?: {
|
|
44
31
|
$eq?: string;
|
|
45
32
|
};
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.createAggregateScreeningEventIfNotExist = exports.onEventChanged = exports.searchEventSeatOffersWithPaging = exports.
|
|
12
|
+
exports.createAggregateScreeningEventIfNotExist = exports.onEventChanged = exports.searchEventSeatOffersWithPaging = exports.addOffers2Seat = exports.product = exports.moneyTransfer = exports.eventServiceByCOA = exports.event = void 0;
|
|
13
13
|
const moment = require("moment");
|
|
14
14
|
const factory = require("../factory");
|
|
15
15
|
const EventOfferService = require("./offer/event");
|
|
@@ -24,121 +24,33 @@ exports.product = ProductOfferService;
|
|
|
24
24
|
* 座席にオファー情報を付加する
|
|
25
25
|
*/
|
|
26
26
|
function addOffers2Seat(params) {
|
|
27
|
-
const seatNumber = params.seat.branchCode;
|
|
28
|
-
const unavailableOffer = params.unavailableOffers.find((o) => o.seatSection === params.seatSection && o.seatNumber === seatNumber);
|
|
29
|
-
const priceComponent = [];
|
|
30
27
|
// 座席タイプが指定されていれば、適用される価格仕様を構成要素に追加
|
|
31
28
|
const seatingTypes = (Array.isArray(params.seat.seatingType))
|
|
32
29
|
? params.seat.seatingType
|
|
33
|
-
: (typeof params.seat.seatingType === 'string' && params.seat.seatingType.length > 0) ? [params.seat.seatingType]
|
|
34
|
-
|
|
35
|
-
priceComponent.push(...params.priceSpecs.filter((s) => {
|
|
30
|
+
: (typeof params.seat.seatingType === 'string' && params.seat.seatingType.length > 0) ? [params.seat.seatingType] : [];
|
|
31
|
+
const priceComponent = params.priceSpecs.filter((s) => {
|
|
36
32
|
// 適用カテゴリーコードに座席タイプが含まれる価格仕様を検索
|
|
37
33
|
return (Array.isArray(s.appliesToCategoryCode))
|
|
38
34
|
&& s.appliesToCategoryCode.some((categoryCode) => {
|
|
39
|
-
return seatingTypes.includes(categoryCode.codeValue)
|
|
40
|
-
|
|
41
|
-
&& categoryCode.inCodeSet.identifier === factory.categoryCode.CategorySetIdentifier.SeatingType;
|
|
35
|
+
return seatingTypes.includes(categoryCode.codeValue);
|
|
36
|
+
// && categoryCode.inCodeSet.identifier === factory.categoryCode.CategorySetIdentifier.SeatingType;
|
|
42
37
|
});
|
|
43
|
-
})
|
|
44
|
-
// 最適化(2022-11-15~)
|
|
38
|
+
});
|
|
45
39
|
const priceSpecification = {
|
|
46
40
|
typeOf: factory.priceSpecificationType.CompoundPriceSpecification,
|
|
47
|
-
|
|
48
|
-
// valueAddedTaxIncluded: true,
|
|
49
|
-
priceComponent: priceComponent
|
|
41
|
+
priceComponent
|
|
50
42
|
};
|
|
51
|
-
let availability =
|
|
52
|
-
|
|
53
|
-
: factory.itemAvailability.InStock;
|
|
54
|
-
if (params.availability !== undefined) {
|
|
43
|
+
let availability = factory.itemAvailability.InStock;
|
|
44
|
+
if (typeof params.availability === 'string') {
|
|
55
45
|
availability = params.availability;
|
|
56
46
|
}
|
|
57
47
|
return Object.assign(Object.assign({}, params.seat), { offers: [{
|
|
58
|
-
// 最適化(2022-11-15~)
|
|
59
|
-
// project: params.project,
|
|
60
48
|
typeOf: factory.offerType.Offer,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
priceSpecification: priceSpecification
|
|
49
|
+
availability,
|
|
50
|
+
priceSpecification
|
|
64
51
|
}] });
|
|
65
52
|
}
|
|
66
|
-
|
|
67
|
-
* イベントに対する座席オファーを座席コードとセクションコード指定で検索する
|
|
68
|
-
*/
|
|
69
|
-
function searchEventSeatOffers(params) {
|
|
70
|
-
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
71
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
72
|
-
let offers = [];
|
|
73
|
-
// イベント取得属性最適化(2023-01-23~)
|
|
74
|
-
// const event = await repos.event.findById<factory.eventType.ScreeningEvent | factory.eventType.Event>({
|
|
75
|
-
// id: params.event.id
|
|
76
|
-
// });
|
|
77
|
-
const event = yield repos.event.findMinimizedIndividualEventById({
|
|
78
|
-
id: params.event.id
|
|
79
|
-
});
|
|
80
|
-
// 座席指定利用可能かどうか
|
|
81
|
-
const eventOffers = event.offers;
|
|
82
|
-
const reservedSeatsAvailable = ((_b = (_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered.serviceOutput) === null || _a === void 0 ? void 0 : _a.reservedTicket) === null || _b === void 0 ? void 0 : _b.ticketedSeat) !== undefined;
|
|
83
|
-
if (reservedSeatsAvailable) {
|
|
84
|
-
// 座席タイプ価格仕様を検索
|
|
85
|
-
const priceSpecs = yield repos.priceSpecification.search({
|
|
86
|
-
project: { id: { $eq: event.project.id } },
|
|
87
|
-
typeOf: factory.priceSpecificationType.CategoryCodeChargeSpecification,
|
|
88
|
-
appliesToCategoryCode: {
|
|
89
|
-
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
// const roomBranchCode = event.location.branchCode;
|
|
93
|
-
// const movieTheaterBranchCode = event.superEvent.location.branchCode;
|
|
94
|
-
const roomBranchCode = String((_d = (_c = eventOffers.itemOffered) === null || _c === void 0 ? void 0 : _c.availableChannel) === null || _d === void 0 ? void 0 : _d.serviceLocation.branchCode);
|
|
95
|
-
const movieTheaterBranchCode = String((_f = (_e = eventOffers.itemOffered) === null || _e === void 0 ? void 0 : _e.availableChannel) === null || _f === void 0 ? void 0 : _f.serviceLocation.containedInPlace.branchCode);
|
|
96
|
-
const seats = yield repos.place.searchSeats({
|
|
97
|
-
project: { id: { $eq: event.project.id } },
|
|
98
|
-
branchCode: { $in: (_g = params.branchCode) === null || _g === void 0 ? void 0 : _g.$in },
|
|
99
|
-
containedInPlace: {
|
|
100
|
-
branchCode: {
|
|
101
|
-
$in: (_j = (_h = params.containedInPlace) === null || _h === void 0 ? void 0 : _h.branchCode) === null || _j === void 0 ? void 0 : _j.$in
|
|
102
|
-
},
|
|
103
|
-
containedInPlace: {
|
|
104
|
-
branchCode: { $eq: roomBranchCode },
|
|
105
|
-
containedInPlace: {
|
|
106
|
-
branchCode: { $eq: movieTheaterBranchCode }
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
},
|
|
110
|
-
$projection: params.$projection
|
|
111
|
-
});
|
|
112
|
-
if (seats.length > 0) {
|
|
113
|
-
const availabilities = yield repos.eventAvailability.searchAvailability({
|
|
114
|
-
eventId: params.event.id,
|
|
115
|
-
startDate: moment(event.startDate)
|
|
116
|
-
.toDate(),
|
|
117
|
-
offers: seats.map((s) => {
|
|
118
|
-
var _a;
|
|
119
|
-
return {
|
|
120
|
-
seatNumber: s.branchCode,
|
|
121
|
-
seatSection: (_a = s.containedInPlace) === null || _a === void 0 ? void 0 : _a.branchCode
|
|
122
|
-
};
|
|
123
|
-
})
|
|
124
|
-
});
|
|
125
|
-
offers = seats.map((seat, index) => {
|
|
126
|
-
var _a;
|
|
127
|
-
return addOffers2Seat({
|
|
128
|
-
project: event.project,
|
|
129
|
-
seat: seat,
|
|
130
|
-
seatSection: (_a = seat.containedInPlace) === null || _a === void 0 ? void 0 : _a.branchCode,
|
|
131
|
-
unavailableOffers: [],
|
|
132
|
-
availability: availabilities[index].availability,
|
|
133
|
-
priceSpecs: priceSpecs
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
return offers;
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
exports.searchEventSeatOffers = searchEventSeatOffers;
|
|
53
|
+
exports.addOffers2Seat = addOffers2Seat;
|
|
142
54
|
/**
|
|
143
55
|
* イベントに対する座席オファーを検索する
|
|
144
56
|
*/
|
|
@@ -147,12 +59,7 @@ function searchEventSeatOffersWithPaging(params) {
|
|
|
147
59
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
148
60
|
let offers = [];
|
|
149
61
|
// イベント取得属性最適化(2023-01-23~)
|
|
150
|
-
|
|
151
|
-
// id: params.event.id
|
|
152
|
-
// });
|
|
153
|
-
const event = yield repos.event.findMinimizedIndividualEventById({
|
|
154
|
-
id: params.event.id
|
|
155
|
-
});
|
|
62
|
+
const event = yield repos.event.findMinimizedIndividualEventById({ id: params.event.id });
|
|
156
63
|
// 座席指定利用可能かどうか
|
|
157
64
|
const eventOffers = event.offers;
|
|
158
65
|
const reservedSeatsAvailable = ((_b = (_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered.serviceOutput) === null || _a === void 0 ? void 0 : _a.reservedTicket) === null || _b === void 0 ? void 0 : _b.ticketedSeat) !== undefined;
|
|
@@ -165,8 +72,6 @@ function searchEventSeatOffersWithPaging(params) {
|
|
|
165
72
|
inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
|
|
166
73
|
}
|
|
167
74
|
});
|
|
168
|
-
// const roomBranchCode = event.location.branchCode;
|
|
169
|
-
// const movieTheaterBranchCode = event.superEvent.location.branchCode;
|
|
170
75
|
const roomBranchCode = String((_d = (_c = eventOffers.itemOffered) === null || _c === void 0 ? void 0 : _c.availableChannel) === null || _d === void 0 ? void 0 : _d.serviceLocation.branchCode);
|
|
171
76
|
const movieTheaterBranchCode = String((_f = (_e = eventOffers.itemOffered) === null || _e === void 0 ? void 0 : _e.availableChannel) === null || _f === void 0 ? void 0 : _f.serviceLocation.containedInPlace.branchCode);
|
|
172
77
|
const seats = yield repos.place.searchSeats(Object.assign(Object.assign({}, params), { project: { id: { $eq: event.project.id } }, containedInPlace: {
|
|
@@ -196,14 +101,11 @@ function searchEventSeatOffersWithPaging(params) {
|
|
|
196
101
|
})
|
|
197
102
|
});
|
|
198
103
|
offers = seats.map((seat, index) => {
|
|
199
|
-
var _a;
|
|
200
104
|
return addOffers2Seat({
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
seatSection: (_a = seat.containedInPlace) === null || _a === void 0 ? void 0 : _a.branchCode,
|
|
204
|
-
unavailableOffers: [],
|
|
105
|
+
seat,
|
|
106
|
+
// unavailableOffers: [],
|
|
205
107
|
availability: availabilities[index].availability,
|
|
206
|
-
priceSpecs
|
|
108
|
+
priceSpecs
|
|
207
109
|
});
|
|
208
110
|
});
|
|
209
111
|
}
|
package/package.json
CHANGED