@chevre/domain 21.2.0-alpha.98 → 21.2.0

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.
Files changed (171) hide show
  1. package/example/src/chevre/aggregateEventReservation.ts +1 -1
  2. package/example/src/chevre/aggregateSellerPaymentAccepted.ts +27 -0
  3. package/example/src/chevre/aggregation/aggregateSystem.ts +53 -22
  4. package/example/src/chevre/countDelayedTasks.ts +7 -2
  5. package/example/src/chevre/createManyEventsIfNotExist.ts +199 -46
  6. package/example/src/chevre/findScreeningRoomsByBranchCode.ts +4 -3
  7. package/example/src/chevre/giveUpStartDatePassedCertainPeriod.ts +56 -0
  8. package/example/src/chevre/lockStockHolder.ts +5 -2
  9. package/example/src/chevre/migrateCategoryCodeAdditionalProperties.ts +116 -0
  10. package/example/src/chevre/migrateScreeningEventSeriesVersion.ts +79 -0
  11. package/example/src/chevre/processPay.ts +5 -2
  12. package/example/src/chevre/processRegisterMembership.ts +8 -4
  13. package/example/src/chevre/processRegisterPaymentCard.ts +8 -4
  14. package/example/src/chevre/processReserve.ts +1 -1
  15. package/example/src/chevre/searchAbortedTasks.ts +4 -6
  16. package/example/src/chevre/searchActions.ts +33 -0
  17. package/example/src/chevre/searchEventSeats.ts +5 -2
  18. package/example/src/chevre/searchHoldReservations.ts +38 -0
  19. package/example/src/chevre/searchPermissions.ts +54 -0
  20. package/example/src/chevre/searchScreeningRooms.ts +35 -0
  21. package/example/src/chevre/sendEmailMessage.ts +1 -2
  22. package/example/src/chevre/syncScreeningRooms.ts +22 -0
  23. package/example/src/chevre/syncScreeningRoomsAll.ts +44 -0
  24. package/example/src/chevre/unsetContainsInPlaceFromMovieTheater.ts +41 -0
  25. package/lib/chevre/factory/order.d.ts +4 -1
  26. package/lib/chevre/factory/order.js +19 -6
  27. package/lib/chevre/repo/account.js +3 -2
  28. package/lib/chevre/repo/accountTransaction.js +2 -1
  29. package/lib/chevre/repo/accountingReport.d.ts +1 -3
  30. package/lib/chevre/repo/action.d.ts +50 -1
  31. package/lib/chevre/repo/action.js +103 -34
  32. package/lib/chevre/repo/additionalProperty.js +2 -1
  33. package/lib/chevre/repo/aggregation.d.ts +3 -0
  34. package/lib/chevre/repo/aggregation.js +3 -0
  35. package/lib/chevre/repo/assetTransaction.js +6 -5
  36. package/lib/chevre/repo/categoryCode.d.ts +1 -1
  37. package/lib/chevre/repo/categoryCode.js +37 -25
  38. package/lib/chevre/repo/code.js +3 -2
  39. package/lib/chevre/repo/comment.js +2 -1
  40. package/lib/chevre/repo/creativeWork.d.ts +1 -1
  41. package/lib/chevre/repo/creativeWork.js +35 -12
  42. package/lib/chevre/repo/customer.js +2 -1
  43. package/lib/chevre/repo/emailMessage.js +2 -1
  44. package/lib/chevre/repo/event.d.ts +30 -2
  45. package/lib/chevre/repo/event.js +87 -36
  46. package/lib/chevre/repo/member.d.ts +14 -0
  47. package/lib/chevre/repo/member.js +31 -3
  48. package/lib/chevre/repo/merchantReturnPolicy.js +2 -1
  49. package/lib/chevre/repo/mongoose/schemas/action.js +12 -0
  50. package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +3 -3
  51. package/lib/chevre/repo/mongoose/schemas/holdReservation.d.ts +75 -0
  52. package/lib/chevre/repo/mongoose/schemas/holdReservation.js +93 -0
  53. package/lib/chevre/repo/mongoose/schemas/offer.d.ts +3 -3
  54. package/lib/chevre/repo/mongoose/schemas/order.d.ts +21 -21
  55. package/lib/chevre/repo/mongoose/schemas/place.d.ts +6 -0
  56. package/lib/chevre/repo/mongoose/schemas/place.js +16 -1
  57. package/lib/chevre/repo/mongoose/schemas/product.js +6 -0
  58. package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +9 -9
  59. package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +3 -3
  60. package/lib/chevre/repo/offer.js +3 -2
  61. package/lib/chevre/repo/offerCatalog.js +0 -27
  62. package/lib/chevre/repo/offerItemCondition.js +2 -1
  63. package/lib/chevre/repo/order.js +8 -7
  64. package/lib/chevre/repo/ownershipInfo.js +2 -7
  65. package/lib/chevre/repo/paymentServiceProvider.d.ts +65 -0
  66. package/lib/chevre/repo/paymentServiceProvider.js +156 -0
  67. package/lib/chevre/repo/place.d.ts +203 -27
  68. package/lib/chevre/repo/place.js +1726 -694
  69. package/lib/chevre/repo/priceSpecification.js +3 -2
  70. package/lib/chevre/repo/product.d.ts +5 -3
  71. package/lib/chevre/repo/product.js +92 -5
  72. package/lib/chevre/repo/project.js +2 -1
  73. package/lib/chevre/repo/reservation.d.ts +9 -1
  74. package/lib/chevre/repo/reservation.js +29 -20
  75. package/lib/chevre/repo/role.d.ts +7 -0
  76. package/lib/chevre/repo/role.js +39 -2
  77. package/lib/chevre/repo/seller.d.ts +21 -1
  78. package/lib/chevre/repo/seller.js +59 -4
  79. package/lib/chevre/repo/serviceOutput.js +2 -1
  80. package/lib/chevre/repo/stockHolder.d.ts +143 -7
  81. package/lib/chevre/repo/stockHolder.js +622 -104
  82. package/lib/chevre/repo/task.d.ts +12 -1
  83. package/lib/chevre/repo/task.js +17 -7
  84. package/lib/chevre/repo/transaction.js +6 -5
  85. package/lib/chevre/repo/trip.js +2 -1
  86. package/lib/chevre/repository.d.ts +6 -0
  87. package/lib/chevre/repository.js +8 -1
  88. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +18 -8
  89. package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +19 -8
  90. package/lib/chevre/service/aggregation/system.d.ts +43 -1
  91. package/lib/chevre/service/aggregation/system.js +112 -2
  92. package/lib/chevre/service/assetTransaction/moneyTransfer.js +1 -1
  93. package/lib/chevre/service/assetTransaction/pay/account/validation.js +1 -1
  94. package/lib/chevre/service/assetTransaction/pay.d.ts +5 -1
  95. package/lib/chevre/service/assetTransaction/pay.js +7 -7
  96. package/lib/chevre/service/assetTransaction/refund.js +1 -1
  97. package/lib/chevre/service/assetTransaction/reserve.js +10 -3
  98. package/lib/chevre/service/event.d.ts +3 -0
  99. package/lib/chevre/service/event.js +52 -21
  100. package/lib/chevre/service/iam.d.ts +6 -2
  101. package/lib/chevre/service/iam.js +23 -9
  102. package/lib/chevre/service/offer/event/factory.js +22 -13
  103. package/lib/chevre/service/offer/event/importFromCOA.js +2 -2
  104. package/lib/chevre/service/offer/eventServiceByCOA/factory.js +15 -8
  105. package/lib/chevre/service/offer/eventServiceByCOA.js +7 -9
  106. package/lib/chevre/service/offer/product/factory.js +13 -6
  107. package/lib/chevre/service/offer/product.js +2 -2
  108. package/lib/chevre/service/offer.d.ts +16 -8
  109. package/lib/chevre/service/offer.js +71 -8
  110. package/lib/chevre/service/order/createAccountingReportIfNotExist.js +31 -17
  111. package/lib/chevre/service/order/onOrderStatusChanged/factory.js +1 -1
  112. package/lib/chevre/service/order/onOrderStatusChanged.js +2 -2
  113. package/lib/chevre/service/order/placeOrder.js +4 -4
  114. package/lib/chevre/service/order/returnOrder.js +1 -1
  115. package/lib/chevre/service/order/sendOrder.js +3 -3
  116. package/lib/chevre/service/payment/any/onPaymentStatusChanged.js +4 -6
  117. package/lib/chevre/service/payment/any/onRefund.js +46 -42
  118. package/lib/chevre/service/payment/any.d.ts +9 -6
  119. package/lib/chevre/service/payment/any.js +6 -2
  120. package/lib/chevre/service/payment/creditCard.js +2 -2
  121. package/lib/chevre/service/payment/movieTicket/checkByIdentifier.d.ts +8 -7
  122. package/lib/chevre/service/payment/movieTicket/factory.d.ts +1 -1
  123. package/lib/chevre/service/payment/movieTicket/getCredentials.d.ts +1 -1
  124. package/lib/chevre/service/payment/movieTicket/getCredentials.js +1 -1
  125. package/lib/chevre/service/payment/movieTicket/validation.d.ts +3 -4
  126. package/lib/chevre/service/payment/movieTicket/validation.js +53 -12
  127. package/lib/chevre/service/payment/movieTicket.d.ts +1 -1
  128. package/lib/chevre/service/payment/movieTicket.js +4 -4
  129. package/lib/chevre/service/reserve/cancelReservation.js +15 -3
  130. package/lib/chevre/service/reserve/confirmReservation.js +19 -11
  131. package/lib/chevre/service/task/aggregateScreeningEvent.js +1 -1
  132. package/lib/chevre/service/task/cancelPendingReservation.js +1 -1
  133. package/lib/chevre/service/task/cancelReservation.js +1 -1
  134. package/lib/chevre/service/task/deleteTransaction.js +2 -0
  135. package/lib/chevre/service/task/onEventChanged.d.ts +7 -0
  136. package/lib/chevre/service/task/onEventChanged.js +29 -0
  137. package/lib/chevre/service/task/onResourceUpdated.d.ts +7 -0
  138. package/lib/chevre/service/task/onResourceUpdated.js +396 -0
  139. package/lib/chevre/service/task/syncScreeningRooms.d.ts +7 -0
  140. package/lib/chevre/service/task/syncScreeningRooms.js +24 -0
  141. package/lib/chevre/service/task/voidReserveTransaction.js +1 -1
  142. package/lib/chevre/service/transaction/deleteTransaction.d.ts +2 -0
  143. package/lib/chevre/service/transaction/deleteTransaction.js +129 -1
  144. package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.js +1 -0
  145. package/lib/chevre/service/transaction/moneyTransfer/factory.d.ts +1 -1
  146. package/lib/chevre/service/transaction/moneyTransfer.js +1 -1
  147. package/lib/chevre/service/transaction/orderProgramMembership/findCreditCard.js +1 -1
  148. package/lib/chevre/service/transaction/orderProgramMembership/findPaymentCardPermit.js +1 -1
  149. package/lib/chevre/service/transaction/orderProgramMembership.js +7 -4
  150. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +1 -0
  151. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/givePointAward.js +1 -1
  152. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +1 -1
  153. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +1 -1
  154. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/sendEmailMessage.js +4 -4
  155. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.js +3 -4
  156. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +8 -12
  157. package/lib/chevre/service/transaction/placeOrderInProgress.js +6 -4
  158. package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +1 -0
  159. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.js +2 -2
  160. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +5 -5
  161. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.js +2 -2
  162. package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +3 -3
  163. package/lib/chevre/service/transaction/returnOrder/potentialActions.js +1 -1
  164. package/lib/chevre/service/transaction/returnOrder.js +3 -1
  165. package/lib/chevre/settings.d.ts +11 -0
  166. package/lib/chevre/settings.js +44 -2
  167. package/package.json +3 -3
  168. package/example/src/chevre/eventCatalog2eventService.ts +0 -123
  169. package/example/src/chevre/migrateOrderAdditionalProperties.ts +0 -85
  170. package/example/src/chevre/migrateStockHolderKeys.ts +0 -89
  171. package/example/src/chevre/searchAssetTransactions.ts +0 -30
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.MongoRepository = void 0;
24
24
  const categoryCode_1 = require("./mongoose/schemas/categoryCode");
25
25
  const factory = require("../factory");
26
+ const settings_1 = require("../settings");
26
27
  /**
27
28
  * 区分リポジトリ
28
29
  */
@@ -32,7 +33,7 @@ class MongoRepository {
32
33
  }
33
34
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
34
35
  static CREATE_MONGO_CONDITIONS(params) {
35
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
36
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
36
37
  // MongoDB検索条件
37
38
  const andConditions = [];
38
39
  // tslint:disable-next-line:no-single-line-block-comment
@@ -48,16 +49,13 @@ class MongoRepository {
48
49
  }
49
50
  }
50
51
  }
51
- // tslint:disable-next-line:no-single-line-block-comment
52
- /* istanbul ignore else */
53
- if (params.id !== undefined && params.id !== null) {
54
- if (typeof params.id.$eq === 'string') {
55
- andConditions.push({
56
- _id: {
57
- $eq: params.id.$eq
58
- }
59
- });
60
- }
52
+ const idEq = (_a = params.id) === null || _a === void 0 ? void 0 : _a.$eq;
53
+ if (typeof idEq === 'string') {
54
+ andConditions.push({ _id: { $eq: idEq } });
55
+ }
56
+ const idIn = (_b = params.id) === null || _b === void 0 ? void 0 : _b.$in;
57
+ if (Array.isArray(idIn)) {
58
+ andConditions.push({ _id: { $in: idIn } });
61
59
  }
62
60
  // tslint:disable-next-line:no-single-line-block-comment
63
61
  /* istanbul ignore else */
@@ -81,7 +79,7 @@ class MongoRepository {
81
79
  });
82
80
  }
83
81
  }
84
- const codeValueEq = (_a = params.codeValue) === null || _a === void 0 ? void 0 : _a.$eq;
82
+ const codeValueEq = (_c = params.codeValue) === null || _c === void 0 ? void 0 : _c.$eq;
85
83
  if (typeof codeValueEq === 'string') {
86
84
  andConditions.push({
87
85
  codeValue: {
@@ -90,7 +88,7 @@ class MongoRepository {
90
88
  }
91
89
  });
92
90
  }
93
- const codeValueIn = (_b = params.codeValue) === null || _b === void 0 ? void 0 : _b.$in;
91
+ const codeValueIn = (_d = params.codeValue) === null || _d === void 0 ? void 0 : _d.$in;
94
92
  if (Array.isArray(codeValueIn)) {
95
93
  andConditions.push({
96
94
  codeValue: {
@@ -113,7 +111,7 @@ class MongoRepository {
113
111
  }
114
112
  }
115
113
  }
116
- const inCodeSetIdentifierIn = (_d = (_c = params.inCodeSet) === null || _c === void 0 ? void 0 : _c.identifier) === null || _d === void 0 ? void 0 : _d.$in;
114
+ const inCodeSetIdentifierIn = (_f = (_e = params.inCodeSet) === null || _e === void 0 ? void 0 : _e.identifier) === null || _f === void 0 ? void 0 : _f.$in;
117
115
  if (Array.isArray(inCodeSetIdentifierIn)) {
118
116
  andConditions.push({
119
117
  'inCodeSet.identifier': {
@@ -122,7 +120,7 @@ class MongoRepository {
122
120
  }
123
121
  });
124
122
  }
125
- const paymentMethodTypeOfEq = (_f = (_e = params.paymentMethod) === null || _e === void 0 ? void 0 : _e.typeOf) === null || _f === void 0 ? void 0 : _f.$eq;
123
+ const paymentMethodTypeOfEq = (_h = (_g = params.paymentMethod) === null || _g === void 0 ? void 0 : _g.typeOf) === null || _h === void 0 ? void 0 : _h.$eq;
126
124
  if (typeof paymentMethodTypeOfEq === 'string') {
127
125
  andConditions.push({
128
126
  'paymentMethod.typeOf': {
@@ -131,7 +129,7 @@ class MongoRepository {
131
129
  }
132
130
  });
133
131
  }
134
- const paymentMethodTypeOfIn = (_h = (_g = params.paymentMethod) === null || _g === void 0 ? void 0 : _g.typeOf) === null || _h === void 0 ? void 0 : _h.$in;
132
+ const paymentMethodTypeOfIn = (_k = (_j = params.paymentMethod) === null || _j === void 0 ? void 0 : _j.typeOf) === null || _k === void 0 ? void 0 : _k.$in;
135
133
  if (Array.isArray(paymentMethodTypeOfIn)) {
136
134
  andConditions.push({
137
135
  'paymentMethod.typeOf': {
@@ -140,7 +138,7 @@ class MongoRepository {
140
138
  }
141
139
  });
142
140
  }
143
- const additionalPropertyElemMatch = (_j = params.additionalProperty) === null || _j === void 0 ? void 0 : _j.$elemMatch;
141
+ const additionalPropertyElemMatch = (_l = params.additionalProperty) === null || _l === void 0 ? void 0 : _l.$elemMatch;
144
142
  if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
145
143
  andConditions.push({
146
144
  additionalProperty: {
@@ -155,21 +153,35 @@ class MongoRepository {
155
153
  return __awaiter(this, void 0, void 0, function* () {
156
154
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
157
155
  return this.categoryCodeModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
158
- .setOptions({ maxTimeMS: 10000 })
156
+ .setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
159
157
  .exec();
160
158
  });
161
159
  }
162
160
  /**
163
161
  * 検索
164
162
  */
165
- search(params) {
163
+ search(params, inclusion, exclusion) {
166
164
  return __awaiter(this, void 0, void 0, function* () {
167
165
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
168
- const query = this.categoryCodeModel.find((conditions.length > 0) ? { $and: conditions } : {}, {
169
- __v: 0,
170
- createdAt: 0,
171
- updatedAt: 0
172
- });
166
+ let projection = {};
167
+ if (Array.isArray(inclusion) && inclusion.length > 0) {
168
+ inclusion.forEach((field) => {
169
+ projection[field] = 1;
170
+ });
171
+ }
172
+ else {
173
+ projection = {
174
+ __v: 0,
175
+ createdAt: 0,
176
+ updatedAt: 0
177
+ };
178
+ if (Array.isArray(exclusion) && exclusion.length > 0) {
179
+ exclusion.forEach((field) => {
180
+ projection[field] = 0;
181
+ });
182
+ }
183
+ }
184
+ const query = this.categoryCodeModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
173
185
  if (typeof params.limit === 'number' && params.limit > 0) {
174
186
  const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
175
187
  query.limit(params.limit)
@@ -180,7 +192,7 @@ class MongoRepository {
180
192
  if (params.sort !== undefined) {
181
193
  query.sort(params.sort);
182
194
  }
183
- return query.setOptions({ maxTimeMS: 10000 })
195
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
184
196
  .exec()
185
197
  .then((docs) => docs.map((doc) => doc.toObject()));
186
198
  });
@@ -15,6 +15,7 @@ const uuid = require("uuid");
15
15
  const factory = require("../factory");
16
16
  const authorization_1 = require("./mongoose/schemas/authorization");
17
17
  Object.defineProperty(exports, "modelName", { enumerable: true, get: function () { return authorization_1.modelName; } });
18
+ const settings_1 = require("../settings");
18
19
  /**
19
20
  * 承認コードリポジトリ
20
21
  */
@@ -177,7 +178,7 @@ class MongoRepository {
177
178
  return __awaiter(this, void 0, void 0, function* () {
178
179
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
179
180
  return this.authorizationModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
180
- .setOptions({ maxTimeMS: 10000 })
181
+ .setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
181
182
  .exec();
182
183
  });
183
184
  }
@@ -200,7 +201,7 @@ class MongoRepository {
200
201
  if (((_a = params.sort) === null || _a === void 0 ? void 0 : _a.validFrom) !== undefined) {
201
202
  query.sort({ validFrom: params.sort.validFrom });
202
203
  }
203
- return query.setOptions({ maxTimeMS: 10000 })
204
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
204
205
  .exec()
205
206
  .then((docs) => docs.map((doc) => doc.toObject()));
206
207
  });
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.MongoRepository = void 0;
13
13
  const comments_1 = require("./mongoose/schemas/comments");
14
14
  const factory = require("../factory");
15
+ const settings_1 = require("../settings");
15
16
  /**
16
17
  * コメントリポジトリ
17
18
  */
@@ -73,7 +74,7 @@ class MongoRepository {
73
74
  if (((_a = params.sort) === null || _a === void 0 ? void 0 : _a.dateCreated) !== undefined) {
74
75
  query.sort({ dateCreated: params.sort.dateCreated });
75
76
  }
76
- return query.setOptions({ maxTimeMS: 10000 })
77
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
77
78
  .exec()
78
79
  .then((docs) => docs.map((doc) => doc.toObject()));
79
80
  });
@@ -42,7 +42,7 @@ export declare class MongoRepository {
42
42
  /**
43
43
  * コンテンツを検索する
44
44
  */
45
- searchMovies(params: factory.creativeWork.movie.ISearchConditions): Promise<factory.creativeWork.movie.ICreativeWork[]>;
45
+ searchMovies(params: factory.creativeWork.movie.ISearchConditions, inclusion: string[], exclusion: string[]): Promise<factory.creativeWork.movie.ICreativeWork[]>;
46
46
  /**
47
47
  * コンテンツを削除する
48
48
  */
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.MongoRepository = void 0;
24
24
  const creativeWork_1 = require("./mongoose/schemas/creativeWork");
25
25
  const factory = require("../factory");
26
+ const settings_1 = require("../settings");
26
27
  /**
27
28
  * コンテンツリポジトリ
28
29
  */
@@ -32,7 +33,7 @@ class MongoRepository {
32
33
  }
33
34
  // tslint:disable-next-line:max-func-body-length
34
35
  static CREATE_MONGO_CONDITIONS(params) {
35
- var _a, _b, _c, _d, _e, _f, _g, _h;
36
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
36
37
  // MongoDB検索条件
37
38
  const andConditions = [
38
39
  {
@@ -65,6 +66,14 @@ class MongoRepository {
65
66
  }
66
67
  });
67
68
  }
69
+ const idEq = (_f = params.id) === null || _f === void 0 ? void 0 : _f.$eq;
70
+ if (typeof idEq === 'string') {
71
+ andConditions.push({ _id: { $eq: idEq } });
72
+ }
73
+ const idIn = (_g = params.id) === null || _g === void 0 ? void 0 : _g.$in;
74
+ if (Array.isArray(idIn)) {
75
+ andConditions.push({ _id: { $in: idIn } });
76
+ }
68
77
  if (typeof params.identifier === 'string') {
69
78
  if (params.identifier.length > 0) {
70
79
  andConditions.push({
@@ -73,13 +82,13 @@ class MongoRepository {
73
82
  }
74
83
  }
75
84
  else {
76
- const identifierEq = (_f = params.identifier) === null || _f === void 0 ? void 0 : _f.$eq;
85
+ const identifierEq = (_h = params.identifier) === null || _h === void 0 ? void 0 : _h.$eq;
77
86
  if (typeof identifierEq === 'string') {
78
87
  andConditions.push({
79
88
  identifier: { $eq: identifierEq }
80
89
  });
81
90
  }
82
- const identifierIn = (_g = params.identifier) === null || _g === void 0 ? void 0 : _g.$in;
91
+ const identifierIn = (_j = params.identifier) === null || _j === void 0 ? void 0 : _j.$in;
83
92
  if (Array.isArray(identifierIn)) {
84
93
  andConditions.push({
85
94
  identifier: { $in: identifierIn }
@@ -155,7 +164,7 @@ class MongoRepository {
155
164
  });
156
165
  }
157
166
  }
158
- const additionalPropertyElemMatch = (_h = params.additionalProperty) === null || _h === void 0 ? void 0 : _h.$elemMatch;
167
+ const additionalPropertyElemMatch = (_k = params.additionalProperty) === null || _k === void 0 ? void 0 : _k.$elemMatch;
159
168
  if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
160
169
  andConditions.push({
161
170
  additionalProperty: {
@@ -205,22 +214,36 @@ class MongoRepository {
205
214
  return __awaiter(this, void 0, void 0, function* () {
206
215
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
207
216
  return this.creativeWorkModel.countDocuments({ $and: conditions })
208
- .setOptions({ maxTimeMS: 10000 })
217
+ .setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
209
218
  .exec();
210
219
  });
211
220
  }
212
221
  /**
213
222
  * コンテンツを検索する
214
223
  */
215
- searchMovies(params) {
224
+ searchMovies(params, inclusion, exclusion) {
216
225
  var _a;
217
226
  return __awaiter(this, void 0, void 0, function* () {
218
227
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
219
- const query = this.creativeWorkModel.find({ $and: conditions }, {
220
- __v: 0,
221
- createdAt: 0,
222
- updatedAt: 0
223
- });
228
+ let projection = {};
229
+ if (Array.isArray(inclusion) && inclusion.length > 0) {
230
+ inclusion.forEach((field) => {
231
+ projection[field] = 1;
232
+ });
233
+ }
234
+ else {
235
+ projection = {
236
+ __v: 0,
237
+ createdAt: 0,
238
+ updatedAt: 0
239
+ };
240
+ if (Array.isArray(exclusion) && exclusion.length > 0) {
241
+ exclusion.forEach((field) => {
242
+ projection[field] = 0;
243
+ });
244
+ }
245
+ }
246
+ const query = this.creativeWorkModel.find({ $and: conditions }, projection);
224
247
  if (typeof params.limit === 'number' && params.limit > 0) {
225
248
  const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
226
249
  query.limit(params.limit)
@@ -231,7 +254,7 @@ class MongoRepository {
231
254
  if (((_a = params.sort) === null || _a === void 0 ? void 0 : _a.identifier) !== undefined) {
232
255
  query.sort({ identifier: params.sort.identifier });
233
256
  }
234
- return query.setOptions({ maxTimeMS: 10000 })
257
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
235
258
  .exec()
236
259
  .then((docs) => docs.map((doc) => doc.toObject()));
237
260
  });
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.MongoRepository = void 0;
24
24
  const customer_1 = require("./mongoose/schemas/customer");
25
25
  const factory = require("../factory");
26
+ const settings_1 = require("../settings");
26
27
  /**
27
28
  * 顧客リポジトリ
28
29
  */
@@ -120,7 +121,7 @@ class MongoRepository {
120
121
  if (((_a = conditions.sort) === null || _a === void 0 ? void 0 : _a.branchCode) !== undefined) {
121
122
  query.sort({ branchCode: conditions.sort.branchCode });
122
123
  }
123
- return query.setOptions({ maxTimeMS: 10000 })
124
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
124
125
  .exec()
125
126
  .then((docs) => docs.map((doc) => doc.toObject()));
126
127
  });
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.MongoRepository = void 0;
24
24
  const emailMessages_1 = require("./mongoose/schemas/emailMessages");
25
25
  const factory = require("../factory");
26
+ const settings_1 = require("../settings");
26
27
  /**
27
28
  * Eメールメッセージリポジトリ
28
29
  */
@@ -107,7 +108,7 @@ class MongoRepository {
107
108
  if (params.sort !== undefined) {
108
109
  query.sort(params.sort);
109
110
  }
110
- return query.setOptions({ maxTimeMS: 10000 })
111
+ return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
111
112
  .exec()
112
113
  .then((docs) => docs.map((doc) => doc.toObject()));
113
114
  });
@@ -97,14 +97,20 @@ export declare class MongoRepository {
97
97
  expectsNoContent: boolean;
98
98
  }): Promise<factory.event.IEvent<T>[] | void>;
99
99
  /**
100
- * 特定の追加特性をキーにして、なければ作成する(複数対応)
100
+ * 特定の追加特性をキーにして、存在しなければ作成する(複数対応)
101
+ * 存在すれば、eventStatusのみ更新する
101
102
  */
102
103
  createManyIfNotExist<T extends factory.eventType>(params: {
103
104
  attributes: factory.event.IAttributes<T>;
104
105
  filter: {
105
106
  name: string;
106
107
  };
107
- }[]): Promise<BulkWriteOpResultObject | void>;
108
+ }[]): Promise<{
109
+ bulkWriteResult: BulkWriteOpResultObject;
110
+ modifiedEvents: {
111
+ id: string;
112
+ }[];
113
+ } | void>;
108
114
  /**
109
115
  * コンテンツ+バージョンをキーにして、なければ作成する(複数対応)
110
116
  */
@@ -179,6 +185,28 @@ export declare class MongoRepository {
179
185
  filter: any;
180
186
  $unset: any;
181
187
  }): Promise<import("mongodb").UpdateResult>;
188
+ /**
189
+ * 既存施設コンテンツの最大バージョンを集計する
190
+ */
191
+ aggregateScreeningEventMaxVersion(params: {
192
+ project: {
193
+ id: {
194
+ $eq: string;
195
+ };
196
+ };
197
+ workPerformed: {
198
+ identifier: {
199
+ $eq: string;
200
+ };
201
+ };
202
+ location: {
203
+ branchCode: {
204
+ $in: string[];
205
+ };
206
+ };
207
+ }): Promise<{
208
+ maxVersion: string;
209
+ }>;
182
210
  aggregateEvent(params: {
183
211
  project?: {
184
212
  id?: {