@chevre/domain 21.9.0-alpha.12 → 21.9.0-alpha.13

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.
@@ -126,6 +126,12 @@ export declare class MongoRepository {
126
126
  $pull: {
127
127
  includedInOfferCatalogItem: {
128
128
  $elemMatch: {
129
+ /**
130
+ * サブカタログID除外リスト
131
+ */
132
+ id?: {
133
+ $nin: string[];
134
+ };
129
135
  includedInDataCatalog: {
130
136
  /**
131
137
  * カタログID
@@ -615,7 +615,9 @@ class MongoRepository {
615
615
  * カタログに属するサブカタログを全て除外する
616
616
  */
617
617
  pullIncludedInOfferCatalogItemByCatalogId(params) {
618
+ var _a;
618
619
  return __awaiter(this, void 0, void 0, function* () {
620
+ const offerCatalogItemIdNin = (_a = params.$pull.includedInOfferCatalogItem.$elemMatch.id) === null || _a === void 0 ? void 0 : _a.$nin;
619
621
  yield this.aggregateOfferModel.updateMany({
620
622
  'project.id': { $eq: params.project.id },
621
623
  'offers.includedInOfferCatalogItem': {
@@ -628,12 +630,12 @@ class MongoRepository {
628
630
  }
629
631
  }, {
630
632
  $pull: {
631
- 'offers.$[].includedInOfferCatalogItem': {
632
- 'includedInDataCatalog.id': {
633
+ 'offers.$[].includedInOfferCatalogItem': Object.assign({ 'includedInDataCatalog.id': {
633
634
  $exists: true,
634
635
  $eq: params.$pull.includedInOfferCatalogItem.$elemMatch.includedInDataCatalog.id.$eq
635
- }
636
- }
636
+ } }, (Array.isArray(offerCatalogItemIdNin))
637
+ ? { id: { $nin: offerCatalogItemIdNin } } // // 指定サブカタログを除外する
638
+ : undefined)
637
639
  }
638
640
  })
639
641
  .exec();
@@ -139,6 +139,18 @@ function syncOfferCatalog2offer(params) {
139
139
  offerCatalogItemIds = itemListElement.map((element) => element.id);
140
140
  // サブカタログごとに同期
141
141
  if (offerCatalogItemIds.length > 0) {
142
+ // カタログに含まれるがサブカタログに含まれないものを除外
143
+ yield repos.aggregateOffer.pullIncludedInOfferCatalogItemByCatalogId({
144
+ project: { id: params.project.id },
145
+ $pull: {
146
+ includedInOfferCatalogItem: {
147
+ $elemMatch: {
148
+ id: { $nin: offerCatalogItemIds },
149
+ includedInDataCatalog: { id: { $eq: params.id } }
150
+ }
151
+ }
152
+ }
153
+ });
142
154
  for (const offerCatalogItemId of offerCatalogItemIds) {
143
155
  yield syncSubCatalogs2offer({
144
156
  id: offerCatalogItemId,
package/package.json CHANGED
@@ -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.12"
120
+ "version": "21.9.0-alpha.13"
121
121
  }