@chevre/domain 21.9.0-alpha.3 → 21.9.0-alpha.5

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('catalogs found', catalogs.map((catalog) => `${catalog.identifier} ${catalog.numberOfItems} ${catalog.itemListElementTypeOf}`));
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: '0001',
18
- isOfferCatalogItem: false
17
+ id: 'xxx',
18
+ isOfferCatalogItem: true
19
19
  },
20
20
  excludeAppliesToMovieTicket: false,
21
- useIncludeInDataCatalog: true
21
+ useIncludeInDataCatalog: false
22
22
  });
23
23
  // console.log(offers);
24
24
  console.log(offers.map((offer) => {
@@ -61,6 +61,7 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
61
61
  description?: any;
62
62
  itemOffered?: any;
63
63
  dateSynced?: Date | undefined;
64
+ relatedOffer?: any;
64
65
  }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
65
66
  typeOf: string;
66
67
  additionalProperty: any[];
@@ -72,6 +73,7 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
72
73
  description?: any;
73
74
  itemOffered?: any;
74
75
  dateSynced?: Date | undefined;
76
+ relatedOffer?: any;
75
77
  }>> & Omit<import("mongoose").FlatRecord<{
76
78
  typeOf: string;
77
79
  additionalProperty: any[];
@@ -83,6 +85,7 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
83
85
  description?: any;
84
86
  itemOffered?: any;
85
87
  dateSynced?: Date | undefined;
88
+ relatedOffer?: any;
86
89
  }> & {
87
90
  _id: import("mongoose").Types.ObjectId;
88
91
  }, never>>;
@@ -10,7 +10,6 @@ exports.modelName = modelName;
10
10
  */
11
11
  const schema = new mongoose_1.Schema({
12
12
  project: mongoose_1.SchemaTypes.Mixed,
13
- // _id: String,
14
13
  identifier: {
15
14
  type: String,
16
15
  required: true
@@ -25,7 +24,8 @@ const schema = new mongoose_1.Schema({
25
24
  itemListElement: [mongoose_1.SchemaTypes.Mixed],
26
25
  itemOffered: mongoose_1.SchemaTypes.Mixed,
27
26
  additionalProperty: [mongoose_1.SchemaTypes.Mixed],
28
- dateSynced: Date
27
+ dateSynced: Date,
28
+ relatedOffer: mongoose_1.SchemaTypes.Mixed
29
29
  }, {
30
30
  collection: 'offerCatalogItems',
31
31
  id: true,
@@ -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,10 +138,11 @@ 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',
145
+ relatedOffer: '$relatedOffer',
145
146
  numberOfItems: {
146
147
  $cond: {
147
148
  if: { $isArray: '$itemListElement' },
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.329.0",
12
+ "@chevre/factory": "4.330.0-alpha.0",
13
13
  "@cinerino/sdk": "3.167.0-alpha.9",
14
14
  "@motionpicture/coa-service": "9.2.0",
15
15
  "@motionpicture/gmo-service": "5.2.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.3"
120
+ "version": "21.9.0-alpha.5"
121
121
  }