@chevre/domain 21.9.0-alpha.3 → 21.9.0-alpha.4
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.
|
@@ -24,7 +24,8 @@ async function main() {
|
|
|
24
24
|
// id: { $in: ['xxx'] }
|
|
25
25
|
}
|
|
26
26
|
);
|
|
27
|
-
console.log(
|
|
27
|
+
console.log(catalogs[0]?.id, typeof catalogs[0]?.id);
|
|
28
|
+
console.log('catalogs found', catalogs.map((catalog) => `${catalog.id} ${catalog.identifier} ${catalog.numberOfItems} ${catalog.itemListElementTypeOf}`));
|
|
28
29
|
console.log(catalogs.length);
|
|
29
30
|
}
|
|
30
31
|
|
|
@@ -14,11 +14,11 @@ async function main() {
|
|
|
14
14
|
page: 1,
|
|
15
15
|
// ids: ['xx', 'xxx', '1001', '901'],
|
|
16
16
|
subOfferCatalog: {
|
|
17
|
-
id: '
|
|
18
|
-
isOfferCatalogItem:
|
|
17
|
+
id: 'xxx',
|
|
18
|
+
isOfferCatalogItem: true
|
|
19
19
|
},
|
|
20
20
|
excludeAppliesToMovieTicket: false,
|
|
21
|
-
useIncludeInDataCatalog:
|
|
21
|
+
useIncludeInDataCatalog: false
|
|
22
22
|
});
|
|
23
23
|
// console.log(offers);
|
|
24
24
|
console.log(offers.map((offer) => {
|
package/lib/chevre/repo/offer.js
CHANGED
|
@@ -21,6 +21,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
23
|
exports.MongoRepository = void 0;
|
|
24
|
+
const mongoose_1 = require("mongoose");
|
|
24
25
|
const uniqid = require("uniqid");
|
|
25
26
|
const factory = require("../factory");
|
|
26
27
|
const aggregateOffer_1 = require("./mongoose/schemas/aggregateOffer");
|
|
@@ -800,12 +801,12 @@ class MongoRepository {
|
|
|
800
801
|
*/
|
|
801
802
|
searchAggregateOfferIdsBySubOfferCatalog(params) {
|
|
802
803
|
return __awaiter(this, void 0, void 0, function* () {
|
|
803
|
-
const matchStages = [{ $match: { _id: { $eq: params.id } } }];
|
|
804
|
-
if (Array.isArray(params.itemListElementIds)) {
|
|
805
|
-
matchStages.push({ $match: { 'itemListElement.id': { $exists: true, $in: params.itemListElementIds } } });
|
|
806
|
-
}
|
|
807
804
|
let itemListElements;
|
|
808
805
|
if (params.isOfferCatalogItem) {
|
|
806
|
+
const matchStages = [{ $match: { _id: { $eq: new mongoose_1.Types.ObjectId(params.id) } } }]; // ObjectIdなので注意
|
|
807
|
+
if (Array.isArray(params.itemListElementIds)) {
|
|
808
|
+
matchStages.push({ $match: { 'itemListElement.id': { $exists: true, $in: params.itemListElementIds } } });
|
|
809
|
+
}
|
|
809
810
|
itemListElements = yield this.offerCatalogItemModel.aggregate([
|
|
810
811
|
{ $unwind: '$itemListElement' },
|
|
811
812
|
...matchStages,
|
|
@@ -819,6 +820,10 @@ class MongoRepository {
|
|
|
819
820
|
.exec();
|
|
820
821
|
}
|
|
821
822
|
else {
|
|
823
|
+
const matchStages = [{ $match: { _id: { $eq: params.id } } }];
|
|
824
|
+
if (Array.isArray(params.itemListElementIds)) {
|
|
825
|
+
matchStages.push({ $match: { 'itemListElement.id': { $exists: true, $in: params.itemListElementIds } } });
|
|
826
|
+
}
|
|
822
827
|
itemListElements = yield this.offerCatalogModel.aggregate([
|
|
823
828
|
{ $unwind: '$itemListElement' },
|
|
824
829
|
...matchStages,
|
|
@@ -138,7 +138,7 @@ class MongoRepository {
|
|
|
138
138
|
description: '$description',
|
|
139
139
|
project: '$project',
|
|
140
140
|
typeOf: '$typeOf',
|
|
141
|
-
id: '$_id',
|
|
141
|
+
id: { $toString: '$_id' },
|
|
142
142
|
identifier: '$identifier',
|
|
143
143
|
itemOffered: '$itemOffered',
|
|
144
144
|
additionalProperty: '$additionalProperty',
|
package/package.json
CHANGED