@chevre/domain 21.9.0-alpha.14 → 21.9.0-alpha.15
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/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 +187 -102
- 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/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
|
@@ -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;
|
|
@@ -558,117 +558,202 @@ class MongoRepository {
|
|
|
558
558
|
.exec();
|
|
559
559
|
});
|
|
560
560
|
}
|
|
561
|
-
pushIncludedInOfferCatalogItem(params
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
561
|
+
// public async pushIncludedInOfferCatalogItem(params: {
|
|
562
|
+
// project: { id: string };
|
|
563
|
+
// id: { $in: string[] };
|
|
564
|
+
// $push: {
|
|
565
|
+
// includedInOfferCatalogItem: {
|
|
566
|
+
// /**
|
|
567
|
+
// * サブカタログID
|
|
568
|
+
// */
|
|
569
|
+
// id: { $eq: string };
|
|
570
|
+
// includedInDataCatalog: {
|
|
571
|
+
// /**
|
|
572
|
+
// * カタログID
|
|
573
|
+
// */
|
|
574
|
+
// id: { $eq: string };
|
|
575
|
+
// };
|
|
576
|
+
// };
|
|
577
|
+
// };
|
|
578
|
+
// }): Promise<void> {
|
|
579
|
+
// if (!Array.isArray(params.id.$in) || params.id.$in.length === 0) {
|
|
580
|
+
// return;
|
|
581
|
+
// }
|
|
582
|
+
// const newIncludedInOfferCatalogItem: {
|
|
583
|
+
// /**
|
|
584
|
+
// * サブカタログID
|
|
585
|
+
// */
|
|
586
|
+
// id: string;
|
|
587
|
+
// typeOf: 'OfferCatalog';
|
|
588
|
+
// includedInDataCatalog: {
|
|
589
|
+
// /**
|
|
590
|
+
// * カタログID
|
|
591
|
+
// */
|
|
592
|
+
// id: string;
|
|
593
|
+
// typeOf: 'OfferCatalog';
|
|
594
|
+
// };
|
|
595
|
+
// } = {
|
|
596
|
+
// id: params.$push.includedInOfferCatalogItem.id.$eq,
|
|
597
|
+
// typeOf: 'OfferCatalog',
|
|
598
|
+
// includedInDataCatalog: { id: params.$push.includedInOfferCatalogItem.includedInDataCatalog.id.$eq, typeOf: 'OfferCatalog' }
|
|
599
|
+
// };
|
|
600
|
+
// const result = await this.aggregateOfferModel.updateMany(
|
|
601
|
+
// {
|
|
602
|
+
// 'project.id': { $eq: params.project.id },
|
|
603
|
+
// _id: { $in: params.id.$in }
|
|
604
|
+
// },
|
|
605
|
+
// {
|
|
606
|
+
// // newIncludedInOfferCatalogItemsのユニークネスを保証する
|
|
607
|
+
// $addToSet: { 'offers.$[].includedInOfferCatalogItem': newIncludedInOfferCatalogItem }
|
|
608
|
+
// }
|
|
609
|
+
// )
|
|
610
|
+
// .exec();
|
|
611
|
+
// debug('result', result);
|
|
612
|
+
// }
|
|
585
613
|
/**
|
|
586
614
|
* サブカタログを含み、かつ、新しいカタログに含まれない集計オファーからサブカタログを除外
|
|
587
615
|
*/
|
|
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
|
-
|
|
616
|
+
// public async pullIncludedInOfferCatalogItem(params: {
|
|
617
|
+
// project: { id: string };
|
|
618
|
+
// id?: { $nin?: string[] };
|
|
619
|
+
// $pull: {
|
|
620
|
+
// includedInOfferCatalogItem: {
|
|
621
|
+
// $elemMatch: {
|
|
622
|
+
// /**
|
|
623
|
+
// * サブカタログID
|
|
624
|
+
// */
|
|
625
|
+
// id: { $eq: string };
|
|
626
|
+
// includedInDataCatalog: {
|
|
627
|
+
// /**
|
|
628
|
+
// * カタログID
|
|
629
|
+
// */
|
|
630
|
+
// id: { $eq: string };
|
|
631
|
+
// };
|
|
632
|
+
// };
|
|
633
|
+
// };
|
|
634
|
+
// };
|
|
635
|
+
// }) {
|
|
636
|
+
// const idNin = params.id?.$nin;
|
|
637
|
+
// await this.aggregateOfferModel.updateMany(
|
|
638
|
+
// {
|
|
639
|
+
// 'project.id': { $eq: params.project.id },
|
|
640
|
+
// 'offers.includedInOfferCatalogItem': {
|
|
641
|
+
// $elemMatch: {
|
|
642
|
+
// id: { $exists: true, $eq: params.$pull.includedInOfferCatalogItem.$elemMatch.id.$eq },
|
|
643
|
+
// 'includedInDataCatalog.id': {
|
|
644
|
+
// $exists: true,
|
|
645
|
+
// $eq: params.$pull.includedInOfferCatalogItem.$elemMatch.includedInDataCatalog.id.$eq
|
|
646
|
+
// }
|
|
647
|
+
// }
|
|
648
|
+
// },
|
|
649
|
+
// ...(Array.isArray(idNin)) ? { _id: { $nin: idNin } } : undefined
|
|
650
|
+
// },
|
|
651
|
+
// {
|
|
652
|
+
// $pull: {
|
|
653
|
+
// 'offers.$[].includedInOfferCatalogItem': {
|
|
654
|
+
// id: { $exists: true, $eq: params.$pull.includedInOfferCatalogItem.$elemMatch.id.$eq },
|
|
655
|
+
// 'includedInDataCatalog.id': {
|
|
656
|
+
// $exists: true,
|
|
657
|
+
// $eq: params.$pull.includedInOfferCatalogItem.$elemMatch.includedInDataCatalog.id.$eq
|
|
658
|
+
// }
|
|
659
|
+
// }
|
|
660
|
+
// }
|
|
661
|
+
// }
|
|
662
|
+
// )
|
|
663
|
+
// .exec();
|
|
664
|
+
// }
|
|
614
665
|
/**
|
|
615
666
|
* カタログに属するサブカタログを全て除外する
|
|
616
667
|
*/
|
|
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
|
-
|
|
668
|
+
// public async pullIncludedInOfferCatalogItemByCatalogId(params: {
|
|
669
|
+
// project: { id: string };
|
|
670
|
+
// $pull: {
|
|
671
|
+
// includedInOfferCatalogItem: {
|
|
672
|
+
// $elemMatch: {
|
|
673
|
+
// /**
|
|
674
|
+
// * サブカタログID除外リスト
|
|
675
|
+
// */
|
|
676
|
+
// id?: { $nin: string[] };
|
|
677
|
+
// includedInDataCatalog: {
|
|
678
|
+
// /**
|
|
679
|
+
// * カタログID
|
|
680
|
+
// */
|
|
681
|
+
// id: { $eq: string };
|
|
682
|
+
// };
|
|
683
|
+
// };
|
|
684
|
+
// };
|
|
685
|
+
// };
|
|
686
|
+
// }) {
|
|
687
|
+
// const offerCatalogItemIdNin = params.$pull.includedInOfferCatalogItem.$elemMatch.id?.$nin;
|
|
688
|
+
// await this.aggregateOfferModel.updateMany(
|
|
689
|
+
// {
|
|
690
|
+
// 'project.id': { $eq: params.project.id },
|
|
691
|
+
// 'offers.includedInOfferCatalogItem': {
|
|
692
|
+
// $elemMatch: {
|
|
693
|
+
// 'includedInDataCatalog.id': {
|
|
694
|
+
// $exists: true,
|
|
695
|
+
// $eq: params.$pull.includedInOfferCatalogItem.$elemMatch.includedInDataCatalog.id.$eq
|
|
696
|
+
// }
|
|
697
|
+
// }
|
|
698
|
+
// }
|
|
699
|
+
// },
|
|
700
|
+
// {
|
|
701
|
+
// $pull: {
|
|
702
|
+
// 'offers.$[].includedInOfferCatalogItem': {
|
|
703
|
+
// 'includedInDataCatalog.id': {
|
|
704
|
+
// $exists: true,
|
|
705
|
+
// $eq: params.$pull.includedInOfferCatalogItem.$elemMatch.includedInDataCatalog.id.$eq
|
|
706
|
+
// },
|
|
707
|
+
// ...(Array.isArray(offerCatalogItemIdNin))
|
|
708
|
+
// ? { id: { $nin: offerCatalogItemIdNin } } // // 指定サブカタログを除外する
|
|
709
|
+
// : undefined
|
|
710
|
+
// }
|
|
711
|
+
// }
|
|
712
|
+
// }
|
|
713
|
+
// )
|
|
714
|
+
// .exec();
|
|
715
|
+
// }
|
|
644
716
|
/**
|
|
645
717
|
* サブカタログに属するサブカタログを全て除外する
|
|
646
718
|
*/
|
|
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
|
-
}
|
|
719
|
+
// public async pullIncludedInOfferCatalogItemByCatalogItemId(params: {
|
|
720
|
+
// project: { id: string };
|
|
721
|
+
// $pull: {
|
|
722
|
+
// includedInOfferCatalogItem: {
|
|
723
|
+
// $elemMatch: {
|
|
724
|
+
// /**
|
|
725
|
+
// * サブカタログID
|
|
726
|
+
// */
|
|
727
|
+
// id: { $eq: string };
|
|
728
|
+
// };
|
|
729
|
+
// };
|
|
730
|
+
// };
|
|
731
|
+
// }) {
|
|
732
|
+
// await this.aggregateOfferModel.updateMany(
|
|
733
|
+
// {
|
|
734
|
+
// 'project.id': { $eq: params.project.id },
|
|
735
|
+
// 'offers.includedInOfferCatalogItem': {
|
|
736
|
+
// $elemMatch: {
|
|
737
|
+
// id: {
|
|
738
|
+
// $exists: true,
|
|
739
|
+
// $eq: params.$pull.includedInOfferCatalogItem.$elemMatch.id.$eq
|
|
740
|
+
// }
|
|
741
|
+
// }
|
|
742
|
+
// }
|
|
743
|
+
// },
|
|
744
|
+
// {
|
|
745
|
+
// $pull: {
|
|
746
|
+
// 'offers.$[].includedInOfferCatalogItem': {
|
|
747
|
+
// id: {
|
|
748
|
+
// $exists: true,
|
|
749
|
+
// $eq: params.$pull.includedInOfferCatalogItem.$elemMatch.id.$eq
|
|
750
|
+
// }
|
|
751
|
+
// }
|
|
752
|
+
// }
|
|
753
|
+
// }
|
|
754
|
+
// )
|
|
755
|
+
// .exec();
|
|
756
|
+
// }
|
|
672
757
|
deleteById(params) {
|
|
673
758
|
return __awaiter(this, void 0, void 0, function* () {
|
|
674
759
|
yield this.aggregateOfferModel.findOneAndRemove({
|
|
@@ -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>;
|
|
@@ -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.15"
|
|
121
121
|
}
|