@chevre/domain 22.13.0-alpha.0 → 22.13.0-alpha.10
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/event/migrateEventIdentifier4ttts.ts +96 -0
- package/example/src/chevre/event/upsertManyScreeningEventByIdentifier.ts +191 -0
- package/example/src/chevre/roles/addPermissionIfNotExists.ts +20 -32
- package/lib/chevre/repo/event.d.ts +34 -6
- package/lib/chevre/repo/event.js +120 -28
- package/lib/chevre/service/event.d.ts +3 -33
- package/lib/chevre/service/event.js +0 -47
- package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.d.ts +22 -0
- package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.js +274 -0
- package/lib/chevre/service/task/createEvent/createEventBySchedule/schedule2events.d.ts +15 -0
- package/lib/chevre/service/task/createEvent/createEventBySchedule/schedule2events.js +116 -0
- package/lib/chevre/service/task/createEvent/createEventBySchedule.js +63 -327
- package/package.json +2 -2
- package/example/src/chevre/cancelEvent.ts +0 -22
- package/example/src/chevre/roles/addAdminPermissionIfNotExists.ts +0 -132
- package/example/src/chevre/roles/addDefaultPermissionIfNotExists.ts +0 -37
- package/example/src/chevre/roles/addEventOfferPermissionIfNotExists.ts +0 -27
package/lib/chevre/repo/event.js
CHANGED
|
@@ -43,7 +43,7 @@ class EventRepo {
|
|
|
43
43
|
}
|
|
44
44
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
45
45
|
static CREATE_MONGO_CONDITIONS(conditions) {
|
|
46
|
-
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, _27;
|
|
46
|
+
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, _27, _28;
|
|
47
47
|
const andConditions = [];
|
|
48
48
|
const typeOfEq = conditions.typeOf;
|
|
49
49
|
if (typeof typeOfEq === 'string') {
|
|
@@ -73,6 +73,10 @@ class EventRepo {
|
|
|
73
73
|
if (Array.isArray(idIn)) {
|
|
74
74
|
andConditions.push({ _id: { $in: idIn } });
|
|
75
75
|
}
|
|
76
|
+
const identifierIn = (_g = conditions.identifier) === null || _g === void 0 ? void 0 : _g.$in;
|
|
77
|
+
if (Array.isArray(identifierIn)) {
|
|
78
|
+
andConditions.push({ identifier: { $exists: true, $in: identifierIn } });
|
|
79
|
+
}
|
|
76
80
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
77
81
|
/* istanbul ignore else */
|
|
78
82
|
if (Array.isArray(conditions.eventStatuses)) {
|
|
@@ -122,11 +126,11 @@ class EventRepo {
|
|
|
122
126
|
endDate: { $lte: conditions.endThrough }
|
|
123
127
|
});
|
|
124
128
|
}
|
|
125
|
-
const locationBranchCodeEq = (
|
|
129
|
+
const locationBranchCodeEq = (_j = (_h = conditions.location) === null || _h === void 0 ? void 0 : _h.branchCode) === null || _j === void 0 ? void 0 : _j.$eq;
|
|
126
130
|
if (typeof locationBranchCodeEq === 'string') {
|
|
127
131
|
andConditions.push({ 'location.branchCode': { $exists: true, $eq: locationBranchCodeEq } });
|
|
128
132
|
}
|
|
129
|
-
const locationBranchCodeIn = (
|
|
133
|
+
const locationBranchCodeIn = (_l = (_k = conditions.location) === null || _k === void 0 ? void 0 : _k.branchCode) === null || _l === void 0 ? void 0 : _l.$in;
|
|
130
134
|
if (Array.isArray(locationBranchCodeIn)) {
|
|
131
135
|
andConditions.push({ 'location.branchCode': { $exists: true, $in: locationBranchCodeIn } });
|
|
132
136
|
}
|
|
@@ -140,7 +144,7 @@ class EventRepo {
|
|
|
140
144
|
// }
|
|
141
145
|
// });
|
|
142
146
|
// }
|
|
143
|
-
const additionalPropertyElemMatch = (
|
|
147
|
+
const additionalPropertyElemMatch = (_m = conditions.additionalProperty) === null || _m === void 0 ? void 0 : _m.$elemMatch;
|
|
144
148
|
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
145
149
|
andConditions.push({
|
|
146
150
|
additionalProperty: {
|
|
@@ -156,7 +160,7 @@ class EventRepo {
|
|
|
156
160
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
157
161
|
/* istanbul ignore else */
|
|
158
162
|
if (params.offers !== undefined) {
|
|
159
|
-
const itemOfferedIdIn4event = (
|
|
163
|
+
const itemOfferedIdIn4event = (_p = (_o = params.offers.itemOffered) === null || _o === void 0 ? void 0 : _o.id) === null || _p === void 0 ? void 0 : _p.$in;
|
|
160
164
|
if (Array.isArray(itemOfferedIdIn4event)) {
|
|
161
165
|
andConditions.push({
|
|
162
166
|
'offers.itemOffered.id': {
|
|
@@ -206,8 +210,8 @@ class EventRepo {
|
|
|
206
210
|
}
|
|
207
211
|
}
|
|
208
212
|
}
|
|
209
|
-
const sellerMakesOfferElemMatch4event = (
|
|
210
|
-
if (typeof ((
|
|
213
|
+
const sellerMakesOfferElemMatch4event = (_s = (_r = (_q = params.offers) === null || _q === void 0 ? void 0 : _q.seller) === null || _r === void 0 ? void 0 : _r.makesOffer) === null || _s === void 0 ? void 0 : _s.$elemMatch;
|
|
214
|
+
if (typeof ((_t = sellerMakesOfferElemMatch4event === null || sellerMakesOfferElemMatch4event === void 0 ? void 0 : sellerMakesOfferElemMatch4event['availableAtOrFrom.id']) === null || _t === void 0 ? void 0 : _t.$eq) === 'string') {
|
|
211
215
|
andConditions.push({
|
|
212
216
|
'offers.seller.makesOffer': {
|
|
213
217
|
$exists: true,
|
|
@@ -215,7 +219,7 @@ class EventRepo {
|
|
|
215
219
|
}
|
|
216
220
|
});
|
|
217
221
|
}
|
|
218
|
-
const reservationForIdentifierEq = (_x = (_w = (_v = (_u =
|
|
222
|
+
const reservationForIdentifierEq = (_y = (_x = (_w = (_v = (_u = params.offers) === null || _u === void 0 ? void 0 : _u.itemOffered) === null || _v === void 0 ? void 0 : _v.serviceOutput) === null || _w === void 0 ? void 0 : _w.reservationFor) === null || _x === void 0 ? void 0 : _x.identifier) === null || _y === void 0 ? void 0 : _y.$eq;
|
|
219
223
|
if (typeof reservationForIdentifierEq === 'string') {
|
|
220
224
|
andConditions.push({
|
|
221
225
|
'offers.itemOffered.serviceOutput.reservationFor.identifier': {
|
|
@@ -224,7 +228,7 @@ class EventRepo {
|
|
|
224
228
|
}
|
|
225
229
|
});
|
|
226
230
|
}
|
|
227
|
-
const reservationForArrivalBusStopBranchCodeEq = (_3 = (_2 = (_1 = (_0 = (_z =
|
|
231
|
+
const reservationForArrivalBusStopBranchCodeEq = (_4 = (_3 = (_2 = (_1 = (_0 = (_z = params.offers) === null || _z === void 0 ? void 0 : _z.itemOffered) === null || _0 === void 0 ? void 0 : _0.serviceOutput) === null || _1 === void 0 ? void 0 : _1.reservationFor) === null || _2 === void 0 ? void 0 : _2.arrivalBusStop) === null || _3 === void 0 ? void 0 : _3.branchCode) === null || _4 === void 0 ? void 0 : _4.$eq;
|
|
228
232
|
if (typeof reservationForArrivalBusStopBranchCodeEq === 'string') {
|
|
229
233
|
andConditions.push({
|
|
230
234
|
'offers.itemOffered.serviceOutput.reservationFor.arrivalBusStop.branchCode': {
|
|
@@ -233,7 +237,7 @@ class EventRepo {
|
|
|
233
237
|
}
|
|
234
238
|
});
|
|
235
239
|
}
|
|
236
|
-
const reservationForDepartureBusStopBranchCodeEq = (_9 = (_8 = (_7 = (_6 = (_5 =
|
|
240
|
+
const reservationForDepartureBusStopBranchCodeEq = (_10 = (_9 = (_8 = (_7 = (_6 = (_5 = params.offers) === null || _5 === void 0 ? void 0 : _5.itemOffered) === null || _6 === void 0 ? void 0 : _6.serviceOutput) === null || _7 === void 0 ? void 0 : _7.reservationFor) === null || _8 === void 0 ? void 0 : _8.departureBusStop) === null || _9 === void 0 ? void 0 : _9.branchCode) === null || _10 === void 0 ? void 0 : _10.$eq;
|
|
237
241
|
if (typeof reservationForDepartureBusStopBranchCodeEq === 'string') {
|
|
238
242
|
andConditions.push({
|
|
239
243
|
'offers.itemOffered.serviceOutput.reservationFor.departureBusStop.branchCode': {
|
|
@@ -267,7 +271,7 @@ class EventRepo {
|
|
|
267
271
|
}
|
|
268
272
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
269
273
|
/* istanbul ignore else */
|
|
270
|
-
const superEventLocationIdEq = (
|
|
274
|
+
const superEventLocationIdEq = (_13 = (_12 = (_11 = params.superEvent) === null || _11 === void 0 ? void 0 : _11.location) === null || _12 === void 0 ? void 0 : _12.id) === null || _13 === void 0 ? void 0 : _13.$eq;
|
|
271
275
|
if (typeof superEventLocationIdEq === 'string') {
|
|
272
276
|
andConditions.push({
|
|
273
277
|
'superEvent.location.id': {
|
|
@@ -310,7 +314,7 @@ class EventRepo {
|
|
|
310
314
|
});
|
|
311
315
|
}
|
|
312
316
|
}
|
|
313
|
-
const itemOfferedIdIn = (
|
|
317
|
+
const itemOfferedIdIn = (_16 = (_15 = (_14 = params.offers) === null || _14 === void 0 ? void 0 : _14.itemOffered) === null || _15 === void 0 ? void 0 : _15.id) === null || _16 === void 0 ? void 0 : _16.$in;
|
|
314
318
|
if (Array.isArray(itemOfferedIdIn)) {
|
|
315
319
|
andConditions.push({
|
|
316
320
|
'offers.itemOffered.id': {
|
|
@@ -319,7 +323,7 @@ class EventRepo {
|
|
|
319
323
|
}
|
|
320
324
|
});
|
|
321
325
|
}
|
|
322
|
-
const itemOfferedTicketedSeatTypeOfIn = (_20 = (_19 = (_18 = (_17 =
|
|
326
|
+
const itemOfferedTicketedSeatTypeOfIn = (_21 = (_20 = (_19 = (_18 = (_17 = params.offers) === null || _17 === void 0 ? void 0 : _17.itemOffered) === null || _18 === void 0 ? void 0 : _18.serviceOutput) === null || _19 === void 0 ? void 0 : _19.reservedTicket) === null || _20 === void 0 ? void 0 : _20.ticketedSeat) === null || _21 === void 0 ? void 0 : _21.typeOfs;
|
|
323
327
|
if (Array.isArray(itemOfferedTicketedSeatTypeOfIn)) {
|
|
324
328
|
andConditions.push({
|
|
325
329
|
'offers.itemOffered.serviceOutput.reservedTicket.ticketedSeat.typeOf': {
|
|
@@ -328,7 +332,7 @@ class EventRepo {
|
|
|
328
332
|
}
|
|
329
333
|
});
|
|
330
334
|
}
|
|
331
|
-
const itemOfferedServiceTypeIdIn = (
|
|
335
|
+
const itemOfferedServiceTypeIdIn = (_24 = (_23 = (_22 = params.offers) === null || _22 === void 0 ? void 0 : _22.itemOffered) === null || _23 === void 0 ? void 0 : _23.serviceType) === null || _24 === void 0 ? void 0 : _24.ids;
|
|
332
336
|
if (Array.isArray(itemOfferedServiceTypeIdIn)) {
|
|
333
337
|
andConditions.push({
|
|
334
338
|
'offers.itemOffered.serviceType.id': {
|
|
@@ -337,8 +341,8 @@ class EventRepo {
|
|
|
337
341
|
}
|
|
338
342
|
});
|
|
339
343
|
}
|
|
340
|
-
const sellerMakesOfferElemMatch = (
|
|
341
|
-
if (typeof ((
|
|
344
|
+
const sellerMakesOfferElemMatch = (_27 = (_26 = (_25 = params.offers) === null || _25 === void 0 ? void 0 : _25.seller) === null || _26 === void 0 ? void 0 : _26.makesOffer) === null || _27 === void 0 ? void 0 : _27.$elemMatch;
|
|
345
|
+
if (typeof ((_28 = sellerMakesOfferElemMatch === null || sellerMakesOfferElemMatch === void 0 ? void 0 : sellerMakesOfferElemMatch['availableAtOrFrom.id']) === null || _28 === void 0 ? void 0 : _28.$eq) === 'string') {
|
|
342
346
|
andConditions.push({
|
|
343
347
|
'offers.seller.makesOffer': {
|
|
344
348
|
$exists: true,
|
|
@@ -482,6 +486,71 @@ class EventRepo {
|
|
|
482
486
|
}
|
|
483
487
|
});
|
|
484
488
|
}
|
|
489
|
+
/**
|
|
490
|
+
* イベントコードをキーにして冪等置換
|
|
491
|
+
*/
|
|
492
|
+
upsertManyScreeningEventByIdentifier(params, options) {
|
|
493
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
494
|
+
const { update } = options;
|
|
495
|
+
const uniqid = yield Promise.resolve().then(() => require('uniqid'));
|
|
496
|
+
const bulkWriteOps = [];
|
|
497
|
+
const queryFilters = [];
|
|
498
|
+
if (Array.isArray(params)) {
|
|
499
|
+
params.forEach(({ $set, $unset }) => {
|
|
500
|
+
const { project, identifier } = $set;
|
|
501
|
+
if (typeof identifier !== 'string' || identifier.length === 0) {
|
|
502
|
+
throw new factory.errors.ArgumentNull('identifier');
|
|
503
|
+
}
|
|
504
|
+
// リソースのユニークネスを保証するfilter
|
|
505
|
+
const filter = {
|
|
506
|
+
'project.id': { $eq: project.id },
|
|
507
|
+
identifier: { $exists: true, $eq: identifier }
|
|
508
|
+
};
|
|
509
|
+
queryFilters.push({
|
|
510
|
+
'project.id': { $eq: project.id },
|
|
511
|
+
identifier: { $exists: true, $eq: identifier }
|
|
512
|
+
});
|
|
513
|
+
if (update === true) {
|
|
514
|
+
const { maximumPhysicalAttendeeCapacity, additionalProperty, eventStatus, location, name, superEvent, offers, doorTime, endDate, startDate } = $set;
|
|
515
|
+
const setFields = {
|
|
516
|
+
maximumPhysicalAttendeeCapacity, additionalProperty,
|
|
517
|
+
eventStatus, location, name, superEvent, offers,
|
|
518
|
+
doorTime, endDate, startDate
|
|
519
|
+
};
|
|
520
|
+
const updateOne = {
|
|
521
|
+
filter,
|
|
522
|
+
update: Object.assign({ $set: setFields }, ($unset !== undefined) ? { $unset } : undefined),
|
|
523
|
+
upsert: false
|
|
524
|
+
};
|
|
525
|
+
bulkWriteOps.push({ updateOne });
|
|
526
|
+
}
|
|
527
|
+
else {
|
|
528
|
+
const { id, coaInfo, description, maximumAttendeeCapacity, remainingAttendeeCapacity, checkInCount, attendeeCount, aggregateReservation } = $set, setOnInsertFields = __rest($set, ["id", "coaInfo", "description", "maximumAttendeeCapacity", "remainingAttendeeCapacity", "checkInCount", "attendeeCount", "aggregateReservation"]);
|
|
529
|
+
const setOnInsert = Object.assign(Object.assign({}, setOnInsertFields), { identifier, _id: uniqid() });
|
|
530
|
+
const updateOne = {
|
|
531
|
+
filter,
|
|
532
|
+
update: {
|
|
533
|
+
$setOnInsert: setOnInsert
|
|
534
|
+
},
|
|
535
|
+
upsert: true
|
|
536
|
+
};
|
|
537
|
+
bulkWriteOps.push({ updateOne });
|
|
538
|
+
}
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
if (bulkWriteOps.length > 0) {
|
|
542
|
+
const bulkWriteResult = yield this.eventModel.bulkWrite(bulkWriteOps, { ordered: false });
|
|
543
|
+
// modifiedの場合upsertedIdsに含まれないので、idを検索する
|
|
544
|
+
const modifiedEvents = yield this.eventModel.find({ $or: queryFilters }, {
|
|
545
|
+
_id: 0,
|
|
546
|
+
id: { $toString: '$_id' }
|
|
547
|
+
})
|
|
548
|
+
.lean()
|
|
549
|
+
.exec();
|
|
550
|
+
return { bulkWriteResult, modifiedEvents };
|
|
551
|
+
}
|
|
552
|
+
});
|
|
553
|
+
}
|
|
485
554
|
/**
|
|
486
555
|
* イベント部分更新
|
|
487
556
|
*/
|
|
@@ -553,6 +622,9 @@ class EventRepo {
|
|
|
553
622
|
return { id: savedEventId }; // optimize(2024-07-31~)
|
|
554
623
|
});
|
|
555
624
|
}
|
|
625
|
+
/**
|
|
626
|
+
* sskts専用
|
|
627
|
+
*/
|
|
556
628
|
saveManyEvents(params) {
|
|
557
629
|
return __awaiter(this, void 0, void 0, function* () {
|
|
558
630
|
const bulkWriteOps = [];
|
|
@@ -586,25 +658,45 @@ class EventRepo {
|
|
|
586
658
|
}
|
|
587
659
|
});
|
|
588
660
|
}
|
|
589
|
-
|
|
661
|
+
/**
|
|
662
|
+
* tttsイベントを識別子によって冪等作成する
|
|
663
|
+
*/
|
|
664
|
+
saveEventByIdentifier4ttts(params) {
|
|
590
665
|
return __awaiter(this, void 0, void 0, function* () {
|
|
591
|
-
//
|
|
592
|
-
const _a = params.attributes, {
|
|
666
|
+
// const { oldEventId } = params;
|
|
667
|
+
const _a = params.attributes, { project, typeOf, eventStatus, identifier, organizer } = _a, updateFields = __rest(_a, ["project", "typeOf", "eventStatus", "identifier", "organizer"]);
|
|
668
|
+
// const identifier = oldEventId;
|
|
669
|
+
if (typeof identifier !== 'string' || identifier.length === 0) {
|
|
670
|
+
throw new factory.errors.ArgumentNull('identifier');
|
|
671
|
+
}
|
|
593
672
|
const uniqid = yield Promise.resolve().then(() => require('uniqid'));
|
|
594
673
|
const id = uniqid();
|
|
595
|
-
const doc = yield this.eventModel.findOneAndUpdate(
|
|
674
|
+
const doc = yield this.eventModel.findOneAndUpdate(
|
|
675
|
+
// 全イベントにidentifierを保証したので、additionalPropertyによるフィルターからidentifierによるフィルターへ変更(2025-09-05~)
|
|
676
|
+
// {
|
|
677
|
+
// 'project.id': { $eq: project.id },
|
|
678
|
+
// typeOf: { $eq: typeOf },
|
|
679
|
+
// // 追加特性をキーに更新
|
|
680
|
+
// additionalProperty: {
|
|
681
|
+
// $exists: true,
|
|
682
|
+
// $all: [{ name: 'oldEventId', value: identifier }]
|
|
683
|
+
// }
|
|
684
|
+
// },
|
|
685
|
+
{
|
|
596
686
|
'project.id': { $eq: project.id },
|
|
597
|
-
|
|
598
|
-
// 追加特性をキーに更新
|
|
599
|
-
additionalProperty: {
|
|
600
|
-
$exists: true,
|
|
601
|
-
$all: [{ name: 'oldEventId', value: params.oldEventId }]
|
|
602
|
-
}
|
|
687
|
+
identifier: { $exists: true, $eq: identifier }
|
|
603
688
|
},
|
|
604
689
|
// upsertの場合、createがありうるので属性を除外しない
|
|
605
690
|
{
|
|
606
|
-
$setOnInsert:
|
|
607
|
-
|
|
691
|
+
$setOnInsert: {
|
|
692
|
+
_id: id,
|
|
693
|
+
typeOf,
|
|
694
|
+
project,
|
|
695
|
+
eventStatus,
|
|
696
|
+
organizer,
|
|
697
|
+
identifier // イベントコードを必ず追加(2025-09-03~)
|
|
698
|
+
// ...(typeof identifier === 'string' && identifier !== '') ? { identifier } : undefined
|
|
699
|
+
},
|
|
608
700
|
$set: updateFields
|
|
609
701
|
}, { upsert: true, new: true, projection: { _id: 1 } })
|
|
610
702
|
.lean()
|
|
@@ -9,10 +9,7 @@ import type { EventRepo } from '../repo/event';
|
|
|
9
9
|
import type { EventSeriesRepo } from '../repo/eventSeries';
|
|
10
10
|
import type { MovieTheaterRepo } from '../repo/place/movieTheater';
|
|
11
11
|
import type { ScreeningRoomRepo } from '../repo/place/screeningRoom';
|
|
12
|
-
import type { ProjectRepo } from '../repo/project';
|
|
13
12
|
import type { SellerRepo } from '../repo/seller';
|
|
14
|
-
import type { SettingRepo } from '../repo/setting';
|
|
15
|
-
import type { TaskRepo } from '../repo/task';
|
|
16
13
|
import * as factory from '../factory';
|
|
17
14
|
interface IImportFromCOAParams {
|
|
18
15
|
project: {
|
|
@@ -38,7 +35,7 @@ interface IImportFromCOAParams {
|
|
|
38
35
|
/**
|
|
39
36
|
* イベントをインポートする
|
|
40
37
|
*/
|
|
41
|
-
|
|
38
|
+
declare function importFromCOA(params: IImportFromCOAParams): (repos: {
|
|
42
39
|
action: ActionRepo;
|
|
43
40
|
categoryCode: CategoryCodeRepo;
|
|
44
41
|
creativeWork: CreativeWorkRepo;
|
|
@@ -49,13 +46,10 @@ export declare function importFromCOA(params: IImportFromCOAParams): (repos: {
|
|
|
49
46
|
seller: SellerRepo;
|
|
50
47
|
masterService: COA.service.Master;
|
|
51
48
|
}) => Promise<void>;
|
|
52
|
-
export declare function minimizeSuperEvent(params: {
|
|
53
|
-
superEvent: factory.event.screeningEventSeries.IEvent;
|
|
54
|
-
}): factory.event.screeningEvent.ISuperEvent;
|
|
55
49
|
/**
|
|
56
50
|
* COA情報からイベントIDを作成する
|
|
57
51
|
*/
|
|
58
|
-
|
|
52
|
+
declare function createScreeningEventIdFromCOA(params: {
|
|
59
53
|
theaterCode: string;
|
|
60
54
|
titleCode: string;
|
|
61
55
|
titleBranchNum: string;
|
|
@@ -63,28 +57,4 @@ export declare function createScreeningEventIdFromCOA(params: {
|
|
|
63
57
|
screenCode: string;
|
|
64
58
|
timeBegin: string;
|
|
65
59
|
}): string;
|
|
66
|
-
export
|
|
67
|
-
/**
|
|
68
|
-
* 旧イベントID
|
|
69
|
-
*/
|
|
70
|
-
oldEventId: string;
|
|
71
|
-
/**
|
|
72
|
-
* イベント属性
|
|
73
|
-
*/
|
|
74
|
-
attributes: factory.event.IAttributes<factory.eventType.ScreeningEvent>;
|
|
75
|
-
project: {
|
|
76
|
-
id: string;
|
|
77
|
-
};
|
|
78
|
-
/**
|
|
79
|
-
* 更新者
|
|
80
|
-
*/
|
|
81
|
-
agent: factory.action.IParticipant;
|
|
82
|
-
}): (repos: {
|
|
83
|
-
action: ActionRepo;
|
|
84
|
-
event: EventRepo;
|
|
85
|
-
eventSeries: EventSeriesRepo;
|
|
86
|
-
project: ProjectRepo;
|
|
87
|
-
setting: SettingRepo;
|
|
88
|
-
task: TaskRepo;
|
|
89
|
-
}) => Promise<void>;
|
|
90
|
-
export {};
|
|
60
|
+
export { importFromCOA, createScreeningEventIdFromCOA };
|
|
@@ -10,17 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.importFromCOA = importFromCOA;
|
|
13
|
-
exports.minimizeSuperEvent = minimizeSuperEvent;
|
|
14
13
|
exports.createScreeningEventIdFromCOA = createScreeningEventIdFromCOA;
|
|
15
|
-
exports.updateEvent4ttts = updateEvent4ttts;
|
|
16
14
|
const createDebug = require("debug");
|
|
17
15
|
// @ts-ignore
|
|
18
16
|
const difference = require("lodash.difference");
|
|
19
17
|
// import { google } from 'googleapis';
|
|
20
18
|
const moment = require("moment-timezone");
|
|
21
19
|
const factory = require("../factory");
|
|
22
|
-
// import { Settings } from '../settings';
|
|
23
|
-
const onEventChanged_1 = require("./offer/onEventChanged");
|
|
24
20
|
const debug = createDebug('chevre-domain:service:event');
|
|
25
21
|
/**
|
|
26
22
|
* イベントをインポートする
|
|
@@ -858,46 +854,3 @@ function createScreeningRoomFromCOA(project, seller, screenFromCOA) {
|
|
|
858
854
|
parentOrganization: { id: seller.id, typeOf: factory.organizationType.Corporation }
|
|
859
855
|
};
|
|
860
856
|
}
|
|
861
|
-
function updateEvent4ttts(params) {
|
|
862
|
-
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
863
|
-
const actionAttributes = Object.assign({ project: { typeOf: factory.organizationType.Project, id: params.project.id }, typeOf: factory.actionType.UpdateAction, agent: params.agent, object: {
|
|
864
|
-
id: params.oldEventId,
|
|
865
|
-
typeOf: factory.eventType.ScreeningEvent
|
|
866
|
-
} }, {
|
|
867
|
-
// replacee: reservation,
|
|
868
|
-
// replacer: params.attributes, // $unsetもありうるのでいったん保留
|
|
869
|
-
targetCollection: {
|
|
870
|
-
id: params.oldEventId,
|
|
871
|
-
typeOf: factory.eventType.ScreeningEvent
|
|
872
|
-
}
|
|
873
|
-
});
|
|
874
|
-
const action = yield repos.action.start(actionAttributes);
|
|
875
|
-
let savedEvent;
|
|
876
|
-
try {
|
|
877
|
-
savedEvent = yield repos.event.save4ttts({
|
|
878
|
-
oldEventId: params.oldEventId,
|
|
879
|
-
attributes: params.attributes
|
|
880
|
-
});
|
|
881
|
-
}
|
|
882
|
-
catch (error) {
|
|
883
|
-
try {
|
|
884
|
-
yield repos.action.giveUp({ typeOf: action.typeOf, id: action.id, error });
|
|
885
|
-
}
|
|
886
|
-
catch (__) {
|
|
887
|
-
// 失敗したら仕方ない
|
|
888
|
-
}
|
|
889
|
-
throw error;
|
|
890
|
-
}
|
|
891
|
-
// アクション完了
|
|
892
|
-
yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: { id: savedEvent.id } });
|
|
893
|
-
yield (0, onEventChanged_1.onEventChanged)({
|
|
894
|
-
id: [savedEvent.id],
|
|
895
|
-
project: { id: params.project.id },
|
|
896
|
-
typeOf: factory.eventType.ScreeningEvent,
|
|
897
|
-
isNew: false,
|
|
898
|
-
useInform: true
|
|
899
|
-
})(repos
|
|
900
|
-
// スケジュールによるイベント作成ではendDateに変更がないのでpendingReservationsへの同期はひとまず必要なし
|
|
901
|
-
);
|
|
902
|
-
});
|
|
903
|
-
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ICreatingEvent4ttts } from '../../../../repo/event';
|
|
2
|
+
import type { ICustomerMember } from '../../../../repo/member';
|
|
3
|
+
import * as factory from '../../../../factory';
|
|
4
|
+
declare function tour2creatingEvent(tour: ITourBySchedule, movieTheater: Pick<factory.place.movieTheater.IPlace, 'id' | 'branchCode' | 'parentOrganization'>, screeningRoom: Omit<factory.place.screeningRoom.IPlace, 'containsPlace' | 'parentOrganization'>, existingApplicationMembers: {
|
|
5
|
+
member: ICustomerMember;
|
|
6
|
+
}[], maxValue: number, eventService: Pick<factory.product.IProduct, 'id' | 'name'> & {
|
|
7
|
+
id: string;
|
|
8
|
+
}, screeningEventSeries: Pick<factory.event.screeningEventSeries.IEvent, 'location' | 'additionalProperty' | 'description' | 'endDate' | 'headline' | 'id' | 'kanaName' | 'name' | 'soundFormat' | 'startDate' | 'typeOf' | 'videoFormat' | 'workPerformed'>, project: {
|
|
9
|
+
id: string;
|
|
10
|
+
}): ICreatingEvent4ttts;
|
|
11
|
+
interface ITourBySchedule {
|
|
12
|
+
day: string;
|
|
13
|
+
start_time: string;
|
|
14
|
+
end_time?: never;
|
|
15
|
+
door_time: Date;
|
|
16
|
+
start_date: Date;
|
|
17
|
+
end_date: Date;
|
|
18
|
+
duration?: never;
|
|
19
|
+
tour_number: string;
|
|
20
|
+
}
|
|
21
|
+
declare function schedule2tours(settings: factory.schedule.IEventWithSchedule, createDate: Date): ITourBySchedule[];
|
|
22
|
+
export { tour2creatingEvent, schedule2tours };
|