@chevre/domain 20.2.0-alpha.11 → 20.2.0-alpha.13
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/example/src/chevre/aggregateEventReservation.ts +37 -0
- package/example/src/chevre/importEventsFromCOA.ts +8 -1
- package/lib/chevre/repo/event.js +101 -13
- package/lib/chevre/repo/trip.js +33 -27
- package/lib/chevre/service/event.d.ts +2 -0
- package/lib/chevre/service/event.js +20 -8
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +1 -5
- package/lib/chevre/service/task/importEventsFromCOA.js +3 -1
- package/package.json +3 -3
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
import * as redis from 'redis';
|
|
4
|
+
|
|
5
|
+
import { chevre } from '../../../lib/index';
|
|
6
|
+
|
|
7
|
+
// const project = { id: <string>process.env.PROJECT_ID };
|
|
8
|
+
|
|
9
|
+
async function main() {
|
|
10
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI);
|
|
11
|
+
const client = redis.createClient({
|
|
12
|
+
host: process.env.REDIS_HOST,
|
|
13
|
+
port: Number(process.env.REDIS_PORT),
|
|
14
|
+
password: process.env.REDIS_KEY
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
// const now = new Date();
|
|
18
|
+
await chevre.service.aggregation.event.aggregateScreeningEvent({
|
|
19
|
+
id: 'alb35u7m4'
|
|
20
|
+
})({
|
|
21
|
+
event: new chevre.repository.Event(mongoose.connection),
|
|
22
|
+
eventAvailability: new chevre.repository.itemAvailability.ScreeningEvent(client),
|
|
23
|
+
offer: new chevre.repository.Offer(mongoose.connection),
|
|
24
|
+
offerRateLimit: new chevre.repository.rateLimit.Offer(client),
|
|
25
|
+
place: new chevre.repository.Place(mongoose.connection),
|
|
26
|
+
product: new chevre.repository.Product(mongoose.connection),
|
|
27
|
+
project: new chevre.repository.Project(mongoose.connection),
|
|
28
|
+
reservation: new chevre.repository.Reservation(mongoose.connection),
|
|
29
|
+
task: new chevre.repository.Task(mongoose.connection)
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
main()
|
|
34
|
+
.then(() => {
|
|
35
|
+
console.log('success!');
|
|
36
|
+
})
|
|
37
|
+
.catch(console.error);
|
|
@@ -14,6 +14,7 @@ async function main() {
|
|
|
14
14
|
const categoryCodeRepo = new chevre.repository.CategoryCode(mongoose.connection);
|
|
15
15
|
const eventRepo = new chevre.repository.Event(mongoose.connection);
|
|
16
16
|
const placeRepo = new chevre.repository.Place(mongoose.connection);
|
|
17
|
+
const sellerRepo = new chevre.repository.Seller(mongoose.connection);
|
|
17
18
|
|
|
18
19
|
await chevre.service.event.importFromCOA({
|
|
19
20
|
project: {
|
|
@@ -28,7 +29,13 @@ async function main() {
|
|
|
28
29
|
.toDate(),
|
|
29
30
|
saveMovieTheater: false,
|
|
30
31
|
saveScreeningEventSeries: false
|
|
31
|
-
})({
|
|
32
|
+
})({
|
|
33
|
+
action: actionRepo,
|
|
34
|
+
categoryCode: categoryCodeRepo,
|
|
35
|
+
event: eventRepo,
|
|
36
|
+
place: placeRepo,
|
|
37
|
+
seller: sellerRepo
|
|
38
|
+
});
|
|
32
39
|
console.log('imported');
|
|
33
40
|
}
|
|
34
41
|
|
package/lib/chevre/repo/event.js
CHANGED
|
@@ -34,7 +34,7 @@ class MongoRepository {
|
|
|
34
34
|
}
|
|
35
35
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
36
36
|
static CREATE_MONGO_CONDITIONS(conditions) {
|
|
37
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
|
|
37
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26;
|
|
38
38
|
const andConditions = [{ typeOf: { $eq: conditions.typeOf } }];
|
|
39
39
|
const projectIdEq = (_b = (_a = conditions.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
40
40
|
if (typeof projectIdEq === 'string') {
|
|
@@ -131,8 +131,96 @@ class MongoRepository {
|
|
|
131
131
|
let params;
|
|
132
132
|
switch (conditions.typeOf) {
|
|
133
133
|
case factory.eventType.Event:
|
|
134
|
-
|
|
135
|
-
//
|
|
134
|
+
params = conditions;
|
|
135
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
136
|
+
/* istanbul ignore else */
|
|
137
|
+
if (params.offers !== undefined) {
|
|
138
|
+
const itemOfferedIdIn = (_k = (_j = params.offers.itemOffered) === null || _j === void 0 ? void 0 : _j.id) === null || _k === void 0 ? void 0 : _k.$in;
|
|
139
|
+
if (Array.isArray(itemOfferedIdIn)) {
|
|
140
|
+
andConditions.push({
|
|
141
|
+
'offers.itemOffered.id': {
|
|
142
|
+
$exists: true,
|
|
143
|
+
$in: itemOfferedIdIn
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
148
|
+
/* istanbul ignore else */
|
|
149
|
+
if (params.offers.itemOffered !== undefined) {
|
|
150
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
151
|
+
/* istanbul ignore else */
|
|
152
|
+
if (params.offers.itemOffered.serviceOutput !== undefined) {
|
|
153
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
154
|
+
/* istanbul ignore else */
|
|
155
|
+
if (params.offers.itemOffered.serviceOutput.reservedTicket !== undefined) {
|
|
156
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
157
|
+
/* istanbul ignore else */
|
|
158
|
+
if (params.offers.itemOffered.serviceOutput.reservedTicket.ticketedSeat !== undefined) {
|
|
159
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
160
|
+
/* istanbul ignore else */
|
|
161
|
+
if (Array.isArray(params.offers.itemOffered.serviceOutput.reservedTicket.ticketedSeat.typeOfs)) {
|
|
162
|
+
andConditions.push({
|
|
163
|
+
'offers.itemOffered.serviceOutput.reservedTicket.ticketedSeat.typeOf': {
|
|
164
|
+
$exists: true,
|
|
165
|
+
$in: params.offers.itemOffered.serviceOutput.reservedTicket.ticketedSeat.typeOfs
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
173
|
+
/* istanbul ignore else */
|
|
174
|
+
if (params.offers.itemOffered.serviceType !== undefined) {
|
|
175
|
+
// tslint:disable-next-line:no-single-line-block-comment
|
|
176
|
+
/* istanbul ignore else */
|
|
177
|
+
if (Array.isArray(params.offers.itemOffered.serviceType.ids)) {
|
|
178
|
+
andConditions.push({
|
|
179
|
+
'offers.itemOffered.serviceType.id': {
|
|
180
|
+
$exists: true,
|
|
181
|
+
$in: params.offers.itemOffered.serviceType.ids
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
const sellerMakesOfferElemMatch4event = (_o = (_m = (_l = params.offers) === null || _l === void 0 ? void 0 : _l.seller) === null || _m === void 0 ? void 0 : _m.makesOffer) === null || _o === void 0 ? void 0 : _o.$elemMatch;
|
|
189
|
+
if (typeof ((_p = sellerMakesOfferElemMatch4event === null || sellerMakesOfferElemMatch4event === void 0 ? void 0 : sellerMakesOfferElemMatch4event['availableAtOrFrom.id']) === null || _p === void 0 ? void 0 : _p.$eq) === 'string') {
|
|
190
|
+
andConditions.push({
|
|
191
|
+
'offers.seller.makesOffer': {
|
|
192
|
+
$exists: true,
|
|
193
|
+
$elemMatch: sellerMakesOfferElemMatch4event
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
const reservationForIdentifierEq = (_u = (_t = (_s = (_r = (_q = params.offers) === null || _q === void 0 ? void 0 : _q.itemOffered) === null || _r === void 0 ? void 0 : _r.serviceOutput) === null || _s === void 0 ? void 0 : _s.reservationFor) === null || _t === void 0 ? void 0 : _t.identifier) === null || _u === void 0 ? void 0 : _u.$eq;
|
|
198
|
+
if (typeof reservationForIdentifierEq === 'string') {
|
|
199
|
+
andConditions.push({
|
|
200
|
+
'offers.itemOffered.serviceOutput.reservationFor.identifier': {
|
|
201
|
+
$exists: true,
|
|
202
|
+
$eq: reservationForIdentifierEq
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
const reservationForArrivalBusStopBranchCodeEq = (_0 = (_z = (_y = (_x = (_w = (_v = params.offers) === null || _v === void 0 ? void 0 : _v.itemOffered) === null || _w === void 0 ? void 0 : _w.serviceOutput) === null || _x === void 0 ? void 0 : _x.reservationFor) === null || _y === void 0 ? void 0 : _y.arrivalBusStop) === null || _z === void 0 ? void 0 : _z.branchCode) === null || _0 === void 0 ? void 0 : _0.$eq;
|
|
207
|
+
if (typeof reservationForArrivalBusStopBranchCodeEq === 'string') {
|
|
208
|
+
andConditions.push({
|
|
209
|
+
'offers.itemOffered.serviceOutput.reservationFor.arrivalBusStop.branchCode': {
|
|
210
|
+
$exists: true,
|
|
211
|
+
$eq: reservationForArrivalBusStopBranchCodeEq
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
const reservationForDepartureBusStopBranchCodeEq = (_6 = (_5 = (_4 = (_3 = (_2 = (_1 = params.offers) === null || _1 === void 0 ? void 0 : _1.itemOffered) === null || _2 === void 0 ? void 0 : _2.serviceOutput) === null || _3 === void 0 ? void 0 : _3.reservationFor) === null || _4 === void 0 ? void 0 : _4.departureBusStop) === null || _5 === void 0 ? void 0 : _5.branchCode) === null || _6 === void 0 ? void 0 : _6.$eq;
|
|
216
|
+
if (typeof reservationForDepartureBusStopBranchCodeEq === 'string') {
|
|
217
|
+
andConditions.push({
|
|
218
|
+
'offers.itemOffered.serviceOutput.reservationFor.departureBusStop.branchCode': {
|
|
219
|
+
$exists: true,
|
|
220
|
+
$eq: reservationForDepartureBusStopBranchCodeEq
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
}
|
|
136
224
|
break;
|
|
137
225
|
case factory.eventType.ScreeningEvent:
|
|
138
226
|
params = conditions;
|
|
@@ -158,7 +246,7 @@ class MongoRepository {
|
|
|
158
246
|
}
|
|
159
247
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
160
248
|
/* istanbul ignore else */
|
|
161
|
-
const superEventLocationIdEq = (
|
|
249
|
+
const superEventLocationIdEq = (_9 = (_8 = (_7 = params.superEvent) === null || _7 === void 0 ? void 0 : _7.location) === null || _8 === void 0 ? void 0 : _8.id) === null || _9 === void 0 ? void 0 : _9.$eq;
|
|
162
250
|
if (typeof superEventLocationIdEq === 'string') {
|
|
163
251
|
andConditions.push({
|
|
164
252
|
'superEvent.location.id': {
|
|
@@ -246,7 +334,7 @@ class MongoRepository {
|
|
|
246
334
|
});
|
|
247
335
|
}
|
|
248
336
|
}
|
|
249
|
-
const itemOfferedIdIn = (
|
|
337
|
+
const itemOfferedIdIn = (_11 = (_10 = params.offers.itemOffered) === null || _10 === void 0 ? void 0 : _10.id) === null || _11 === void 0 ? void 0 : _11.$in;
|
|
250
338
|
if (Array.isArray(itemOfferedIdIn)) {
|
|
251
339
|
andConditions.push({
|
|
252
340
|
'offers.itemOffered.id': {
|
|
@@ -296,8 +384,8 @@ class MongoRepository {
|
|
|
296
384
|
}
|
|
297
385
|
}
|
|
298
386
|
}
|
|
299
|
-
const sellerMakesOfferElemMatch = (
|
|
300
|
-
if (typeof ((
|
|
387
|
+
const sellerMakesOfferElemMatch = (_14 = (_13 = (_12 = params.offers) === null || _12 === void 0 ? void 0 : _12.seller) === null || _13 === void 0 ? void 0 : _13.makesOffer) === null || _14 === void 0 ? void 0 : _14.$elemMatch;
|
|
388
|
+
if (typeof ((_15 = sellerMakesOfferElemMatch === null || sellerMakesOfferElemMatch === void 0 ? void 0 : sellerMakesOfferElemMatch['availableAtOrFrom.id']) === null || _15 === void 0 ? void 0 : _15.$eq) === 'string') {
|
|
301
389
|
andConditions.push({
|
|
302
390
|
'offers.seller.makesOffer': {
|
|
303
391
|
$exists: true,
|
|
@@ -334,7 +422,7 @@ class MongoRepository {
|
|
|
334
422
|
]
|
|
335
423
|
});
|
|
336
424
|
}
|
|
337
|
-
const locationIdEq = (
|
|
425
|
+
const locationIdEq = (_17 = (_16 = params.location) === null || _16 === void 0 ? void 0 : _16.id) === null || _17 === void 0 ? void 0 : _17.$eq;
|
|
338
426
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
339
427
|
/* istanbul ignore else */
|
|
340
428
|
if (typeof locationIdEq === 'string') {
|
|
@@ -356,7 +444,7 @@ class MongoRepository {
|
|
|
356
444
|
});
|
|
357
445
|
}
|
|
358
446
|
}
|
|
359
|
-
const workPerformedIdentifierIn = (
|
|
447
|
+
const workPerformedIdentifierIn = (_18 = params.workPerformed) === null || _18 === void 0 ? void 0 : _18.identifiers;
|
|
360
448
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
361
449
|
/* istanbul ignore else */
|
|
362
450
|
if (Array.isArray(workPerformedIdentifierIn)) {
|
|
@@ -367,7 +455,7 @@ class MongoRepository {
|
|
|
367
455
|
}
|
|
368
456
|
});
|
|
369
457
|
}
|
|
370
|
-
const videoFormatTypeOfEq = (
|
|
458
|
+
const videoFormatTypeOfEq = (_20 = (_19 = params.videoFormat) === null || _19 === void 0 ? void 0 : _19.typeOf) === null || _20 === void 0 ? void 0 : _20.$eq;
|
|
371
459
|
if (typeof videoFormatTypeOfEq === 'string') {
|
|
372
460
|
andConditions.push({
|
|
373
461
|
'videoFormat.typeOf': {
|
|
@@ -376,7 +464,7 @@ class MongoRepository {
|
|
|
376
464
|
}
|
|
377
465
|
});
|
|
378
466
|
}
|
|
379
|
-
const videoFormatTypeOfIn = (
|
|
467
|
+
const videoFormatTypeOfIn = (_22 = (_21 = params.videoFormat) === null || _21 === void 0 ? void 0 : _21.typeOf) === null || _22 === void 0 ? void 0 : _22.$in;
|
|
380
468
|
if (Array.isArray(videoFormatTypeOfIn)) {
|
|
381
469
|
andConditions.push({
|
|
382
470
|
'videoFormat.typeOf': {
|
|
@@ -385,7 +473,7 @@ class MongoRepository {
|
|
|
385
473
|
}
|
|
386
474
|
});
|
|
387
475
|
}
|
|
388
|
-
const soundFormatTypeOfEq = (
|
|
476
|
+
const soundFormatTypeOfEq = (_24 = (_23 = params.soundFormat) === null || _23 === void 0 ? void 0 : _23.typeOf) === null || _24 === void 0 ? void 0 : _24.$eq;
|
|
389
477
|
if (typeof soundFormatTypeOfEq === 'string') {
|
|
390
478
|
andConditions.push({
|
|
391
479
|
'soundFormat.typeOf': {
|
|
@@ -394,7 +482,7 @@ class MongoRepository {
|
|
|
394
482
|
}
|
|
395
483
|
});
|
|
396
484
|
}
|
|
397
|
-
const soundFormatTypeOfIn = (
|
|
485
|
+
const soundFormatTypeOfIn = (_26 = (_25 = params.soundFormat) === null || _25 === void 0 ? void 0 : _25.typeOf) === null || _26 === void 0 ? void 0 : _26.$in;
|
|
398
486
|
if (Array.isArray(soundFormatTypeOfIn)) {
|
|
399
487
|
andConditions.push({
|
|
400
488
|
'soundFormat.typeOf': {
|
package/lib/chevre/repo/trip.js
CHANGED
|
@@ -32,18 +32,46 @@ class MongoRepository {
|
|
|
32
32
|
}
|
|
33
33
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
34
34
|
static CREATE_MONGO_CONDITIONS(conditions) {
|
|
35
|
-
var _a, _b, _c;
|
|
35
|
+
var _a, _b, _c, _d, _e, _f;
|
|
36
36
|
const andConditions = [{ typeOf: { $eq: conditions.typeOf } }];
|
|
37
37
|
const projectIdEq = (_b = (_a = conditions.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
38
38
|
if (typeof projectIdEq === 'string') {
|
|
39
|
-
andConditions.push({
|
|
40
|
-
'project.id': { $eq: projectIdEq }
|
|
41
|
-
});
|
|
39
|
+
andConditions.push({ 'project.id': { $eq: projectIdEq } });
|
|
42
40
|
}
|
|
43
41
|
const idIn = (_c = conditions.id) === null || _c === void 0 ? void 0 : _c.$in;
|
|
44
42
|
if (Array.isArray(idIn)) {
|
|
43
|
+
andConditions.push({ _id: { $in: idIn } });
|
|
44
|
+
}
|
|
45
|
+
const identifierEq = (_d = conditions.identifier) === null || _d === void 0 ? void 0 : _d.$eq;
|
|
46
|
+
if (typeof identifierEq === 'string') {
|
|
47
|
+
andConditions.push({ identifier: { $eq: identifierEq } });
|
|
48
|
+
}
|
|
49
|
+
const nameRegex = (_e = conditions.name) === null || _e === void 0 ? void 0 : _e.$regex;
|
|
50
|
+
if (typeof nameRegex === 'string' && nameRegex.length > 0) {
|
|
51
|
+
andConditions.push({
|
|
52
|
+
$or: [
|
|
53
|
+
{
|
|
54
|
+
'name.ja': {
|
|
55
|
+
$exists: true,
|
|
56
|
+
$regex: new RegExp(nameRegex)
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
'name.en': {
|
|
61
|
+
$exists: true,
|
|
62
|
+
$regex: new RegExp(nameRegex)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
const additionalPropertyElemMatch = (_f = conditions.additionalProperty) === null || _f === void 0 ? void 0 : _f.$elemMatch;
|
|
69
|
+
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
45
70
|
andConditions.push({
|
|
46
|
-
|
|
71
|
+
additionalProperty: {
|
|
72
|
+
$exists: true,
|
|
73
|
+
$elemMatch: additionalPropertyElemMatch
|
|
74
|
+
}
|
|
47
75
|
});
|
|
48
76
|
}
|
|
49
77
|
return andConditions;
|
|
@@ -119,28 +147,6 @@ class MongoRepository {
|
|
|
119
147
|
if (p.attributes.typeOf === factory.tripType.BusTrip) {
|
|
120
148
|
// 上書き禁止属性を除外
|
|
121
149
|
const _a = p.attributes, { identifier, project, typeOf } = _a, updateFields = __rest(_a, ["identifier", "project", "typeOf"]);
|
|
122
|
-
bulkWriteOps.push({
|
|
123
|
-
updateOne: {
|
|
124
|
-
filter: {
|
|
125
|
-
_id: p.id,
|
|
126
|
-
typeOf: p.attributes.typeOf
|
|
127
|
-
},
|
|
128
|
-
// upsertの場合、createがありうるので属性を除外しない
|
|
129
|
-
update: Object.assign({ $setOnInsert: {
|
|
130
|
-
typeOf: p.attributes.typeOf,
|
|
131
|
-
project: p.attributes.project,
|
|
132
|
-
identifier: p.attributes.identifier
|
|
133
|
-
// ...(typeof p.attributes.remainingAttendeeCapacity === 'number')
|
|
134
|
-
// ? { remainingAttendeeCapacity: p.attributes.remainingAttendeeCapacity }
|
|
135
|
-
// : undefined
|
|
136
|
-
}, $set: updateFields }, (p.$unset !== undefined) ? { $unset: p.$unset } : undefined),
|
|
137
|
-
upsert
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
else if (p.attributes.typeOf === factory.tripType.BusTripSeries) {
|
|
142
|
-
// 上書き禁止属性を除外
|
|
143
|
-
const _b = p.attributes, { identifier, project, typeOf } = _b, updateFields = __rest(_b, ["identifier", "project", "typeOf"]);
|
|
144
150
|
bulkWriteOps.push({
|
|
145
151
|
updateOne: {
|
|
146
152
|
filter: {
|
|
@@ -3,6 +3,7 @@ import { MongoRepository as CategoryCodeRepo } from '../repo/categoryCode';
|
|
|
3
3
|
import { MongoRepository as EventRepo } from '../repo/event';
|
|
4
4
|
import { MongoRepository as PlaceRepo } from '../repo/place';
|
|
5
5
|
import { MongoRepository as ProjectRepo } from '../repo/project';
|
|
6
|
+
import { MongoRepository as SellerRepo } from '../repo/seller';
|
|
6
7
|
import { MongoRepository as TaskRepo } from '../repo/task';
|
|
7
8
|
import * as factory from '../factory';
|
|
8
9
|
/**
|
|
@@ -32,6 +33,7 @@ export declare function importFromCOA(params: {
|
|
|
32
33
|
categoryCode: CategoryCodeRepo;
|
|
33
34
|
event: EventRepo;
|
|
34
35
|
place: PlaceRepo;
|
|
36
|
+
seller: SellerRepo;
|
|
35
37
|
}) => Promise<void>;
|
|
36
38
|
/**
|
|
37
39
|
* COA情報からイベントIDを作成する
|
|
@@ -89,8 +89,18 @@ function importFromCOA(params) {
|
|
|
89
89
|
endpoint: credentials_1.credentials.coa.endpoint,
|
|
90
90
|
auth: coaAuthClient
|
|
91
91
|
}, { timeout: credentials_1.credentials.coa.timeout });
|
|
92
|
+
// 同ブランチコードの販売者を検索する
|
|
93
|
+
const sellersWithSameBranchCode = yield repos.seller.search({
|
|
94
|
+
limit: 1,
|
|
95
|
+
page: 1,
|
|
96
|
+
branchCode: { $eq: params.locationBranchCode }
|
|
97
|
+
});
|
|
98
|
+
const seller = sellersWithSameBranchCode.shift();
|
|
99
|
+
if (typeof (seller === null || seller === void 0 ? void 0 : seller.id) !== 'string') {
|
|
100
|
+
throw new factory.errors.NotFound('Seller', `Seller with branchCod '${params.locationBranchCode}' not found`);
|
|
101
|
+
}
|
|
92
102
|
// 施設取得
|
|
93
|
-
let movieTheater = createMovieTheaterFromCOA(project, yield masterService.theater({ theaterCode: params.locationBranchCode }), yield masterService.screen({ theaterCode: params.locationBranchCode }));
|
|
103
|
+
let movieTheater = createMovieTheaterFromCOA(project, { id: seller.id }, yield masterService.theater({ theaterCode: params.locationBranchCode }), yield masterService.screen({ theaterCode: params.locationBranchCode }));
|
|
94
104
|
// saveMovieTheater:trueの場合のみ、施設保管(2022-10-10~)
|
|
95
105
|
if (params.saveMovieTheater === true) {
|
|
96
106
|
movieTheater = yield repos.place.saveMovieTheaterByBranchCode4coa(movieTheater);
|
|
@@ -539,11 +549,12 @@ function createScreeningEventSeriesFromCOA(params) {
|
|
|
539
549
|
kanaName: params.movieTheater.kanaName,
|
|
540
550
|
typeOf: params.movieTheater.typeOf
|
|
541
551
|
},
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
552
|
+
// 不要なので廃止(2023-01-12~)
|
|
553
|
+
// organizer: {
|
|
554
|
+
// typeOf: factory.organizationType.Corporation,
|
|
555
|
+
// identifier: params.movieTheater.id,
|
|
556
|
+
// name: params.movieTheater.name
|
|
557
|
+
// },
|
|
547
558
|
videoFormat: params.eizouKubuns.filter((kubun) => kubun.kubunCode === params.filmFromCOA.kbnEizou)[0],
|
|
548
559
|
soundFormat: [],
|
|
549
560
|
workPerformed: {
|
|
@@ -617,7 +628,7 @@ function createScreeningEventSeriesId(params) {
|
|
|
617
628
|
*/
|
|
618
629
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
619
630
|
/* istanbul ignore next */
|
|
620
|
-
function createMovieTheaterFromCOA(project, theaterFromCOA, screensFromCOA) {
|
|
631
|
+
function createMovieTheaterFromCOA(project, seller, theaterFromCOA, screensFromCOA) {
|
|
621
632
|
const id = `MovieTheater-${theaterFromCOA.theaterCode}`;
|
|
622
633
|
return {
|
|
623
634
|
project: { typeOf: project.typeOf, id: project.id },
|
|
@@ -663,7 +674,8 @@ function createMovieTheaterFromCOA(project, theaterFromCOA, screensFromCOA) {
|
|
|
663
674
|
value: 2678400,
|
|
664
675
|
unitCode: factory.unitCode.Sec
|
|
665
676
|
}
|
|
666
|
-
}
|
|
677
|
+
},
|
|
678
|
+
parentOrganization: { id: seller.id, typeOf: factory.organizationType.Corporation }
|
|
667
679
|
};
|
|
668
680
|
}
|
|
669
681
|
/**
|
|
@@ -39,10 +39,6 @@ function searchTransportationEventTicketOffers(params) {
|
|
|
39
39
|
throw new factory.errors.NotFound('event.offers.itemOffered.id');
|
|
40
40
|
}
|
|
41
41
|
const { soundFormatChargeSpecifications, videoFormatChargeSpecifications, movieTicketTypeChargeSpecs } = yield searchPriceSpecs4event({ project: { id: screeningEvent.project.id }, soundFormatTypes, videoFormatTypes })(repos);
|
|
42
|
-
const screeningEventOfferSettings = screeningEvent.offers;
|
|
43
|
-
if (screeningEventOfferSettings === undefined) {
|
|
44
|
-
throw new factory.errors.NotFound('event.offers');
|
|
45
|
-
}
|
|
46
42
|
const unacceptedPaymentMethod = getUnacceptedPaymentMethodByEvent({ event: screeningEvent });
|
|
47
43
|
// 不許可決済方法があれば、該当オファーを除外
|
|
48
44
|
if (Array.isArray(unacceptedPaymentMethod) && unacceptedPaymentMethod.length > 0) {
|
|
@@ -94,7 +90,7 @@ function searchTransportationEventTicketOffers(params) {
|
|
|
94
90
|
});
|
|
95
91
|
let offers4event = availableOffers.map((availableOffer) => {
|
|
96
92
|
return (0, factory_1.createCompoundPriceSpec4event)({
|
|
97
|
-
eligibleQuantity:
|
|
93
|
+
eligibleQuantity: eventOffers.eligibleQuantity,
|
|
98
94
|
offer: availableOffer,
|
|
99
95
|
videoFormatChargeSpecifications,
|
|
100
96
|
soundFormatChargeSpecifications,
|
|
@@ -14,6 +14,7 @@ const action_1 = require("../../repo/action");
|
|
|
14
14
|
const categoryCode_1 = require("../../repo/categoryCode");
|
|
15
15
|
const event_1 = require("../../repo/event");
|
|
16
16
|
const place_1 = require("../../repo/place");
|
|
17
|
+
const seller_1 = require("../../repo/seller");
|
|
17
18
|
const EventService = require("../event");
|
|
18
19
|
/**
|
|
19
20
|
* タスク実行関数
|
|
@@ -24,7 +25,8 @@ function call(data) {
|
|
|
24
25
|
action: new action_1.MongoRepository(settings.connection),
|
|
25
26
|
categoryCode: new categoryCode_1.MongoRepository(settings.connection),
|
|
26
27
|
event: new event_1.MongoRepository(settings.connection),
|
|
27
|
-
place: new place_1.MongoRepository(settings.connection)
|
|
28
|
+
place: new place_1.MongoRepository(settings.connection),
|
|
29
|
+
seller: new seller_1.MongoRepository(settings.connection)
|
|
28
30
|
});
|
|
29
31
|
});
|
|
30
32
|
}
|
package/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.281.0
|
|
13
|
-
"@cinerino/sdk": "3.135.0
|
|
12
|
+
"@chevre/factory": "4.281.0",
|
|
13
|
+
"@cinerino/sdk": "3.135.0",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
16
16
|
"@sendgrid/mail": "6.4.0",
|
|
@@ -120,5 +120,5 @@
|
|
|
120
120
|
"postversion": "git push origin --tags",
|
|
121
121
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
122
122
|
},
|
|
123
|
-
"version": "20.2.0-alpha.
|
|
123
|
+
"version": "20.2.0-alpha.13"
|
|
124
124
|
}
|