@chevre/domain 21.9.0-alpha.0 → 21.9.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/searchAvaialbleAppliesToMovieTicketByOfferCatalogId.ts +19 -1
- package/example/src/chevre/searchEventTicketOffers.ts +1 -0
- package/example/src/chevre/{searchOfferCatalogs.ts → searchOfferCatalogItems.ts} +15 -5
- package/example/src/chevre/searchOffersByCatalog.ts +9 -2
- package/lib/chevre/repo/aggregateOffer.d.ts +10 -3
- package/lib/chevre/repo/aggregateOffer.js +9 -0
- package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.d.ts +92 -0
- package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.js +55 -0
- package/lib/chevre/repo/offer.d.ts +8 -12
- package/lib/chevre/repo/offer.js +96 -56
- package/lib/chevre/repo/offerCatalog.d.ts +0 -4
- package/lib/chevre/repo/offerCatalog.js +0 -8
- package/lib/chevre/repo/offerCatalogItem.d.ts +47 -0
- package/lib/chevre/repo/offerCatalogItem.js +231 -0
- package/lib/chevre/repository.d.ts +3 -0
- package/lib/chevre/repository.js +5 -1
- package/lib/chevre/service/aggregation/event/findEventOffers.js +3 -1
- package/lib/chevre/service/assetTransaction/reserve.js +1 -0
- package/lib/chevre/service/offer/event/authorize.js +1 -0
- package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +30 -7
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +64 -3
- package/lib/chevre/service/offer/event.d.ts +2 -2
- package/lib/chevre/service/offer/event.js +2 -1
- package/lib/chevre/service/offer/product/searchProductOffers.js +5 -2
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +2 -0
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +23 -7
- package/lib/chevre/service/task/onResourceUpdated/syncOfferCatalog.d.ts +3 -0
- package/lib/chevre/service/task/onResourceUpdated/syncOfferCatalog.js +39 -24
- package/lib/chevre/service/task/onResourceUpdated.js +4 -1
- package/package.json +3 -3
|
@@ -42,11 +42,16 @@ function onResourceDeleted(params) {
|
|
|
42
42
|
ids: params.id
|
|
43
43
|
})(repos);
|
|
44
44
|
break;
|
|
45
|
-
case factory.offerType.
|
|
46
|
-
yield
|
|
45
|
+
case factory.offerType.AggregateOffer:
|
|
46
|
+
yield deleteResourcesByAggregateOffer({
|
|
47
47
|
project: { id: params.project.id },
|
|
48
48
|
ids: params.id
|
|
49
49
|
})(repos);
|
|
50
|
+
// case factory.offerType.Offer:
|
|
51
|
+
// await deleteResourcesByOffer({
|
|
52
|
+
// project: { id: params.project.id },
|
|
53
|
+
// ids: params.id
|
|
54
|
+
// })(repos);
|
|
50
55
|
break;
|
|
51
56
|
case 'OfferCatalog':
|
|
52
57
|
yield deleteResourcesByOfferCatalog({
|
|
@@ -57,7 +62,8 @@ function onResourceDeleted(params) {
|
|
|
57
62
|
project: { id: params.project.id },
|
|
58
63
|
ids: params.id,
|
|
59
64
|
typeOf: params.typeOf,
|
|
60
|
-
isDeleted: true
|
|
65
|
+
isDeleted: true,
|
|
66
|
+
isOfferCatalogItem: params.isOfferCatalogItem === true
|
|
61
67
|
})(repos);
|
|
62
68
|
break;
|
|
63
69
|
case factory.product.ProductType.EventService:
|
|
@@ -257,7 +263,7 @@ function deleteResourcesBySeller(params) {
|
|
|
257
263
|
}
|
|
258
264
|
});
|
|
259
265
|
}
|
|
260
|
-
function
|
|
266
|
+
function deleteResourcesByAggregateOffer(params) {
|
|
261
267
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
262
268
|
if (params.ids.length !== 1) {
|
|
263
269
|
throw new factory.errors.Argument('id', 'id.length must be 1');
|
|
@@ -265,7 +271,7 @@ function deleteResourcesByOffer(params) {
|
|
|
265
271
|
for (const offerId of params.ids) {
|
|
266
272
|
const deleteActionAttributes = {
|
|
267
273
|
agent: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
268
|
-
object: { id: offerId, typeOf: factory.offerType.
|
|
274
|
+
object: { id: offerId, typeOf: factory.offerType.AggregateOffer },
|
|
269
275
|
project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
270
276
|
typeOf: factory.actionType.DeleteAction
|
|
271
277
|
};
|
|
@@ -277,7 +283,12 @@ function deleteResourcesByOffer(params) {
|
|
|
277
283
|
project: { id: params.project.id },
|
|
278
284
|
$pull: { itemListElement: { $elemMatch: { id: { $in: [offerId] } } } }
|
|
279
285
|
});
|
|
280
|
-
|
|
286
|
+
// サブカタログ対応
|
|
287
|
+
const updateCatalogItemResult = yield repos.offerCatalogItem.pullItemListElement({
|
|
288
|
+
project: { id: params.project.id },
|
|
289
|
+
$pull: { itemListElement: { $elemMatch: { id: { $in: [offerId] } } } }
|
|
290
|
+
});
|
|
291
|
+
deleteResult = { updateCatalogResult, updateCatalogItemResult };
|
|
281
292
|
}
|
|
282
293
|
catch (error) {
|
|
283
294
|
try {
|
|
@@ -333,7 +344,12 @@ function deleteResourcesByOfferCatalog(params) {
|
|
|
333
344
|
project: { id: params.project.id },
|
|
334
345
|
hasOfferCatalog: { id: catalogId }
|
|
335
346
|
});
|
|
336
|
-
|
|
347
|
+
// カタログからpullItemListElement(サブカタログ対応)
|
|
348
|
+
const updateCatalogResult = yield repos.offerCatalog.pullItemListElement({
|
|
349
|
+
project: { id: params.project.id },
|
|
350
|
+
$pull: { itemListElement: { $elemMatch: { id: { $in: [catalogId] } } } }
|
|
351
|
+
});
|
|
352
|
+
deleteResult = { deleteEventResult, deleteProductResult, updateOfferResult, updateCatalogResult };
|
|
337
353
|
}
|
|
338
354
|
catch (error) {
|
|
339
355
|
try {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as factory from '../../../factory';
|
|
2
2
|
import { MongoRepository as AggregateOfferRepo } from '../../../repo/aggregateOffer';
|
|
3
3
|
import { MongoRepository as OfferCatalogRepo } from '../../../repo/offerCatalog';
|
|
4
|
+
import { MongoRepository as OfferCatalogItemRepo } from '../../../repo/offerCatalogItem';
|
|
4
5
|
/**
|
|
5
6
|
* カタログのitemListElementを集計オファーへ同期する
|
|
6
7
|
*/
|
|
@@ -11,7 +12,9 @@ export declare function syncOfferCatalog(params: {
|
|
|
11
12
|
ids: string[];
|
|
12
13
|
typeOf: factory.task.onResourceUpdated.OfferCatalogType;
|
|
13
14
|
isDeleted: boolean;
|
|
15
|
+
isOfferCatalogItem: boolean;
|
|
14
16
|
}): (repos: {
|
|
15
17
|
aggregateOffer: AggregateOfferRepo;
|
|
16
18
|
offerCatalog: OfferCatalogRepo;
|
|
19
|
+
offerCatalogItem: OfferCatalogItemRepo;
|
|
17
20
|
}) => Promise<void>;
|
|
@@ -19,38 +19,48 @@ function syncOfferCatalog(params) {
|
|
|
19
19
|
// if (params.ids.length !== 1) {
|
|
20
20
|
// throw new factory.errors.Argument('id', 'id.length must be 1');
|
|
21
21
|
// }
|
|
22
|
-
var _a
|
|
22
|
+
var _a;
|
|
23
23
|
if (params.isDeleted) {
|
|
24
24
|
for (const offerCatalogId of params.ids) {
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
break;
|
|
37
|
-
default:
|
|
38
|
-
// no op
|
|
39
|
-
}
|
|
25
|
+
// 検索しても存在しない
|
|
26
|
+
// const offerCatalogs = await repos.offerCatalog.search({ id: { $in: [offerCatalogId] } });
|
|
27
|
+
// カタログを含む全集計オファーからカタログを除外
|
|
28
|
+
yield repos.aggregateOffer.pullIncludedInDataCatalog({
|
|
29
|
+
project: { id: params.project.id },
|
|
30
|
+
$pull: {
|
|
31
|
+
includedInDataCatalog: { $elemMatch: { id: { $eq: offerCatalogId } } }
|
|
32
|
+
}
|
|
33
|
+
});
|
|
40
34
|
}
|
|
41
35
|
}
|
|
42
36
|
else {
|
|
43
37
|
for (const offerCatalogId of params.ids) {
|
|
44
|
-
|
|
45
|
-
|
|
38
|
+
let offerCatalogs = [];
|
|
39
|
+
if (params.isOfferCatalogItem) {
|
|
40
|
+
offerCatalogs = yield repos.offerCatalogItem.search({ id: { $in: [offerCatalogId] } });
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
offerCatalogs = yield repos.offerCatalog.search({ id: { $in: [offerCatalogId] } });
|
|
44
|
+
}
|
|
45
|
+
const itemListElementTypeOf = (_a = offerCatalogs.shift()) === null || _a === void 0 ? void 0 : _a.itemListElementTypeOf;
|
|
46
46
|
switch (itemListElementTypeOf) {
|
|
47
47
|
case factory.offerType.Offer:
|
|
48
48
|
// 集計オファーIDリストを検索
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
let aggregateOfferIds;
|
|
50
|
+
if (params.isOfferCatalogItem) {
|
|
51
|
+
const { itemListElement } = yield repos.offerCatalogItem.findItemListElementById({
|
|
52
|
+
id: offerCatalogId,
|
|
53
|
+
project: { id: params.project.id }
|
|
54
|
+
});
|
|
55
|
+
aggregateOfferIds = itemListElement.map((element) => element.id);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
const { itemListElement } = yield repos.offerCatalog.findItemListElementById({
|
|
59
|
+
id: offerCatalogId,
|
|
60
|
+
project: { id: params.project.id }
|
|
61
|
+
});
|
|
62
|
+
aggregateOfferIds = itemListElement.map((element) => element.id);
|
|
63
|
+
}
|
|
54
64
|
// カタログを含み、かつ、新しいカタログに含まれない集計オファーからカタログを除外
|
|
55
65
|
yield repos.aggregateOffer.pullIncludedInDataCatalog(Object.assign({ project: { id: params.project.id }, $pull: {
|
|
56
66
|
includedInDataCatalog: { $elemMatch: { id: { $eq: offerCatalogId } } }
|
|
@@ -66,7 +76,12 @@ function syncOfferCatalog(params) {
|
|
|
66
76
|
});
|
|
67
77
|
}
|
|
68
78
|
// 同期済記録を補完
|
|
69
|
-
|
|
79
|
+
if (params.isOfferCatalogItem) {
|
|
80
|
+
yield repos.offerCatalogItem.updateDateSynced({ id: offerCatalogId, dateSynced: new Date() });
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
yield repos.offerCatalog.updateDateSynced({ id: offerCatalogId, dateSynced: new Date() });
|
|
84
|
+
}
|
|
70
85
|
break;
|
|
71
86
|
default:
|
|
72
87
|
// no op
|
|
@@ -20,6 +20,7 @@ const event_1 = require("../../repo/event");
|
|
|
20
20
|
const member_1 = require("../../repo/member");
|
|
21
21
|
const offer_1 = require("../../repo/offer");
|
|
22
22
|
const offerCatalog_1 = require("../../repo/offerCatalog");
|
|
23
|
+
const offerCatalogItem_1 = require("../../repo/offerCatalogItem");
|
|
23
24
|
const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
|
|
24
25
|
const place_1 = require("../../repo/place");
|
|
25
26
|
const product_1 = require("../../repo/product");
|
|
@@ -44,6 +45,7 @@ function call(data) {
|
|
|
44
45
|
member: new member_1.MongoRepository(connectionSettings.connection),
|
|
45
46
|
offer: new offer_1.MongoRepository(connectionSettings.connection),
|
|
46
47
|
offerCatalog: new offerCatalog_1.MongoRepository(connectionSettings.connection),
|
|
48
|
+
offerCatalogItem: new offerCatalogItem_1.MongoRepository(connectionSettings.connection),
|
|
47
49
|
paymentServiceProvider: new paymentServiceProvider_1.MongoRepository(connectionSettings.connection),
|
|
48
50
|
place: new place_1.MongoRepository(connectionSettings.connection),
|
|
49
51
|
product: new product_1.MongoRepository(connectionSettings.connection),
|
|
@@ -116,7 +118,8 @@ function onResourceUpdated(params) {
|
|
|
116
118
|
project: { id: params.project.id },
|
|
117
119
|
ids: params.id,
|
|
118
120
|
typeOf: params.typeOf,
|
|
119
|
-
isDeleted: false
|
|
121
|
+
isDeleted: false,
|
|
122
|
+
isOfferCatalogItem: params.isOfferCatalogItem === true
|
|
120
123
|
})(repos);
|
|
121
124
|
break;
|
|
122
125
|
default:
|
package/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.
|
|
13
|
-
"@cinerino/sdk": "3.
|
|
12
|
+
"@chevre/factory": "4.330.0-alpha.2",
|
|
13
|
+
"@cinerino/sdk": "3.168.0",
|
|
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.10"
|
|
121
121
|
}
|