@chevre/domain 21.9.0-alpha.14 → 21.9.0-alpha.16
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/searchAvaialbleAppliesToMovieTicketByOfferCatalogId.ts +4 -1
- package/example/src/chevre/searchOffers.ts +4 -4
- package/example/src/chevre/syncCatalogs2aggregateOffers.ts +3 -2
- package/lib/chevre/repo/aggregateOffer.d.ts +0 -96
- package/lib/chevre/repo/aggregateOffer.js +210 -130
- package/lib/chevre/repo/offer.d.ts +2 -0
- package/lib/chevre/repo/offer.js +11 -1
- package/lib/chevre/repo/offerCatalog.js +2 -1
- package/lib/chevre/repo/offerCatalogItem.js +7 -4
- package/lib/chevre/repo/task.d.ts +1 -1
- package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +1 -0
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +4 -1
- package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +3 -3
- package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.d.ts +20 -0
- package/lib/chevre/service/task/onResourceUpdated/onOfferCatalogUpdated.js +28 -0
- package/lib/chevre/service/task/onResourceUpdated/syncOfferCatalog.d.ts +0 -3
- package/lib/chevre/service/task/onResourceUpdated/syncOfferCatalog.js +1 -164
- package/lib/chevre/service/task/onResourceUpdated.js +2 -2
- package/package.json +3 -3
|
@@ -15,9 +15,11 @@ async function main() {
|
|
|
15
15
|
limit: 10,
|
|
16
16
|
page: 1,
|
|
17
17
|
subOfferCatalog: {
|
|
18
|
-
id: '0001'
|
|
18
|
+
id: '0001',
|
|
19
|
+
isOfferCatalogItem: false
|
|
19
20
|
},
|
|
20
21
|
excludeAppliesToMovieTicket: false,
|
|
22
|
+
useIncludeInDataCatalog: true,
|
|
21
23
|
unacceptedPaymentMethod: []
|
|
22
24
|
});
|
|
23
25
|
console.log(result);
|
|
@@ -26,6 +28,7 @@ async function main() {
|
|
|
26
28
|
result = await chevre.service.offer.event.searchOfferAppliesToMovieTicket({
|
|
27
29
|
event: { id: 'cllkq475p' },
|
|
28
30
|
onlyValid: true,
|
|
31
|
+
useIncludeInDataCatalog: true,
|
|
29
32
|
limit: 100,
|
|
30
33
|
page: 1
|
|
31
34
|
// ...(typeof availableAtId === 'string') ? { store: { id: availableAtId } } : undefined
|
|
@@ -10,10 +10,10 @@ mongoose.Model.on('index', (...args) => {
|
|
|
10
10
|
async function main() {
|
|
11
11
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: true });
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
);
|
|
13
|
+
const indexes = await mongoose.connection.db.collection('aggregateOffers')
|
|
14
|
+
.indexes();
|
|
15
|
+
console.log(indexes);
|
|
16
|
+
console.log(indexes.length);
|
|
17
17
|
// await mongoose.connection.db.collection('aggregateOffers')
|
|
18
18
|
// .dropIndexes();
|
|
19
19
|
// console.log('indexes droped');
|
|
@@ -11,7 +11,7 @@ mongoose.Model.on('index', (...args) => {
|
|
|
11
11
|
// tslint:disable-next-line:max-func-body-length
|
|
12
12
|
async function main() {
|
|
13
13
|
const now = new Date();
|
|
14
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex:
|
|
14
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
15
15
|
|
|
16
16
|
const offerRepo = new chevre.repository.Offer(mongoose.connection);
|
|
17
17
|
const offerCatalogRepo = new chevre.repository.OfferCatalog(mongoose.connection);
|
|
@@ -20,6 +20,7 @@ async function main() {
|
|
|
20
20
|
const cursor = offerCatalogRepo.getCursor(
|
|
21
21
|
{
|
|
22
22
|
// 'project.id': { $eq: project.id }
|
|
23
|
+
'itemListElement.typeOf': { $exists: true, $eq: chevre.factory.offerType.Offer }
|
|
23
24
|
},
|
|
24
25
|
{
|
|
25
26
|
__v: 0,
|
|
@@ -70,7 +71,7 @@ async function main() {
|
|
|
70
71
|
runsAt: now,
|
|
71
72
|
status: chevre.factory.taskStatus.Ready
|
|
72
73
|
};
|
|
73
|
-
await taskRepo.saveMany([syncTask], { emitImmediately: false });
|
|
74
|
+
// await taskRepo.saveMany([syncTask], { emitImmediately: false });
|
|
74
75
|
updateCount += 1;
|
|
75
76
|
console.log('task saved.', offerCatalog.project.id, offerCatalog.id, offerCatalog.identifier, i);
|
|
76
77
|
}
|
|
@@ -59,111 +59,15 @@ export declare class MongoRepository {
|
|
|
59
59
|
};
|
|
60
60
|
};
|
|
61
61
|
}): Promise<void>;
|
|
62
|
-
pushIncludedInOfferCatalogItem(params: {
|
|
63
|
-
project: {
|
|
64
|
-
id: string;
|
|
65
|
-
};
|
|
66
|
-
id: {
|
|
67
|
-
$in: string[];
|
|
68
|
-
};
|
|
69
|
-
$push: {
|
|
70
|
-
includedInOfferCatalogItem: {
|
|
71
|
-
/**
|
|
72
|
-
* サブカタログID
|
|
73
|
-
*/
|
|
74
|
-
id: {
|
|
75
|
-
$eq: string;
|
|
76
|
-
};
|
|
77
|
-
includedInDataCatalog: {
|
|
78
|
-
/**
|
|
79
|
-
* カタログID
|
|
80
|
-
*/
|
|
81
|
-
id: {
|
|
82
|
-
$eq: string;
|
|
83
|
-
};
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
};
|
|
87
|
-
}): Promise<void>;
|
|
88
62
|
/**
|
|
89
63
|
* サブカタログを含み、かつ、新しいカタログに含まれない集計オファーからサブカタログを除外
|
|
90
64
|
*/
|
|
91
|
-
pullIncludedInOfferCatalogItem(params: {
|
|
92
|
-
project: {
|
|
93
|
-
id: string;
|
|
94
|
-
};
|
|
95
|
-
id?: {
|
|
96
|
-
$nin?: string[];
|
|
97
|
-
};
|
|
98
|
-
$pull: {
|
|
99
|
-
includedInOfferCatalogItem: {
|
|
100
|
-
$elemMatch: {
|
|
101
|
-
/**
|
|
102
|
-
* サブカタログID
|
|
103
|
-
*/
|
|
104
|
-
id: {
|
|
105
|
-
$eq: string;
|
|
106
|
-
};
|
|
107
|
-
includedInDataCatalog: {
|
|
108
|
-
/**
|
|
109
|
-
* カタログID
|
|
110
|
-
*/
|
|
111
|
-
id: {
|
|
112
|
-
$eq: string;
|
|
113
|
-
};
|
|
114
|
-
};
|
|
115
|
-
};
|
|
116
|
-
};
|
|
117
|
-
};
|
|
118
|
-
}): Promise<void>;
|
|
119
65
|
/**
|
|
120
66
|
* カタログに属するサブカタログを全て除外する
|
|
121
67
|
*/
|
|
122
|
-
pullIncludedInOfferCatalogItemByCatalogId(params: {
|
|
123
|
-
project: {
|
|
124
|
-
id: string;
|
|
125
|
-
};
|
|
126
|
-
$pull: {
|
|
127
|
-
includedInOfferCatalogItem: {
|
|
128
|
-
$elemMatch: {
|
|
129
|
-
/**
|
|
130
|
-
* サブカタログID除外リスト
|
|
131
|
-
*/
|
|
132
|
-
id?: {
|
|
133
|
-
$nin: string[];
|
|
134
|
-
};
|
|
135
|
-
includedInDataCatalog: {
|
|
136
|
-
/**
|
|
137
|
-
* カタログID
|
|
138
|
-
*/
|
|
139
|
-
id: {
|
|
140
|
-
$eq: string;
|
|
141
|
-
};
|
|
142
|
-
};
|
|
143
|
-
};
|
|
144
|
-
};
|
|
145
|
-
};
|
|
146
|
-
}): Promise<void>;
|
|
147
68
|
/**
|
|
148
69
|
* サブカタログに属するサブカタログを全て除外する
|
|
149
70
|
*/
|
|
150
|
-
pullIncludedInOfferCatalogItemByCatalogItemId(params: {
|
|
151
|
-
project: {
|
|
152
|
-
id: string;
|
|
153
|
-
};
|
|
154
|
-
$pull: {
|
|
155
|
-
includedInOfferCatalogItem: {
|
|
156
|
-
$elemMatch: {
|
|
157
|
-
/**
|
|
158
|
-
* サブカタログID
|
|
159
|
-
*/
|
|
160
|
-
id: {
|
|
161
|
-
$eq: string;
|
|
162
|
-
};
|
|
163
|
-
};
|
|
164
|
-
};
|
|
165
|
-
};
|
|
166
|
-
}): Promise<void>;
|
|
167
71
|
deleteById(params: {
|
|
168
72
|
project: {
|
|
169
73
|
id: string;
|
|
@@ -494,7 +494,7 @@ class MongoRepository {
|
|
|
494
494
|
typeOf: 'OfferCatalog'
|
|
495
495
|
};
|
|
496
496
|
});
|
|
497
|
-
|
|
497
|
+
const result = yield this.aggregateOfferModel.updateMany({
|
|
498
498
|
'project.id': { $eq: params.project.id },
|
|
499
499
|
_id: { $in: params.id.$in },
|
|
500
500
|
// includedInDataCatalogのユニークネスを保証する
|
|
@@ -511,24 +511,28 @@ class MongoRepository {
|
|
|
511
511
|
})
|
|
512
512
|
.exec();
|
|
513
513
|
debug('result', result);
|
|
514
|
-
// offersにもpush
|
|
515
|
-
result =
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
514
|
+
// offersにもpush(ひとまず廃止)
|
|
515
|
+
// result = await this.aggregateOfferModel.updateMany(
|
|
516
|
+
// {
|
|
517
|
+
// 'project.id': { $eq: params.project.id },
|
|
518
|
+
// _id: { $in: params.id.$in }
|
|
519
|
+
// },
|
|
520
|
+
// {
|
|
521
|
+
// $push: {
|
|
522
|
+
// 'offers.$[offer].includedInDataCatalog': {
|
|
523
|
+
// $each: newIncludedInDataCatalogs
|
|
524
|
+
// }
|
|
525
|
+
// }
|
|
526
|
+
// },
|
|
527
|
+
// {
|
|
528
|
+
// // includedInDataCatalogのユニークネスを保証する
|
|
529
|
+
// arrayFilters: [
|
|
530
|
+
// { 'offer.includedInDataCatalog.id': { $nin: pushIncludedInDataCatalogIds } }
|
|
531
|
+
// ]
|
|
532
|
+
// }
|
|
533
|
+
// )
|
|
534
|
+
// .exec();
|
|
535
|
+
// debug('result', result);
|
|
532
536
|
});
|
|
533
537
|
}
|
|
534
538
|
/**
|
|
@@ -547,128 +551,204 @@ class MongoRepository {
|
|
|
547
551
|
}
|
|
548
552
|
})
|
|
549
553
|
.exec();
|
|
550
|
-
// 全offersからもpull
|
|
551
|
-
yield this.aggregateOfferModel.updateMany(Object.assign({ 'project.id': { $eq: params.project.id }, 'offers.includedInDataCatalog.id': { $exists: true, $eq: pullingCatalogId } }, (Array.isArray(idNin)) ? { _id: { $nin: idNin } } : undefined), {
|
|
552
|
-
$pull: {
|
|
553
|
-
'offers.$[].includedInDataCatalog': {
|
|
554
|
-
id: { $eq: pullingCatalogId }
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
})
|
|
558
|
-
.exec();
|
|
559
|
-
});
|
|
560
|
-
}
|
|
561
|
-
pushIncludedInOfferCatalogItem(params) {
|
|
562
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
563
|
-
if (!Array.isArray(params.id.$in) || params.id.$in.length === 0) {
|
|
564
|
-
return;
|
|
565
|
-
}
|
|
566
|
-
// if (params.$push.includedInOfferCatalogItem.$each.length === 0) {
|
|
567
|
-
// return;
|
|
568
|
-
// }
|
|
569
|
-
const newIncludedInOfferCatalogItem = {
|
|
570
|
-
id: params.$push.includedInOfferCatalogItem.id.$eq,
|
|
571
|
-
typeOf: 'OfferCatalog',
|
|
572
|
-
includedInDataCatalog: { id: params.$push.includedInOfferCatalogItem.includedInDataCatalog.id.$eq, typeOf: 'OfferCatalog' }
|
|
573
|
-
};
|
|
574
|
-
const result = yield this.aggregateOfferModel.updateMany({
|
|
575
|
-
'project.id': { $eq: params.project.id },
|
|
576
|
-
_id: { $in: params.id.$in }
|
|
577
|
-
}, {
|
|
578
|
-
// newIncludedInOfferCatalogItemsのユニークネスを保証する
|
|
579
|
-
$addToSet: { 'offers.$[].includedInOfferCatalogItem': newIncludedInOfferCatalogItem }
|
|
580
|
-
})
|
|
581
|
-
.exec();
|
|
582
|
-
debug('result', result);
|
|
583
554
|
});
|
|
584
555
|
}
|
|
556
|
+
// public async pushIncludedInOfferCatalogItem(params: {
|
|
557
|
+
// project: { id: string };
|
|
558
|
+
// id: { $in: string[] };
|
|
559
|
+
// $push: {
|
|
560
|
+
// includedInOfferCatalogItem: {
|
|
561
|
+
// /**
|
|
562
|
+
// * サブカタログID
|
|
563
|
+
// */
|
|
564
|
+
// id: { $eq: string };
|
|
565
|
+
// includedInDataCatalog: {
|
|
566
|
+
// /**
|
|
567
|
+
// * カタログID
|
|
568
|
+
// */
|
|
569
|
+
// id: { $eq: string };
|
|
570
|
+
// };
|
|
571
|
+
// };
|
|
572
|
+
// };
|
|
573
|
+
// }): Promise<void> {
|
|
574
|
+
// if (!Array.isArray(params.id.$in) || params.id.$in.length === 0) {
|
|
575
|
+
// return;
|
|
576
|
+
// }
|
|
577
|
+
// const newIncludedInOfferCatalogItem: {
|
|
578
|
+
// /**
|
|
579
|
+
// * サブカタログID
|
|
580
|
+
// */
|
|
581
|
+
// id: string;
|
|
582
|
+
// typeOf: 'OfferCatalog';
|
|
583
|
+
// includedInDataCatalog: {
|
|
584
|
+
// /**
|
|
585
|
+
// * カタログID
|
|
586
|
+
// */
|
|
587
|
+
// id: string;
|
|
588
|
+
// typeOf: 'OfferCatalog';
|
|
589
|
+
// };
|
|
590
|
+
// } = {
|
|
591
|
+
// id: params.$push.includedInOfferCatalogItem.id.$eq,
|
|
592
|
+
// typeOf: 'OfferCatalog',
|
|
593
|
+
// includedInDataCatalog: { id: params.$push.includedInOfferCatalogItem.includedInDataCatalog.id.$eq, typeOf: 'OfferCatalog' }
|
|
594
|
+
// };
|
|
595
|
+
// const result = await this.aggregateOfferModel.updateMany(
|
|
596
|
+
// {
|
|
597
|
+
// 'project.id': { $eq: params.project.id },
|
|
598
|
+
// _id: { $in: params.id.$in }
|
|
599
|
+
// },
|
|
600
|
+
// {
|
|
601
|
+
// // newIncludedInOfferCatalogItemsのユニークネスを保証する
|
|
602
|
+
// $addToSet: { 'offers.$[].includedInOfferCatalogItem': newIncludedInOfferCatalogItem }
|
|
603
|
+
// }
|
|
604
|
+
// )
|
|
605
|
+
// .exec();
|
|
606
|
+
// debug('result', result);
|
|
607
|
+
// }
|
|
585
608
|
/**
|
|
586
609
|
* サブカタログを含み、かつ、新しいカタログに含まれない集計オファーからサブカタログを除外
|
|
587
610
|
*/
|
|
588
|
-
pullIncludedInOfferCatalogItem(params
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
611
|
+
// public async pullIncludedInOfferCatalogItem(params: {
|
|
612
|
+
// project: { id: string };
|
|
613
|
+
// id?: { $nin?: string[] };
|
|
614
|
+
// $pull: {
|
|
615
|
+
// includedInOfferCatalogItem: {
|
|
616
|
+
// $elemMatch: {
|
|
617
|
+
// /**
|
|
618
|
+
// * サブカタログID
|
|
619
|
+
// */
|
|
620
|
+
// id: { $eq: string };
|
|
621
|
+
// includedInDataCatalog: {
|
|
622
|
+
// /**
|
|
623
|
+
// * カタログID
|
|
624
|
+
// */
|
|
625
|
+
// id: { $eq: string };
|
|
626
|
+
// };
|
|
627
|
+
// };
|
|
628
|
+
// };
|
|
629
|
+
// };
|
|
630
|
+
// }) {
|
|
631
|
+
// const idNin = params.id?.$nin;
|
|
632
|
+
// await this.aggregateOfferModel.updateMany(
|
|
633
|
+
// {
|
|
634
|
+
// 'project.id': { $eq: params.project.id },
|
|
635
|
+
// 'offers.includedInOfferCatalogItem': {
|
|
636
|
+
// $elemMatch: {
|
|
637
|
+
// id: { $exists: true, $eq: params.$pull.includedInOfferCatalogItem.$elemMatch.id.$eq },
|
|
638
|
+
// 'includedInDataCatalog.id': {
|
|
639
|
+
// $exists: true,
|
|
640
|
+
// $eq: params.$pull.includedInOfferCatalogItem.$elemMatch.includedInDataCatalog.id.$eq
|
|
641
|
+
// }
|
|
642
|
+
// }
|
|
643
|
+
// },
|
|
644
|
+
// ...(Array.isArray(idNin)) ? { _id: { $nin: idNin } } : undefined
|
|
645
|
+
// },
|
|
646
|
+
// {
|
|
647
|
+
// $pull: {
|
|
648
|
+
// 'offers.$[].includedInOfferCatalogItem': {
|
|
649
|
+
// id: { $exists: true, $eq: params.$pull.includedInOfferCatalogItem.$elemMatch.id.$eq },
|
|
650
|
+
// 'includedInDataCatalog.id': {
|
|
651
|
+
// $exists: true,
|
|
652
|
+
// $eq: params.$pull.includedInOfferCatalogItem.$elemMatch.includedInDataCatalog.id.$eq
|
|
653
|
+
// }
|
|
654
|
+
// }
|
|
655
|
+
// }
|
|
656
|
+
// }
|
|
657
|
+
// )
|
|
658
|
+
// .exec();
|
|
659
|
+
// }
|
|
614
660
|
/**
|
|
615
661
|
* カタログに属するサブカタログを全て除外する
|
|
616
662
|
*/
|
|
617
|
-
pullIncludedInOfferCatalogItemByCatalogId(params
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
663
|
+
// public async pullIncludedInOfferCatalogItemByCatalogId(params: {
|
|
664
|
+
// project: { id: string };
|
|
665
|
+
// $pull: {
|
|
666
|
+
// includedInOfferCatalogItem: {
|
|
667
|
+
// $elemMatch: {
|
|
668
|
+
// /**
|
|
669
|
+
// * サブカタログID除外リスト
|
|
670
|
+
// */
|
|
671
|
+
// id?: { $nin: string[] };
|
|
672
|
+
// includedInDataCatalog: {
|
|
673
|
+
// /**
|
|
674
|
+
// * カタログID
|
|
675
|
+
// */
|
|
676
|
+
// id: { $eq: string };
|
|
677
|
+
// };
|
|
678
|
+
// };
|
|
679
|
+
// };
|
|
680
|
+
// };
|
|
681
|
+
// }) {
|
|
682
|
+
// const offerCatalogItemIdNin = params.$pull.includedInOfferCatalogItem.$elemMatch.id?.$nin;
|
|
683
|
+
// await this.aggregateOfferModel.updateMany(
|
|
684
|
+
// {
|
|
685
|
+
// 'project.id': { $eq: params.project.id },
|
|
686
|
+
// 'offers.includedInOfferCatalogItem': {
|
|
687
|
+
// $elemMatch: {
|
|
688
|
+
// 'includedInDataCatalog.id': {
|
|
689
|
+
// $exists: true,
|
|
690
|
+
// $eq: params.$pull.includedInOfferCatalogItem.$elemMatch.includedInDataCatalog.id.$eq
|
|
691
|
+
// }
|
|
692
|
+
// }
|
|
693
|
+
// }
|
|
694
|
+
// },
|
|
695
|
+
// {
|
|
696
|
+
// $pull: {
|
|
697
|
+
// 'offers.$[].includedInOfferCatalogItem': {
|
|
698
|
+
// 'includedInDataCatalog.id': {
|
|
699
|
+
// $exists: true,
|
|
700
|
+
// $eq: params.$pull.includedInOfferCatalogItem.$elemMatch.includedInDataCatalog.id.$eq
|
|
701
|
+
// },
|
|
702
|
+
// ...(Array.isArray(offerCatalogItemIdNin))
|
|
703
|
+
// ? { id: { $nin: offerCatalogItemIdNin } } // // 指定サブカタログを除外する
|
|
704
|
+
// : undefined
|
|
705
|
+
// }
|
|
706
|
+
// }
|
|
707
|
+
// }
|
|
708
|
+
// )
|
|
709
|
+
// .exec();
|
|
710
|
+
// }
|
|
644
711
|
/**
|
|
645
712
|
* サブカタログに属するサブカタログを全て除外する
|
|
646
713
|
*/
|
|
647
|
-
pullIncludedInOfferCatalogItemByCatalogItemId(params
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
}
|
|
714
|
+
// public async pullIncludedInOfferCatalogItemByCatalogItemId(params: {
|
|
715
|
+
// project: { id: string };
|
|
716
|
+
// $pull: {
|
|
717
|
+
// includedInOfferCatalogItem: {
|
|
718
|
+
// $elemMatch: {
|
|
719
|
+
// /**
|
|
720
|
+
// * サブカタログID
|
|
721
|
+
// */
|
|
722
|
+
// id: { $eq: string };
|
|
723
|
+
// };
|
|
724
|
+
// };
|
|
725
|
+
// };
|
|
726
|
+
// }) {
|
|
727
|
+
// await this.aggregateOfferModel.updateMany(
|
|
728
|
+
// {
|
|
729
|
+
// 'project.id': { $eq: params.project.id },
|
|
730
|
+
// 'offers.includedInOfferCatalogItem': {
|
|
731
|
+
// $elemMatch: {
|
|
732
|
+
// id: {
|
|
733
|
+
// $exists: true,
|
|
734
|
+
// $eq: params.$pull.includedInOfferCatalogItem.$elemMatch.id.$eq
|
|
735
|
+
// }
|
|
736
|
+
// }
|
|
737
|
+
// }
|
|
738
|
+
// },
|
|
739
|
+
// {
|
|
740
|
+
// $pull: {
|
|
741
|
+
// 'offers.$[].includedInOfferCatalogItem': {
|
|
742
|
+
// id: {
|
|
743
|
+
// $exists: true,
|
|
744
|
+
// $eq: params.$pull.includedInOfferCatalogItem.$elemMatch.id.$eq
|
|
745
|
+
// }
|
|
746
|
+
// }
|
|
747
|
+
// }
|
|
748
|
+
// }
|
|
749
|
+
// )
|
|
750
|
+
// .exec();
|
|
751
|
+
// }
|
|
672
752
|
deleteById(params) {
|
|
673
753
|
return __awaiter(this, void 0, void 0, function* () {
|
|
674
754
|
yield this.aggregateOfferModel.findOneAndRemove({
|
|
@@ -109,12 +109,14 @@ export declare class MongoRepository {
|
|
|
109
109
|
* サブカタログID
|
|
110
110
|
*/
|
|
111
111
|
id: string;
|
|
112
|
+
isOfferCatalogItem: boolean;
|
|
112
113
|
};
|
|
113
114
|
availableAtOrFrom?: {
|
|
114
115
|
id?: string;
|
|
115
116
|
};
|
|
116
117
|
unacceptedPaymentMethod?: string[];
|
|
117
118
|
excludeAppliesToMovieTicket: boolean;
|
|
119
|
+
useIncludeInDataCatalog: boolean;
|
|
118
120
|
onlyValid?: boolean;
|
|
119
121
|
limit?: number;
|
|
120
122
|
page?: number;
|
package/lib/chevre/repo/offer.js
CHANGED
|
@@ -568,7 +568,17 @@ class MongoRepository {
|
|
|
568
568
|
searchAvaialbleAppliesToMovieTicketByOfferCatalogId(params) {
|
|
569
569
|
var _a;
|
|
570
570
|
return __awaiter(this, void 0, void 0, function* () {
|
|
571
|
-
|
|
571
|
+
let sortedOfferIds = [];
|
|
572
|
+
if (!params.useIncludeInDataCatalog) {
|
|
573
|
+
// useIncludeInDataCatalogでない場合のみ集計オファーIDリストを検索する
|
|
574
|
+
sortedOfferIds = yield this.searchAggregateOfferIdsBySubOfferCatalog({
|
|
575
|
+
id: params.subOfferCatalog.id,
|
|
576
|
+
isOfferCatalogItem: params.subOfferCatalog.isOfferCatalogItem
|
|
577
|
+
});
|
|
578
|
+
}
|
|
579
|
+
const searchOffersConditions = Object.assign(Object.assign(Object.assign({}, (params.useIncludeInDataCatalog)
|
|
580
|
+
? { includedInDataCatalog: { id: { $in: [params.subOfferCatalog.id] } } }
|
|
581
|
+
: { parentOffer: { id: { $in: sortedOfferIds } } }), (typeof ((_a = params.availableAtOrFrom) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
572
582
|
? { availableAtOrFrom: { id: { $eq: params.availableAtOrFrom.id } } }
|
|
573
583
|
: undefined), { priceSpecification: {
|
|
574
584
|
appliesToMovieTicket: Object.assign({
|
|
@@ -270,7 +270,8 @@ class MongoRepository {
|
|
|
270
270
|
}
|
|
271
271
|
},
|
|
272
272
|
// itemListElement.typeOfを追加(2023-09-14~)
|
|
273
|
-
itemListElementTypeOf: { $first: '$itemListElement.typeOf' }
|
|
273
|
+
itemListElementTypeOf: { $first: '$itemListElement.typeOf' },
|
|
274
|
+
dateSynced: '$dateSynced'
|
|
274
275
|
}
|
|
275
276
|
}
|
|
276
277
|
]);
|
|
@@ -171,10 +171,11 @@ class MongoRepository {
|
|
|
171
171
|
else: 0
|
|
172
172
|
}
|
|
173
173
|
},
|
|
174
|
-
itemListElementTypeOf: { $first: '$itemListElement.typeOf' }
|
|
174
|
+
itemListElementTypeOf: { $first: '$itemListElement.typeOf' },
|
|
175
|
+
dateSynced: '$dateSynced'
|
|
175
176
|
};
|
|
176
177
|
const positiveProjectionFields = Object.keys(projection)
|
|
177
|
-
.filter((key) => projection[key] !== 0
|
|
178
|
+
.filter((key) => projection[key] !== 0);
|
|
178
179
|
const negativeProjectionFields = Object.keys(projection)
|
|
179
180
|
.filter((key) => projection[key] === 0);
|
|
180
181
|
if (positiveProjectionFields.length > 0) {
|
|
@@ -183,12 +184,14 @@ class MongoRepository {
|
|
|
183
184
|
id: { $toString: '$_id' }
|
|
184
185
|
};
|
|
185
186
|
positiveProjectionFields.forEach((field) => {
|
|
186
|
-
|
|
187
|
+
if (field !== '_id' && field !== 'id') {
|
|
188
|
+
projectStage[field] = `$${field}`;
|
|
189
|
+
}
|
|
187
190
|
});
|
|
188
191
|
}
|
|
189
192
|
else if (negativeProjectionFields.length > 0) {
|
|
190
193
|
negativeProjectionFields.forEach((field) => {
|
|
191
|
-
if (
|
|
194
|
+
if (projectStage[field] !== undefined && projectStage[field] !== null) {
|
|
192
195
|
// tslint:disable-next-line:no-dynamic-delete
|
|
193
196
|
delete projectStage[field];
|
|
194
197
|
}
|
|
@@ -74,7 +74,7 @@ export declare class MongoRepository {
|
|
|
74
74
|
*/
|
|
75
75
|
$nin?: factory.taskName[];
|
|
76
76
|
};
|
|
77
|
-
}): Promise<Pick<import("@chevre/factory/lib/task").ITask | import("@chevre/factory/lib/task/confirmMoneyTransfer").ITask | import("@chevre/factory/lib/task/confirmRegisterService").ITask | import("@chevre/factory/lib/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/task/createEvent").ITask | import("@chevre/factory/lib/task/deleteTransaction").ITask | import("@chevre/factory/lib/task/givePointAward").ITask | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").ITask | import("@chevre/factory/lib/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/task/onEventChanged").ITask | import("@chevre/factory/lib/task/onResourceUpdated").ITask | import("@chevre/factory/lib/task/onOrderPaymentCompleted").ITask | import("@chevre/factory/lib/task/placeOrder").ITask | import("@chevre/factory/lib/task/returnOrder").ITask | import("@chevre/factory/lib/task/returnMoneyTransfer").ITask | import("@chevre/factory/lib/task/returnPayTransaction").ITask | import("@chevre/factory/lib/task/returnPointAward").ITask | import("@chevre/factory/lib/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/task/sendEmailMessage").ITask | import("@chevre/factory/lib/task/sendOrder").ITask | import("@chevre/factory/lib/task/
|
|
77
|
+
}): Promise<Pick<import("@chevre/factory/lib/task").ITask | import("@chevre/factory/lib/task/confirmMoneyTransfer").ITask | import("@chevre/factory/lib/task/confirmRegisterService").ITask | import("@chevre/factory/lib/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/task/createEvent").ITask | import("@chevre/factory/lib/task/deleteTransaction").ITask | import("@chevre/factory/lib/task/givePointAward").ITask | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").ITask | import("@chevre/factory/lib/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/task/onEventChanged").ITask | import("@chevre/factory/lib/task/onResourceUpdated").ITask | import("@chevre/factory/lib/task/onOrderPaymentCompleted").ITask | import("@chevre/factory/lib/task/placeOrder").ITask | import("@chevre/factory/lib/task/returnOrder").ITask | import("@chevre/factory/lib/task/returnMoneyTransfer").ITask | import("@chevre/factory/lib/task/returnPayTransaction").ITask | import("@chevre/factory/lib/task/returnPointAward").ITask | import("@chevre/factory/lib/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/task/sendEmailMessage").ITask | import("@chevre/factory/lib/task/sendOrder").ITask | import("@chevre/factory/lib/task/syncScreeningRooms").ITask | import("@chevre/factory/lib/task/triggerWebhook").ITask | import("@chevre/factory/lib/task/useReservation").ITask | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").ITask | import("@chevre/factory/lib/task/voidPayTransaction").ITask | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/voidReserveTransaction").ITask, "id" | "name" | "status">[]>;
|
|
78
78
|
retry(params: {
|
|
79
79
|
intervalInMinutes: number;
|
|
80
80
|
}): Promise<void>;
|
|
@@ -333,16 +333,19 @@ function searchOfferAppliesToMovieTicket(params) {
|
|
|
333
333
|
}
|
|
334
334
|
// サブカタログIDを決定
|
|
335
335
|
let subOfferCatalogId = catalogId;
|
|
336
|
+
let isOfferCatalogItem = false;
|
|
336
337
|
const offerCatalogFirstElement = yield repos.offerCatalog.findFirstItemListElementById({ id: catalogId });
|
|
337
338
|
if (offerCatalogFirstElement.typeOf === 'OfferCatalog') {
|
|
338
339
|
subOfferCatalogId = offerCatalogFirstElement.id;
|
|
340
|
+
isOfferCatalogItem = true;
|
|
339
341
|
}
|
|
340
342
|
return repos.offer.searchAvaialbleAppliesToMovieTicketByOfferCatalogId({
|
|
341
|
-
subOfferCatalog: { id: subOfferCatalogId },
|
|
343
|
+
subOfferCatalog: { id: subOfferCatalogId, isOfferCatalogItem },
|
|
342
344
|
availableAtOrFrom: { id: (_c = params.store) === null || _c === void 0 ? void 0 : _c.id },
|
|
343
345
|
unacceptedPaymentMethod: unacceptedPaymentMethod,
|
|
344
346
|
excludeAppliesToMovieTicket: excludeAppliesToMovieTicket,
|
|
345
347
|
onlyValid: params.onlyValid === true,
|
|
348
|
+
useIncludeInDataCatalog: params.useIncludeInDataCatalog,
|
|
346
349
|
limit: params.limit,
|
|
347
350
|
page: params.page
|
|
348
351
|
});
|
|
@@ -26,17 +26,17 @@ export type IExternalOrder = Pick<factory.order.IOrder, 'project' | 'typeOf' | '
|
|
|
26
26
|
*/
|
|
27
27
|
export declare function createOnOrderSentTasksByTransaction(params: {
|
|
28
28
|
potentialActions?: factory.action.transfer.send.order.IPotentialActions;
|
|
29
|
-
}): (import("@chevre/factory/lib/task").IAttributes | import("@chevre/factory/lib/task/confirmMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/confirmRegisterService").IAttributes | import("@chevre/factory/lib/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/task/createEvent").IAttributes | import("@chevre/factory/lib/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/task/givePointAward").IAttributes | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/task/onEventChanged").IAttributes | import("@chevre/factory/lib/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/task/placeOrder").IAttributes | import("@chevre/factory/lib/task/returnOrder").IAttributes | import("@chevre/factory/lib/task/returnMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/task/returnPointAward").IAttributes | import("@chevre/factory/lib/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/task/sendOrder").IAttributes | import("@chevre/factory/lib/task/
|
|
29
|
+
}): (import("@chevre/factory/lib/task").IAttributes | import("@chevre/factory/lib/task/confirmMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/confirmRegisterService").IAttributes | import("@chevre/factory/lib/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/task/createEvent").IAttributes | import("@chevre/factory/lib/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/task/givePointAward").IAttributes | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/task/onEventChanged").IAttributes | import("@chevre/factory/lib/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/task/placeOrder").IAttributes | import("@chevre/factory/lib/task/returnOrder").IAttributes | import("@chevre/factory/lib/task/returnMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/task/returnPointAward").IAttributes | import("@chevre/factory/lib/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/task/sendOrder").IAttributes | import("@chevre/factory/lib/task/syncScreeningRooms").IAttributes | import("@chevre/factory/lib/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/task/useReservation").IAttributes | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").IAttributes | import("@chevre/factory/lib/task/voidPayTransaction").IAttributes | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/voidReserveTransaction").IAttributes)[];
|
|
30
30
|
/**
|
|
31
31
|
* 注文返品後のアクション
|
|
32
32
|
*/
|
|
33
33
|
export declare function createOnOrderReturnedTasksByTransaction(params: {
|
|
34
34
|
potentialActions?: factory.action.transfer.returnAction.order.IPotentialActions;
|
|
35
|
-
}): (import("@chevre/factory/lib/task").IAttributes | import("@chevre/factory/lib/task/confirmMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/confirmRegisterService").IAttributes | import("@chevre/factory/lib/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/task/createEvent").IAttributes | import("@chevre/factory/lib/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/task/givePointAward").IAttributes | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/task/onEventChanged").IAttributes | import("@chevre/factory/lib/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/task/placeOrder").IAttributes | import("@chevre/factory/lib/task/returnOrder").IAttributes | import("@chevre/factory/lib/task/returnMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/task/returnPointAward").IAttributes | import("@chevre/factory/lib/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/task/sendOrder").IAttributes | import("@chevre/factory/lib/task/
|
|
35
|
+
}): (import("@chevre/factory/lib/task").IAttributes | import("@chevre/factory/lib/task/confirmMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/confirmRegisterService").IAttributes | import("@chevre/factory/lib/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/task/createEvent").IAttributes | import("@chevre/factory/lib/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/task/givePointAward").IAttributes | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/task/onEventChanged").IAttributes | import("@chevre/factory/lib/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/task/placeOrder").IAttributes | import("@chevre/factory/lib/task/returnOrder").IAttributes | import("@chevre/factory/lib/task/returnMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/task/returnPointAward").IAttributes | import("@chevre/factory/lib/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/task/sendOrder").IAttributes | import("@chevre/factory/lib/task/syncScreeningRooms").IAttributes | import("@chevre/factory/lib/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/task/useReservation").IAttributes | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").IAttributes | import("@chevre/factory/lib/task/voidPayTransaction").IAttributes | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/voidReserveTransaction").IAttributes)[];
|
|
36
36
|
/**
|
|
37
37
|
* 注文中止時のアクション
|
|
38
38
|
*/
|
|
39
39
|
export declare function createOnOrderCancelledTasksByTransaction(params: {
|
|
40
40
|
transaction?: factory.transaction.placeOrder.ITransaction;
|
|
41
|
-
}): (import("@chevre/factory/lib/task").IAttributes | import("@chevre/factory/lib/task/confirmMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/confirmRegisterService").IAttributes | import("@chevre/factory/lib/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/task/createEvent").IAttributes | import("@chevre/factory/lib/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/task/givePointAward").IAttributes | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/task/onEventChanged").IAttributes | import("@chevre/factory/lib/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/task/placeOrder").IAttributes | import("@chevre/factory/lib/task/returnOrder").IAttributes | import("@chevre/factory/lib/task/returnMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/task/returnPointAward").IAttributes | import("@chevre/factory/lib/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/task/sendOrder").IAttributes | import("@chevre/factory/lib/task/
|
|
41
|
+
}): (import("@chevre/factory/lib/task").IAttributes | import("@chevre/factory/lib/task/confirmMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/confirmRegisterService").IAttributes | import("@chevre/factory/lib/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/task/createEvent").IAttributes | import("@chevre/factory/lib/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/task/givePointAward").IAttributes | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/task/onEventChanged").IAttributes | import("@chevre/factory/lib/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/task/placeOrder").IAttributes | import("@chevre/factory/lib/task/returnOrder").IAttributes | import("@chevre/factory/lib/task/returnMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/task/returnPointAward").IAttributes | import("@chevre/factory/lib/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/task/sendOrder").IAttributes | import("@chevre/factory/lib/task/syncScreeningRooms").IAttributes | import("@chevre/factory/lib/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/task/useReservation").IAttributes | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").IAttributes | import("@chevre/factory/lib/task/voidPayTransaction").IAttributes | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/voidReserveTransaction").IAttributes)[];
|
|
42
42
|
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as factory from '../../../factory';
|
|
2
|
+
import { MongoRepository as AggregateOfferRepo } from '../../../repo/aggregateOffer';
|
|
3
|
+
import { MongoRepository as OfferCatalogRepo } from '../../../repo/offerCatalog';
|
|
4
|
+
import { MongoRepository as OfferCatalogItemRepo } from '../../../repo/offerCatalogItem';
|
|
5
|
+
/**
|
|
6
|
+
* オファーカタログ変更時処理
|
|
7
|
+
*/
|
|
8
|
+
export declare function onOfferCatalogUpdated(params: {
|
|
9
|
+
project: {
|
|
10
|
+
id: string;
|
|
11
|
+
};
|
|
12
|
+
ids: string[];
|
|
13
|
+
typeOf: factory.task.onResourceUpdated.OfferCatalogType;
|
|
14
|
+
isDeleted: boolean;
|
|
15
|
+
isOfferCatalogItem: boolean;
|
|
16
|
+
}): (repos: {
|
|
17
|
+
aggregateOffer: AggregateOfferRepo;
|
|
18
|
+
offerCatalog: OfferCatalogRepo;
|
|
19
|
+
offerCatalogItem: OfferCatalogItemRepo;
|
|
20
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.onOfferCatalogUpdated = void 0;
|
|
13
|
+
const syncOfferCatalog_1 = require("./syncOfferCatalog");
|
|
14
|
+
/**
|
|
15
|
+
* オファーカタログ変更時処理
|
|
16
|
+
*/
|
|
17
|
+
function onOfferCatalogUpdated(params) {
|
|
18
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
yield (0, syncOfferCatalog_1.syncOfferCatalog)({
|
|
20
|
+
project: { id: params.project.id },
|
|
21
|
+
ids: params.ids,
|
|
22
|
+
typeOf: params.typeOf,
|
|
23
|
+
isDeleted: false,
|
|
24
|
+
isOfferCatalogItem: params.isOfferCatalogItem === true
|
|
25
|
+
})(repos);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
exports.onOfferCatalogUpdated = onOfferCatalogUpdated;
|
|
@@ -29,20 +29,6 @@ function syncOfferCatalog(params) {
|
|
|
29
29
|
includedInDataCatalog: { $elemMatch: { id: { $eq: offerCatalogId } } }
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
|
-
// 記載サブカタログ同期
|
|
33
|
-
// await repos.aggregateOffer.pullIncludedInOfferCatalogItemByCatalogId({
|
|
34
|
-
// project: { id: params.project.id },
|
|
35
|
-
// $pull: {
|
|
36
|
-
// includedInOfferCatalogItem: { $elemMatch: { includedInDataCatalog: { id: { $eq: offerCatalogId } } } }
|
|
37
|
-
// }
|
|
38
|
-
// });
|
|
39
|
-
// 記載サブカタログ同期
|
|
40
|
-
// await repos.aggregateOffer.pullIncludedInOfferCatalogItemByCatalogItemId({
|
|
41
|
-
// project: { id: params.project.id },
|
|
42
|
-
// $pull: {
|
|
43
|
-
// includedInOfferCatalogItem: { $elemMatch: { id: { $eq: offerCatalogId } } }
|
|
44
|
-
// }
|
|
45
|
-
// });
|
|
46
32
|
}
|
|
47
33
|
}
|
|
48
34
|
else {
|
|
@@ -63,13 +49,6 @@ function syncOfferCatalog(params) {
|
|
|
63
49
|
project: { id: params.project.id },
|
|
64
50
|
isOfferCatalogItem: params.isOfferCatalogItem
|
|
65
51
|
})(repos);
|
|
66
|
-
if (params.isOfferCatalogItem) {
|
|
67
|
-
// offerCatalogItemの場合、記載サブカタログ情報を単価オファーへ同期(2023-09-21~)
|
|
68
|
-
// await syncOfferCatalogItem2offer({
|
|
69
|
-
// id: offerCatalogId,
|
|
70
|
-
// project: { id: params.project.id }
|
|
71
|
-
// })(repos);
|
|
72
|
-
}
|
|
73
52
|
// 同期済記録を補完
|
|
74
53
|
if (params.isOfferCatalogItem) {
|
|
75
54
|
yield repos.offerCatalogItem.updateDateSynced({ id: offerCatalogId, dateSynced: new Date() });
|
|
@@ -79,11 +58,7 @@ function syncOfferCatalog(params) {
|
|
|
79
58
|
}
|
|
80
59
|
break;
|
|
81
60
|
case 'OfferCatalog':
|
|
82
|
-
//
|
|
83
|
-
// await syncOfferCatalog2offer({
|
|
84
|
-
// id: offerCatalogId,
|
|
85
|
-
// project: { id: params.project.id }
|
|
86
|
-
// })(repos);
|
|
61
|
+
// 特に何もしない
|
|
87
62
|
yield repos.offerCatalog.updateDateSynced({ id: offerCatalogId, dateSynced: new Date() });
|
|
88
63
|
break;
|
|
89
64
|
default:
|
|
@@ -128,141 +103,3 @@ function syncOfferCatalogOfOffer2offer(params) {
|
|
|
128
103
|
}
|
|
129
104
|
});
|
|
130
105
|
}
|
|
131
|
-
// function syncOfferCatalog2offer(params: {
|
|
132
|
-
// /**
|
|
133
|
-
// * カタログID(アイテムタイプ:OfferCatalogのOfferCatalog)
|
|
134
|
-
// */
|
|
135
|
-
// id: string;
|
|
136
|
-
// project: { id: string };
|
|
137
|
-
// }) {
|
|
138
|
-
// return async (repos: {
|
|
139
|
-
// aggregateOffer: AggregateOfferRepo;
|
|
140
|
-
// offerCatalog: OfferCatalogRepo;
|
|
141
|
-
// offerCatalogItem: OfferCatalogItemRepo;
|
|
142
|
-
// }) => {
|
|
143
|
-
// // サブカタログIDリストを検索
|
|
144
|
-
// let offerCatalogItemIds: string[];
|
|
145
|
-
// const { itemListElement } = await repos.offerCatalog.findItemListElementById({
|
|
146
|
-
// id: params.id,
|
|
147
|
-
// project: { id: params.project.id }
|
|
148
|
-
// });
|
|
149
|
-
// offerCatalogItemIds = itemListElement.map((element) => element.id);
|
|
150
|
-
// // サブカタログごとに同期
|
|
151
|
-
// if (offerCatalogItemIds.length > 0) {
|
|
152
|
-
// // カタログに含まれるがサブカタログに含まれないものを除外
|
|
153
|
-
// await repos.aggregateOffer.pullIncludedInOfferCatalogItemByCatalogId({
|
|
154
|
-
// project: { id: params.project.id },
|
|
155
|
-
// $pull: {
|
|
156
|
-
// includedInOfferCatalogItem: {
|
|
157
|
-
// $elemMatch: {
|
|
158
|
-
// id: { $nin: offerCatalogItemIds },
|
|
159
|
-
// includedInDataCatalog: { id: { $eq: params.id } }
|
|
160
|
-
// }
|
|
161
|
-
// }
|
|
162
|
-
// }
|
|
163
|
-
// });
|
|
164
|
-
// for (const offerCatalogItemId of offerCatalogItemIds) {
|
|
165
|
-
// await syncSubCatalogs2offer({
|
|
166
|
-
// id: offerCatalogItemId,
|
|
167
|
-
// includedInDataCatalog: { id: params.id },
|
|
168
|
-
// project: params.project
|
|
169
|
-
// })(repos);
|
|
170
|
-
// }
|
|
171
|
-
// } else {
|
|
172
|
-
// // 全てpull
|
|
173
|
-
// await repos.aggregateOffer.pullIncludedInOfferCatalogItemByCatalogId({
|
|
174
|
-
// project: { id: params.project.id },
|
|
175
|
-
// $pull: {
|
|
176
|
-
// includedInOfferCatalogItem: {
|
|
177
|
-
// $elemMatch: {
|
|
178
|
-
// includedInDataCatalog: { id: { $eq: params.id } }
|
|
179
|
-
// }
|
|
180
|
-
// }
|
|
181
|
-
// }
|
|
182
|
-
// });
|
|
183
|
-
// }
|
|
184
|
-
// };
|
|
185
|
-
// }
|
|
186
|
-
// function syncOfferCatalogItem2offer(params: {
|
|
187
|
-
// /**
|
|
188
|
-
// * サブカタログID
|
|
189
|
-
// */
|
|
190
|
-
// id: string;
|
|
191
|
-
// project: { id: string };
|
|
192
|
-
// }) {
|
|
193
|
-
// return async (repos: {
|
|
194
|
-
// aggregateOffer: AggregateOfferRepo;
|
|
195
|
-
// offerCatalog: OfferCatalogRepo;
|
|
196
|
-
// offerCatalogItem: OfferCatalogItemRepo;
|
|
197
|
-
// }) => {
|
|
198
|
-
// // 記載カタログを検索
|
|
199
|
-
// const offerCatalogs = await repos.offerCatalog.search({
|
|
200
|
-
// project: { id: { $eq: params.project.id } },
|
|
201
|
-
// itemListElement: {
|
|
202
|
-
// id: { $in: [params.id] },
|
|
203
|
-
// typeOf: { $eq: 'OfferCatalog' }
|
|
204
|
-
// }
|
|
205
|
-
// });
|
|
206
|
-
// for (const offerCatalog of offerCatalogs) {
|
|
207
|
-
// await syncSubCatalogs2offer({
|
|
208
|
-
// id: params.id,
|
|
209
|
-
// includedInDataCatalog: { id: String(offerCatalog.id) },
|
|
210
|
-
// project: params.project
|
|
211
|
-
// })(repos);
|
|
212
|
-
// }
|
|
213
|
-
// };
|
|
214
|
-
// }
|
|
215
|
-
/**
|
|
216
|
-
* サブカタログ+カタログを単価オファーへ同期する
|
|
217
|
-
*/
|
|
218
|
-
// function syncSubCatalogs2offer(params: {
|
|
219
|
-
// /**
|
|
220
|
-
// * サブカタログID
|
|
221
|
-
// */
|
|
222
|
-
// id: string;
|
|
223
|
-
// includedInDataCatalog: {
|
|
224
|
-
// /**
|
|
225
|
-
// * カタログID
|
|
226
|
-
// */
|
|
227
|
-
// id: string;
|
|
228
|
-
// };
|
|
229
|
-
// project: { id: string };
|
|
230
|
-
// }) {
|
|
231
|
-
// return async (repos: {
|
|
232
|
-
// aggregateOffer: AggregateOfferRepo;
|
|
233
|
-
// offerCatalogItem: OfferCatalogItemRepo;
|
|
234
|
-
// }) => {
|
|
235
|
-
// const offerCatalogItemId = params.id;
|
|
236
|
-
// // 集計オファーIDリストを検索
|
|
237
|
-
// let aggregateOfferIds: string[];
|
|
238
|
-
// const findSubCatalogItemListElementResult = await repos.offerCatalogItem.findItemListElementById({
|
|
239
|
-
// id: offerCatalogItemId,
|
|
240
|
-
// project: { id: params.project.id }
|
|
241
|
-
// });
|
|
242
|
-
// aggregateOfferIds = findSubCatalogItemListElementResult.itemListElement.map((element) => element.id);
|
|
243
|
-
// await repos.aggregateOffer.pullIncludedInOfferCatalogItem({
|
|
244
|
-
// project: { id: params.project.id },
|
|
245
|
-
// $pull: {
|
|
246
|
-
// includedInOfferCatalogItem: {
|
|
247
|
-
// $elemMatch: {
|
|
248
|
-
// id: { $eq: offerCatalogItemId },
|
|
249
|
-
// includedInDataCatalog: { id: { $eq: params.includedInDataCatalog.id } }
|
|
250
|
-
// }
|
|
251
|
-
// }
|
|
252
|
-
// },
|
|
253
|
-
// ...(aggregateOfferIds.length > 0) ? { id: { $nin: aggregateOfferIds } } : undefined
|
|
254
|
-
// });
|
|
255
|
-
// if (aggregateOfferIds.length > 0) {
|
|
256
|
-
// await repos.aggregateOffer.pushIncludedInOfferCatalogItem({
|
|
257
|
-
// project: { id: params.project.id },
|
|
258
|
-
// id: { $in: aggregateOfferIds },
|
|
259
|
-
// $push: {
|
|
260
|
-
// includedInOfferCatalogItem: {
|
|
261
|
-
// id: { $eq: offerCatalogItemId },
|
|
262
|
-
// includedInDataCatalog: { id: { $eq: params.includedInDataCatalog.id } }
|
|
263
|
-
// }
|
|
264
|
-
// }
|
|
265
|
-
// });
|
|
266
|
-
// }
|
|
267
|
-
// };
|
|
268
|
-
// }
|
|
@@ -26,8 +26,8 @@ const place_1 = require("../../repo/place");
|
|
|
26
26
|
const product_1 = require("../../repo/product");
|
|
27
27
|
const productOffer_1 = require("../../repo/productOffer");
|
|
28
28
|
const task_1 = require("../../repo/task");
|
|
29
|
+
const onOfferCatalogUpdated_1 = require("./onResourceUpdated/onOfferCatalogUpdated");
|
|
29
30
|
const onResourceDeleted_1 = require("./onResourceUpdated/onResourceDeleted");
|
|
30
|
-
const syncOfferCatalog_1 = require("./onResourceUpdated/syncOfferCatalog");
|
|
31
31
|
const settings_1 = require("../../settings");
|
|
32
32
|
const informResources = settings_1.settings.onResourceUpdated.informResource;
|
|
33
33
|
/**
|
|
@@ -114,7 +114,7 @@ function onResourceUpdated(params) {
|
|
|
114
114
|
break;
|
|
115
115
|
// カタログに対応(2023-09-12~)
|
|
116
116
|
case 'OfferCatalog':
|
|
117
|
-
yield (0,
|
|
117
|
+
yield (0, onOfferCatalogUpdated_1.onOfferCatalogUpdated)({
|
|
118
118
|
project: { id: params.project.id },
|
|
119
119
|
ids: params.id,
|
|
120
120
|
typeOf: params.typeOf,
|
package/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.330.0
|
|
13
|
-
"@cinerino/sdk": "3.
|
|
12
|
+
"@chevre/factory": "4.330.0",
|
|
13
|
+
"@cinerino/sdk": "3.169.0-alpha.1",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
16
16
|
"@sendgrid/mail": "6.4.0",
|
|
@@ -117,5 +117,5 @@
|
|
|
117
117
|
"postversion": "git push origin --tags",
|
|
118
118
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
119
119
|
},
|
|
120
|
-
"version": "21.9.0-alpha.
|
|
120
|
+
"version": "21.9.0-alpha.16"
|
|
121
121
|
}
|