@chevre/domain 23.2.0-alpha.11 → 23.2.0-alpha.12

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.
@@ -152,6 +152,17 @@ export declare class SeatRepo {
152
152
  };
153
153
  };
154
154
  }): Promise<string[]>;
155
+ /**
156
+ * コードをキーにして冪等削除
157
+ */
158
+ deleteSeatsByBranchCode(params: {
159
+ /**
160
+ * 座席コード
161
+ */
162
+ branchCode: string;
163
+ }[], options: IUpdateOptions): Promise<{
164
+ bulkWriteResult: BulkWriteResult;
165
+ } | void>;
155
166
  deleteSeatByBranchCode(seat: {
156
167
  /**
157
168
  * 座席コード
@@ -680,6 +680,41 @@ class SeatRepo {
680
680
  return (result !== undefined) ? result.seatingTypes : [];
681
681
  });
682
682
  }
683
+ /**
684
+ * コードをキーにして冪等削除
685
+ */
686
+ deleteSeatsByBranchCode(params, options) {
687
+ return __awaiter(this, void 0, void 0, function* () {
688
+ const { project, parentOrganization, movieTheaterCode, roomCode, sectionCode } = options;
689
+ const bulkWriteOps = [];
690
+ if (Array.isArray(params)) {
691
+ params.forEach(({ branchCode }) => {
692
+ // 座席の存在するドキュメントでフィルター
693
+ const filter = Object.assign({ typeOf: { $eq: factory.placeType.ScreeningRoom }, 'project.id': { $eq: project.id }, 'containedInPlace.branchCode': { $exists: true, $eq: movieTheaterCode }, branchCode: { $eq: roomCode }, 'containsPlace.branchCode': { $eq: sectionCode }, 'containsPlace.containsPlace.branchCode': { $eq: branchCode } }, (typeof (parentOrganization === null || parentOrganization === void 0 ? void 0 : parentOrganization.id) === 'string')
694
+ ? { 'parentOrganization.id': { $exists: true, $eq: parentOrganization.id } }
695
+ : undefined);
696
+ const updateFilter = {
697
+ $pull: {
698
+ 'containsPlace.$[screeningRoomSection].containsPlace': { branchCode }
699
+ }
700
+ };
701
+ const arrayFilters = [
702
+ { 'screeningRoomSection.branchCode': { $eq: sectionCode } }
703
+ ];
704
+ const updateOne = {
705
+ filter,
706
+ update: updateFilter,
707
+ arrayFilters
708
+ };
709
+ bulkWriteOps.push({ updateOne });
710
+ });
711
+ }
712
+ if (bulkWriteOps.length > 0) {
713
+ const bulkWriteResult = yield this.placeModel.bulkWrite(bulkWriteOps, { ordered: false });
714
+ return { bulkWriteResult };
715
+ }
716
+ });
717
+ }
683
718
  deleteSeatByBranchCode(seat, options) {
684
719
  return __awaiter(this, void 0, void 0, function* () {
685
720
  const { project, parentOrganization, movieTheaterCode, roomCode, sectionCode } = options;
package/package.json CHANGED
@@ -115,5 +115,5 @@
115
115
  "postversion": "git push origin --tags",
116
116
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
117
117
  },
118
- "version": "23.2.0-alpha.11"
118
+ "version": "23.2.0-alpha.12"
119
119
  }