@chevre/domain 23.2.0-alpha.6 → 23.2.0-alpha.61

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 (173) hide show
  1. package/example/src/chevre/acceptedPaymentMethodOffer/adminAcceptedPaymentMethodOffers.ts +25 -17
  2. package/example/src/chevre/confirmationNumber/testRandomness.ts +49 -0
  3. package/example/src/chevre/emailMessage/createEmailMessageText.ts +63 -0
  4. package/example/src/chevre/event/importEventsFromCOAByTitle.ts +2 -2
  5. package/example/src/chevre/event/unsetSuperEventVideoFormat.ts +30 -0
  6. package/example/src/chevre/eventSeries/unsetVideoFormat.ts +31 -0
  7. package/example/src/chevre/{upsertScreeningEventSeriesByVersion.ts → eventSeries/upsertScreeningEventSeriesByVersion.ts} +47 -43
  8. package/example/src/chevre/{upsertOfferCatalogItemsByIdentifier.ts → offerCatalog/upsertOfferCatalogItemsByIdentifier.ts} +6 -3
  9. package/example/src/chevre/{upsertOfferCatalogsByIdentifier.ts → offerCatalog/upsertOfferCatalogsByIdentifier.ts} +8 -3
  10. package/example/src/chevre/{upsertOffersByIdentifier.ts → offers/upsertOffersByIdentifier.ts} +5 -3
  11. package/example/src/chevre/orderNumber/testRandomness.ts +54 -0
  12. package/example/src/chevre/place/adminEntranceGates.ts +69 -0
  13. package/example/src/chevre/place/checkEntranceGatesCount.ts +82 -0
  14. package/example/src/chevre/place/findRooms.ts +24 -0
  15. package/example/src/chevre/place/findSections.ts +28 -0
  16. package/example/src/chevre/place/migrateSectionIdentifier.ts +92 -0
  17. package/example/src/chevre/place/seatsJson2csv.ts +63 -0
  18. package/example/src/chevre/place/upsertMovieTheatersByBranchCode.ts +41 -0
  19. package/example/src/chevre/place/upsertRoomsByBranchCode.ts +40 -0
  20. package/example/src/chevre/place/upsertSeatSectionsByBranchCode.ts +56 -0
  21. package/example/src/chevre/reIndex.ts +1 -1
  22. package/example/src/chevre/roles/addAdminAcceptedPaymentMethodReadPermissionIfNotExists.ts +33 -0
  23. package/example/src/chevre/roles/addAdminAcceptedPaymentMethodWritePermissionIfNotExists.ts +33 -0
  24. package/example/src/chevre/roles/addAdminMovieReadPermissionIfNotExists.ts +49 -0
  25. package/example/src/chevre/roles/addAdminRoomReadPermissionIfNotExists.ts +34 -0
  26. package/example/src/chevre/roles/addAdminRoomWritePermissionIfNotExists.ts +34 -0
  27. package/example/src/chevre/settings/addOrderNumberSetting.ts +44 -0
  28. package/example/src/chevre/settings/addTransactionNumberSetting.ts +40 -0
  29. package/example/src/chevre/transactionNumber/publishByTimestamp.ts +23 -0
  30. package/example/src/chevre/transactionNumber/testRandomness.ts +42 -0
  31. package/example/src/chevre/unsetUnnecessaryFields.ts +8 -4
  32. package/lib/chevre/emailMessageBuilder.js +1 -0
  33. package/lib/chevre/factory/event.d.ts +1 -1
  34. package/lib/chevre/factory/event.js +11 -5
  35. package/lib/chevre/factory/transactionNumber.d.ts +19 -0
  36. package/lib/chevre/factory/transactionNumber.js +54 -0
  37. package/lib/chevre/repo/acceptedPaymentMethod.d.ts +41 -8
  38. package/lib/chevre/repo/acceptedPaymentMethod.js +72 -27
  39. package/lib/chevre/repo/aggregateOffer.d.ts +6 -1
  40. package/lib/chevre/repo/aggregateOffer.js +11 -3
  41. package/lib/chevre/repo/aggregateOrder.js +0 -93
  42. package/lib/chevre/repo/aggregateReservation.d.ts +0 -1
  43. package/lib/chevre/repo/aggregateReservation.js +0 -2
  44. package/lib/chevre/repo/confirmationNumber.d.ts +1 -0
  45. package/lib/chevre/repo/confirmationNumber.js +32 -25
  46. package/lib/chevre/repo/event.d.ts +3 -18
  47. package/lib/chevre/repo/event.js +94 -83
  48. package/lib/chevre/repo/eventOffer.d.ts +8 -0
  49. package/lib/chevre/repo/eventOffer.js +11 -0
  50. package/lib/chevre/repo/eventSeries.d.ts +17 -30
  51. package/lib/chevre/repo/eventSeries.js +204 -146
  52. package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +0 -1
  53. package/lib/chevre/repo/mongoose/schemas/eventSeries.js +20 -5
  54. package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +2 -8
  55. package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.js +28 -2
  56. package/lib/chevre/repo/mongoose/schemas/place.d.ts +6 -2
  57. package/lib/chevre/repo/mongoose/schemas/setting.d.ts +40 -0
  58. package/lib/chevre/repo/mongoose/schemas/setting.js +3 -0
  59. package/lib/chevre/repo/offerCatalog.d.ts +14 -1
  60. package/lib/chevre/repo/offerCatalog.js +41 -19
  61. package/lib/chevre/repo/offerCatalogItem.d.ts +10 -1
  62. package/lib/chevre/repo/offerCatalogItem.js +32 -17
  63. package/lib/chevre/repo/orderNumber.d.ts +6 -0
  64. package/lib/chevre/repo/orderNumber.js +110 -35
  65. package/lib/chevre/repo/place/entranceGate.d.ts +57 -0
  66. package/lib/chevre/repo/place/entranceGate.js +172 -0
  67. package/lib/chevre/repo/place/movieTheater.d.ts +40 -3
  68. package/lib/chevre/repo/place/movieTheater.js +77 -6
  69. package/lib/chevre/repo/place/screeningRoom.d.ts +60 -31
  70. package/lib/chevre/repo/place/screeningRoom.js +227 -135
  71. package/lib/chevre/repo/place/seat.d.ts +47 -45
  72. package/lib/chevre/repo/place/seat.js +175 -45
  73. package/lib/chevre/repo/place/section.d.ts +60 -30
  74. package/lib/chevre/repo/place/section.js +337 -127
  75. package/lib/chevre/repo/serviceOutputIdentifier.d.ts +3 -1
  76. package/lib/chevre/repo/serviceOutputIdentifier.js +42 -27
  77. package/lib/chevre/repo/setting.d.ts +1 -1
  78. package/lib/chevre/repo/setting.js +2 -2
  79. package/lib/chevre/repo/task.d.ts +1 -1
  80. package/lib/chevre/repo/transactionNumber.d.ts +5 -0
  81. package/lib/chevre/repo/transactionNumber.js +63 -27
  82. package/lib/chevre/repository.d.ts +8 -0
  83. package/lib/chevre/repository.js +16 -0
  84. package/lib/chevre/service/assetTransaction/fixInformAction.d.ts +3 -0
  85. package/lib/chevre/service/assetTransaction/fixInformAction.js +3 -0
  86. package/lib/chevre/service/assetTransaction/pay/cancel.d.ts +12 -0
  87. package/lib/chevre/service/assetTransaction/pay/cancel.js +25 -0
  88. package/lib/chevre/service/assetTransaction/pay/check.d.ts +23 -0
  89. package/lib/chevre/service/assetTransaction/pay/check.js +37 -0
  90. package/lib/chevre/service/assetTransaction/pay/confirm.d.ts +24 -0
  91. package/lib/chevre/service/assetTransaction/pay/confirm.js +72 -0
  92. package/lib/chevre/service/assetTransaction/pay/exportTasksById.d.ts +18 -0
  93. package/lib/chevre/service/assetTransaction/pay/exportTasksById.js +111 -0
  94. package/lib/chevre/service/assetTransaction/pay/publishPaymentUrl.d.ts +48 -0
  95. package/lib/chevre/service/assetTransaction/pay/publishPaymentUrl.js +164 -0
  96. package/lib/chevre/service/assetTransaction/pay/searchGMOTrade.d.ts +20 -0
  97. package/lib/chevre/service/assetTransaction/pay/searchGMOTrade.js +59 -0
  98. package/lib/chevre/service/assetTransaction/pay/{account → start/account}/validation.d.ts +2 -2
  99. package/lib/chevre/service/assetTransaction/pay/{account → start/account}/validation.js +1 -1
  100. package/lib/chevre/service/assetTransaction/pay/{factory.d.ts → start/factory.d.ts} +1 -1
  101. package/lib/chevre/service/assetTransaction/pay/{factory.js → start/factory.js} +1 -1
  102. package/lib/chevre/service/assetTransaction/pay/{validateAcceptedPaymentMethodIfNeeded.d.ts → start/preStart/validateAcceptedPaymentMethodIfNeeded.d.ts} +4 -4
  103. package/lib/chevre/service/assetTransaction/pay/{validateAcceptedPaymentMethodIfNeeded.js → start/preStart/validateAcceptedPaymentMethodIfNeeded.js} +1 -4
  104. package/lib/chevre/service/assetTransaction/pay/start/preStart/validateSeller.d.ts +8 -0
  105. package/lib/chevre/service/assetTransaction/pay/start/preStart/validateSeller.js +54 -0
  106. package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeAccount.d.ts +13 -0
  107. package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeAccount.js +49 -0
  108. package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeCreditCard.d.ts +29 -0
  109. package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeCreditCard.js +37 -0
  110. package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeMovieTicket.d.ts +42 -0
  111. package/lib/chevre/service/assetTransaction/pay/start/processAuthorizeMovieTicket.js +31 -0
  112. package/lib/chevre/service/assetTransaction/pay/start.d.ts +60 -0
  113. package/lib/chevre/service/assetTransaction/pay/start.js +145 -0
  114. package/lib/chevre/service/assetTransaction/pay.d.ts +8 -170
  115. package/lib/chevre/service/assetTransaction/pay.js +16 -623
  116. package/lib/chevre/service/assetTransaction/reserve/start/factory/createStartParams.js +10 -2
  117. package/lib/chevre/service/event/processUpdateMovieTheater.d.ts +1 -1
  118. package/lib/chevre/service/event/processUpdateMovieTheater.js +13 -11
  119. package/lib/chevre/service/event/saveScreeningEventSeries.js +4 -5
  120. package/lib/chevre/service/event/saveScreeningEvents.d.ts +2 -2
  121. package/lib/chevre/service/event/saveScreeningEvents.js +16 -12
  122. package/lib/chevre/service/offer/event/authorize/factory.js +9 -1
  123. package/lib/chevre/service/offer/event/searchEventTicketOffers.js +7 -4
  124. package/lib/chevre/service/offer/event/searchOfferAppliesToMovieTicket.js +9 -6
  125. package/lib/chevre/service/offer/event/searchOffersByIds.js +7 -4
  126. package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.js +7 -1
  127. package/lib/chevre/service/offer/onEventChanged.js +10 -6
  128. package/lib/chevre/service/offer/product.js +1 -1
  129. package/lib/chevre/service/offer.d.ts +5 -0
  130. package/lib/chevre/service/offer.js +34 -9
  131. package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +1 -1
  132. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +1 -1
  133. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +1 -1
  134. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByAggregateOffer.d.ts +13 -0
  135. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByAggregateOffer.js +53 -0
  136. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByEventSeries.d.ts +13 -0
  137. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByEventSeries.js +56 -0
  138. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByMovieTheater.d.ts +15 -0
  139. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByMovieTheater.js +58 -0
  140. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByOfferCatalog.d.ts +17 -0
  141. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByOfferCatalog.js +75 -0
  142. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByProduct.d.ts +19 -0
  143. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByProduct.js +60 -0
  144. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByRoom.d.ts +20 -0
  145. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByRoom.js +51 -0
  146. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesBySeller.d.ts +27 -0
  147. package/lib/chevre/service/task/onResourceDeleted/deleteResourcesBySeller.js +100 -0
  148. package/lib/chevre/service/task/onResourceDeleted.d.ts +6 -0
  149. package/lib/chevre/service/task/onResourceDeleted.js +168 -0
  150. package/lib/chevre/service/task/onResourceUpdated.js +205 -42
  151. package/lib/chevre/service/task/syncResourcesFromCOA.js +4 -2
  152. package/lib/chevre/service/taskHandler.js +1 -0
  153. package/package.json +9 -9
  154. package/example/src/chevre/event/upsertManyScreeningEventByIdentifier.ts +0 -191
  155. package/example/src/chevre/eventSeries/migrateEventSeriesUnacceptedPaymentMethod.ts +0 -93
  156. package/example/src/chevre/offers/createSampleOffers.ts +0 -154
  157. package/example/src/chevre/settings/addSettings.ts +0 -46
  158. package/lib/chevre/service/eventOld.d.ts +0 -60
  159. package/lib/chevre/service/eventOld.js +0 -864
  160. package/lib/chevre/service/task/createEvent/createEvent.d.ts +0 -25
  161. package/lib/chevre/service/task/createEvent/createEvent.js +0 -45
  162. package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.d.ts +0 -22
  163. package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.js +0 -188
  164. package/lib/chevre/service/task/createEvent/createEventBySchedule/schedule2events.d.ts +0 -15
  165. package/lib/chevre/service/task/createEvent/createEventBySchedule/schedule2events.js +0 -116
  166. package/lib/chevre/service/task/createEvent/createEventBySchedule.d.ts +0 -25
  167. package/lib/chevre/service/task/createEvent/createEventBySchedule.js +0 -107
  168. package/lib/chevre/service/task/createEvent/createEventSeries.d.ts +0 -13
  169. package/lib/chevre/service/task/createEvent/createEventSeries.js +0 -118
  170. package/lib/chevre/service/task/createEvent.d.ts +0 -6
  171. package/lib/chevre/service/task/createEvent.js +0 -46
  172. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +0 -45
  173. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +0 -447
@@ -23,7 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.EventSeriesRepo = void 0;
24
24
  const factory = require("../factory");
25
25
  const eventSeries_1 = require("./mongoose/schemas/eventSeries");
26
- const errorHandler_1 = require("../errorHandler");
26
+ // import { isMongoError, MongoErrorCode } from '../errorHandler';
27
27
  const settings_1 = require("../settings");
28
28
  /**
29
29
  * 施設コンテンツリポジトリ
@@ -36,7 +36,8 @@ class EventSeriesRepo {
36
36
  static CREATE_MONGO_CONDITIONS(conditions) {
37
37
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
38
38
  const andConditions = [
39
- { typeOf: { $eq: factory.eventType.ScreeningEventSeries } } // fix(2024-09-08~)
39
+ // typeOfは必ずScreeningEventSeriesなので不要(2026-02-14~)
40
+ // { typeOf: { $eq: factory.eventType.ScreeningEventSeries } } // fix(2024-09-08~)
40
41
  ];
41
42
  const projectIdEq = (_b = (_a = conditions.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
42
43
  if (typeof projectIdEq === 'string') {
@@ -184,21 +185,25 @@ class EventSeriesRepo {
184
185
  }
185
186
  const videoFormatTypeOfEq = (_t = (_s = conditions.videoFormat) === null || _s === void 0 ? void 0 : _s.typeOf) === null || _t === void 0 ? void 0 : _t.$eq;
186
187
  if (typeof videoFormatTypeOfEq === 'string') {
187
- andConditions.push({
188
- 'videoFormat.typeOf': {
189
- $exists: true,
190
- $eq: videoFormatTypeOfEq
191
- }
192
- });
188
+ // 新しい参照先へ変更(2025-12-31~)
189
+ // andConditions.push({
190
+ // 'videoFormat.typeOf': {
191
+ // $exists: true,
192
+ // $eq: videoFormatTypeOfEq
193
+ // }
194
+ // });
195
+ andConditions.push({ 'subEvent.videoFormat': { $exists: true, $eq: videoFormatTypeOfEq } });
193
196
  }
194
197
  const videoFormatTypeOfIn = (_v = (_u = conditions.videoFormat) === null || _u === void 0 ? void 0 : _u.typeOf) === null || _v === void 0 ? void 0 : _v.$in;
195
198
  if (Array.isArray(videoFormatTypeOfIn)) {
196
- andConditions.push({
197
- 'videoFormat.typeOf': {
198
- $exists: true,
199
- $in: videoFormatTypeOfIn
200
- }
201
- });
199
+ // 新しい参照先へ変更(2025-12-31~)
200
+ // andConditions.push({
201
+ // 'videoFormat.typeOf': {
202
+ // $exists: true,
203
+ // $in: videoFormatTypeOfIn
204
+ // }
205
+ // });
206
+ andConditions.push({ 'subEvent.videoFormat': { $exists: true, $in: videoFormatTypeOfIn } });
202
207
  }
203
208
  const soundFormatTypeOfEq = (_x = (_w = conditions.soundFormat) === null || _w === void 0 ? void 0 : _w.typeOf) === null || _x === void 0 ? void 0 : _x.$eq;
204
209
  if (typeof soundFormatTypeOfEq === 'string') {
@@ -220,87 +225,96 @@ class EventSeriesRepo {
220
225
  }
221
226
  return andConditions;
222
227
  }
228
+ // /**
229
+ // * 複数イベントを作成する
230
+ // */
231
+ // public async createManyEventSeries(params: {
232
+ // attributes: factory.eventSeries.IAttributes[];
233
+ // expectsNoContent: boolean;
234
+ // }): Promise<string[] | void> { // optimize response(only id)(2024-08-02~)
235
+ // const uniqid = await import('uniqid');
236
+ // const insertingDocs: (factory.eventSeries.IAttributes & { _id: string })[] =
237
+ // params.attributes.map((p) => {
238
+ // return {
239
+ // _id: uniqid(),
240
+ // ...p
241
+ // };
242
+ // });
243
+ // try {
244
+ // await this.eventSeriesModel.insertMany<factory.eventSeries.IAttributes & { _id: string }>(
245
+ // insertingDocs,
246
+ // { rawResult: true } // rawResult(2024-08-02~)
247
+ // );
248
+ // // console.dir(insertResult, { depth: null });
249
+ // } catch (error) {
250
+ // if (await isMongoError(error)) {
251
+ // if (error.code === MongoErrorCode.DuplicateKey) {
252
+ // throw new factory.errors.AlreadyInUse(factory.eventType.ScreeningEventSeries, ['workPerformed.version']);
253
+ // }
254
+ // }
255
+ // throw error;
256
+ // }
257
+ // if (params.expectsNoContent) {
258
+ // return;
259
+ // }
260
+ // return insertingDocs.map(({ _id }) => _id);
261
+ // }
262
+ // /**
263
+ // * コンテンツ+バージョンをキーにして、なければ作成する(複数対応)
264
+ // */
265
+ // public async createIfNotExistByWorkPerformed(params: {
266
+ // attributes: factory.eventSeries.IAttributes;
267
+ // }[]): Promise<BulkWriteResult | void> {
268
+ // const uniqid = await import('uniqid');
269
+ // const bulkWriteOps: AnyBulkWriteOperation<IDocType>[] = [];
270
+ // if (Array.isArray(params)) {
271
+ // params.forEach((creatingEventParams) => {
272
+ // const version = creatingEventParams.attributes.workPerformed.version;
273
+ // if (typeof version !== 'string') {
274
+ // throw new factory.errors.ArgumentNull('workPerformed.version');
275
+ // }
276
+ // const setOnInsertFields = creatingEventParams.attributes;
277
+ // bulkWriteOps.push({
278
+ // updateOne: {
279
+ // filter: {
280
+ // typeOf: creatingEventParams.attributes.typeOf,
281
+ // 'project.id': { $eq: creatingEventParams.attributes.project.id },
282
+ // 'location.branchCode': {
283
+ // $exists: true,
284
+ // $eq: creatingEventParams.attributes.location.branchCode
285
+ // },
286
+ // 'workPerformed.identifier': {
287
+ // $exists: true,
288
+ // $eq: creatingEventParams.attributes.workPerformed.identifier
289
+ // },
290
+ // 'workPerformed.version': {
291
+ // $exists: true,
292
+ // $eq: version
293
+ // }
294
+ // },
295
+ // update: {
296
+ // $setOnInsert: {
297
+ // ...setOnInsertFields,
298
+ // _id: uniqid()
299
+ // }
300
+ // },
301
+ // upsert: true
302
+ // }
303
+ // });
304
+ // });
305
+ // }
306
+ // if (bulkWriteOps.length > 0) {
307
+ // return this.eventSeriesModel.bulkWrite(bulkWriteOps, { ordered: false });
308
+ // }
309
+ // }
223
310
  /**
224
- * 複数イベントを作成する
225
- */
226
- createManyEventSeries(params) {
227
- return __awaiter(this, void 0, void 0, function* () {
228
- const uniqid = yield Promise.resolve().then(() => require('uniqid'));
229
- const insertingDocs = params.attributes.map((p) => {
230
- return Object.assign({ _id: uniqid() }, p);
231
- });
232
- try {
233
- yield this.eventSeriesModel.insertMany(insertingDocs, { rawResult: true } // rawResult(2024-08-02~)
234
- );
235
- // console.dir(insertResult, { depth: null });
236
- }
237
- catch (error) {
238
- if (yield (0, errorHandler_1.isMongoError)(error)) {
239
- if (error.code === errorHandler_1.MongoErrorCode.DuplicateKey) {
240
- throw new factory.errors.AlreadyInUse(factory.eventType.ScreeningEventSeries, ['workPerformed.version']);
241
- }
242
- }
243
- throw error;
244
- }
245
- if (params.expectsNoContent) {
246
- return;
247
- }
248
- return insertingDocs.map(({ _id }) => _id);
249
- });
250
- }
251
- /**
252
- * コンテンツ+バージョンをキーにして、なければ作成する(複数対応)
311
+ * 施設+コンテンツ+バージョンをキーにして冪等置換
253
312
  */
254
- createIfNotExistByWorkPerformed(params) {
313
+ upsertByVersion(params, options) {
255
314
  return __awaiter(this, void 0, void 0, function* () {
315
+ const { upsert } = options;
256
316
  const uniqid = yield Promise.resolve().then(() => require('uniqid'));
257
317
  const bulkWriteOps = [];
258
- if (Array.isArray(params)) {
259
- params.forEach((creatingEventParams) => {
260
- const version = creatingEventParams.attributes.workPerformed.version;
261
- if (typeof version !== 'string') {
262
- throw new factory.errors.ArgumentNull('workPerformed.version');
263
- }
264
- const setOnInsertFields = creatingEventParams.attributes;
265
- bulkWriteOps.push({
266
- updateOne: {
267
- filter: {
268
- typeOf: creatingEventParams.attributes.typeOf,
269
- 'project.id': { $eq: creatingEventParams.attributes.project.id },
270
- 'location.branchCode': {
271
- $exists: true,
272
- $eq: creatingEventParams.attributes.location.branchCode
273
- },
274
- 'workPerformed.identifier': {
275
- $exists: true,
276
- $eq: creatingEventParams.attributes.workPerformed.identifier
277
- },
278
- 'workPerformed.version': {
279
- $exists: true,
280
- $eq: version
281
- }
282
- },
283
- update: {
284
- $setOnInsert: Object.assign(Object.assign({}, setOnInsertFields), { _id: uniqid() })
285
- },
286
- upsert: true
287
- }
288
- });
289
- });
290
- }
291
- if (bulkWriteOps.length > 0) {
292
- return this.eventSeriesModel.bulkWrite(bulkWriteOps, { ordered: false });
293
- }
294
- });
295
- }
296
- /**
297
- * コンテンツ+バージョンをキーにして冪等置換
298
- */
299
- // tslint:disable-next-line:max-func-body-length
300
- upsertByVersion(params) {
301
- return __awaiter(this, void 0, void 0, function* () {
302
- const uniqid = yield Promise.resolve().then(() => require('uniqid'));
303
- const bulkWriteOps4insert = [];
304
318
  const queryFilters = [];
305
319
  if (Array.isArray(params)) {
306
320
  params.forEach(({ $set, $unset }) => {
@@ -329,71 +343,109 @@ class EventSeriesRepo {
329
343
  typeOf,
330
344
  _id: uniqid()
331
345
  };
332
- const updateOne = {
333
- filter,
334
- update: Object.assign({ $setOnInsert: setOnInsert, $set: setFields }, ($unset !== undefined) ? { $unset } : undefined),
335
- upsert: true
336
- };
337
- bulkWriteOps4insert.push({ updateOne });
346
+ let updateOne;
347
+ if (upsert === true) {
348
+ updateOne = {
349
+ filter,
350
+ update: Object.assign({ $setOnInsert: setOnInsert, $set: setFields }, ($unset !== undefined) ? { $unset } : undefined),
351
+ upsert: true
352
+ };
353
+ }
354
+ else {
355
+ updateOne = {
356
+ filter,
357
+ update: {
358
+ $setOnInsert: Object.assign(Object.assign({}, setOnInsert), setFields)
359
+ },
360
+ upsert: true
361
+ };
362
+ }
363
+ bulkWriteOps.push({ updateOne });
338
364
  });
339
365
  }
340
- if (bulkWriteOps4insert.length > 0) {
341
- const bulkWriteResult4insert = yield this.eventSeriesModel.bulkWrite(bulkWriteOps4insert, { ordered: false });
342
- // modifiedの場合upsertedIdsに含まれないので、idを検索する
343
- const modifiedEvents = yield this.eventSeriesModel.find({ $or: queryFilters }, { _id: 1 })
344
- .exec();
345
- return { bulkWriteResult4insert, modifiedEvents };
346
- }
347
- });
348
- }
349
- saveEventSeries(params) {
350
- return __awaiter(this, void 0, void 0, function* () {
351
- let savedEventId;
352
- let doc;
353
- const _a = params.attributes, { identifier, project, typeOf } = _a, updateFields = __rest(_a, ["identifier", "project", "typeOf"]);
354
- if (typeof typeOf !== 'string' || typeOf.length === 0) {
355
- throw new factory.errors.ArgumentNull('attributes.typeOf');
356
- }
357
- try {
358
- if (params.id === undefined) {
359
- const uniqid = yield Promise.resolve().then(() => require('uniqid'));
360
- const id = uniqid();
361
- doc = yield this.eventSeriesModel.create(Object.assign(Object.assign({}, params.attributes), { _id: id }));
362
- savedEventId = id;
366
+ if (bulkWriteOps.length > 0) {
367
+ const bulkWriteResult = yield this.eventSeriesModel.bulkWrite(bulkWriteOps, { ordered: false });
368
+ // upsert:falseの場合、upsertedIdsのみmodifiedEventsとして返せばよい(2026-01-27~)
369
+ if (!upsert) {
370
+ // BulkWriteResult -> upsertedIds: { '0': '7iri6p4m54k0r3g' }
371
+ return {
372
+ bulkWriteResult,
373
+ modifiedEvents: Object.values(bulkWriteResult.upsertedIds)
374
+ .map((id) => ({ id: String(id) }))
375
+ };
363
376
  }
364
377
  else {
365
- // const upsert: boolean = params.upsert === true;
366
- const upsert = false;
367
- doc = yield this.eventSeriesModel.findOneAndUpdate({
368
- _id: { $eq: params.id },
369
- typeOf: { $eq: typeOf }
370
- }, Object.assign({
371
- // 上書き禁止属性を除外(2022-08-24~)
372
- $setOnInsert: Object.assign({ typeOf,
373
- project }, (identifier !== undefined) ? { identifier } : undefined), $set: updateFields }, (params.$unset !== undefined) ? { $unset: params.$unset } : undefined), {
374
- upsert,
375
- new: true,
376
- projection: { _id: 1 }
377
- })
378
- .lean()
378
+ // modifiedの場合upsertedIdsに含まれないので、idを検索する
379
+ const modifiedEvents = yield this.eventSeriesModel.find({ $or: queryFilters }, { _id: 1 })
379
380
  .exec();
380
- savedEventId = params.id;
381
+ return { bulkWriteResult, modifiedEvents };
381
382
  }
382
383
  }
383
- catch (error) {
384
- if (yield (0, errorHandler_1.isMongoError)(error)) {
385
- if (error.code === errorHandler_1.MongoErrorCode.DuplicateKey) {
386
- throw new factory.errors.AlreadyInUse(factory.eventType.ScreeningEventSeries, ['workPerformed.version']);
387
- }
388
- }
389
- throw error;
390
- }
391
- if (doc === null) {
392
- throw new factory.errors.NotFound(this.eventSeriesModel.modelName);
393
- }
394
- return { id: savedEventId }; // optimize(2024-07-31~)
384
+ return { modifiedEvents: [] };
395
385
  });
396
386
  }
387
+ // public async saveEventSeries(params: {
388
+ // id?: string;
389
+ // attributes: factory.eventSeries.IAttributes;
390
+ // /**
391
+ // * ドキュメント作成時には無視される
392
+ // */
393
+ // $unset?: IUnset;
394
+ // // upsert?: boolean;
395
+ // }): Promise<{ id: string }> {
396
+ // let savedEventId: string;
397
+ // let doc: Document | { _id: string } | null;
398
+ // const { identifier, project, typeOf, ...updateFields } = params.attributes;
399
+ // if (typeof typeOf !== 'string' || typeOf.length === 0) {
400
+ // throw new factory.errors.ArgumentNull('attributes.typeOf');
401
+ // }
402
+ // try {
403
+ // if (params.id === undefined) {
404
+ // const uniqid = await import('uniqid');
405
+ // const id = uniqid();
406
+ // doc = await this.eventSeriesModel.create({ ...params.attributes, _id: id });
407
+ // savedEventId = id;
408
+ // } else {
409
+ // // const upsert: boolean = params.upsert === true;
410
+ // const upsert: boolean = false;
411
+ // doc = await this.eventSeriesModel.findOneAndUpdate(
412
+ // {
413
+ // _id: { $eq: params.id },
414
+ // typeOf: { $eq: typeOf }
415
+ // },
416
+ // {
417
+ // // 上書き禁止属性を除外(2022-08-24~)
418
+ // $setOnInsert: {
419
+ // typeOf,
420
+ // project,
421
+ // ...(identifier !== undefined) ? { identifier } : undefined
422
+ // },
423
+ // $set: updateFields,
424
+ // ...(params.$unset !== undefined) ? { $unset: params.$unset } : undefined
425
+ // },
426
+ // {
427
+ // upsert,
428
+ // new: true,
429
+ // projection: { _id: 1 }
430
+ // }
431
+ // )
432
+ // .lean<{ _id: string }>()
433
+ // .exec();
434
+ // savedEventId = params.id;
435
+ // }
436
+ // } catch (error) {
437
+ // if (await isMongoError(error)) {
438
+ // if (error.code === MongoErrorCode.DuplicateKey) {
439
+ // throw new factory.errors.AlreadyInUse(factory.eventType.ScreeningEventSeries, ['workPerformed.version']);
440
+ // }
441
+ // }
442
+ // throw error;
443
+ // }
444
+ // if (doc === null) {
445
+ // throw new factory.errors.NotFound(this.eventSeriesModel.modelName);
446
+ // }
447
+ // return { id: savedEventId }; // optimize(2024-07-31~)
448
+ // }
397
449
  /**
398
450
  * sskts施設コンテンツ保管
399
451
  */
@@ -541,5 +593,11 @@ class EventSeriesRepo {
541
593
  .sort({ startDate: factory.sortType.Descending })
542
594
  .cursor();
543
595
  }
596
+ unsetUnnecessaryFields(params) {
597
+ return __awaiter(this, void 0, void 0, function* () {
598
+ return this.eventSeriesModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
599
+ .exec();
600
+ });
601
+ }
544
602
  }
545
603
  exports.EventSeriesRepo = EventSeriesRepo;
@@ -11,7 +11,6 @@ const schemaDefinition = {
11
11
  project: { type: mongoose_1.SchemaTypes.Mixed, required: true },
12
12
  typeOf: { type: String, required: true },
13
13
  reservationFor: { type: mongoose_1.SchemaTypes.Mixed, required: true },
14
- // aggregateEntranceGate: SchemaTypes.Mixed, // discontinue(2024-12-23~)
15
14
  aggregateOffer: mongoose_1.SchemaTypes.Mixed
16
15
  };
17
16
  const schemaOptions = {
@@ -24,14 +24,19 @@ const schemaDefinition = {
24
24
  headline: mongoose_1.SchemaTypes.Mixed,
25
25
  location: mongoose_1.SchemaTypes.Mixed,
26
26
  startDate: { type: Date, required: true }, // required(2025-10-08~)
27
+ subEvent: mongoose_1.SchemaTypes.Mixed, // support(2025-12-31~)
27
28
  workPerformed: mongoose_1.SchemaTypes.Mixed,
28
- videoFormat: mongoose_1.SchemaTypes.Mixed,
29
29
  soundFormat: mongoose_1.SchemaTypes.Mixed,
30
30
  subtitleLanguage: mongoose_1.SchemaTypes.Mixed,
31
31
  dubLanguage: mongoose_1.SchemaTypes.Mixed,
32
32
  kanaName: String,
33
33
  offers: mongoose_1.SchemaTypes.Mixed,
34
34
  coaInfo: mongoose_1.SchemaTypes.Mixed
35
+ // discontinue(2026-02-14~)
36
+ // ...{
37
+ // // factory.eventSeries.IEventから廃止したので、ひとまずspread operatorで解決(2026-02-10~)
38
+ // videoFormat: SchemaTypes.Mixed
39
+ // }
35
40
  };
36
41
  const schemaOptions = {
37
42
  autoIndex: settings_1.MONGO_AUTO_INDEX,
@@ -137,12 +142,22 @@ const indexes = [
137
142
  }
138
143
  }
139
144
  ],
140
- [
141
- { 'videoFormat.typeOf': 1, startDate: 1 },
145
+ // remove videoFormatTypeOf(2026-02-13~)
146
+ // [
147
+ // { 'videoFormat.typeOf': 1, startDate: 1 },
148
+ // {
149
+ // name: 'videoFormatTypeOf',
150
+ // partialFilterExpression: {
151
+ // 'videoFormat.typeOf': { $exists: true }
152
+ // }
153
+ // }
154
+ // ],
155
+ [
156
+ { 'subEvent.videoFormat': 1, startDate: 1 },
142
157
  {
143
- name: 'videoFormatTypeOf',
158
+ name: 'subEventVideoFormat',
144
159
  partialFilterExpression: {
145
- 'videoFormat.typeOf': { $exists: true }
160
+ 'subEvent.videoFormat': { $exists: true }
146
161
  }
147
162
  }
148
163
  ],
@@ -8,7 +8,7 @@ const settings_1 = require("../../../settings");
8
8
  const modelName = 'OfferCatalog';
9
9
  exports.modelName = modelName;
10
10
  const schemaDefinition = {
11
- project: mongoose_1.SchemaTypes.Mixed,
11
+ project: { type: mongoose_1.SchemaTypes.Mixed, required: true },
12
12
  _id: String,
13
13
  identifier: {
14
14
  type: String,
@@ -22,7 +22,7 @@ const schemaDefinition = {
22
22
  required: true
23
23
  },
24
24
  itemListElement: [mongoose_1.SchemaTypes.Mixed],
25
- itemOffered: mongoose_1.SchemaTypes.Mixed,
25
+ itemOffered: { type: mongoose_1.SchemaTypes.Mixed, required: true },
26
26
  additionalProperty: [mongoose_1.SchemaTypes.Mixed],
27
27
  dateSynced: Date // 追加(2023-09-13~)
28
28
  // createdAt: SchemaTypes.Mixed,
@@ -60,12 +60,6 @@ const indexes = [
60
60
  name: 'searchByIdentifier'
61
61
  }
62
62
  ],
63
- [
64
- { 'project.id': 1, identifier: 1 },
65
- {
66
- name: 'searchByProjectId-v20220721'
67
- }
68
- ],
69
63
  [
70
64
  { 'itemListElement.typeOf': 1, identifier: 1 },
71
65
  {
@@ -8,7 +8,7 @@ const settings_1 = require("../../../settings");
8
8
  const modelName = 'OfferCatalogItem';
9
9
  exports.modelName = modelName;
10
10
  const schemaDefinition = {
11
- project: mongoose_1.SchemaTypes.Mixed,
11
+ project: { type: mongoose_1.SchemaTypes.Mixed, required: true },
12
12
  identifier: {
13
13
  type: String,
14
14
  required: true
@@ -21,7 +21,7 @@ const schemaDefinition = {
21
21
  required: true
22
22
  },
23
23
  itemListElement: [mongoose_1.SchemaTypes.Mixed],
24
- itemOffered: mongoose_1.SchemaTypes.Mixed,
24
+ itemOffered: { type: mongoose_1.SchemaTypes.Mixed, required: true },
25
25
  additionalProperty: [mongoose_1.SchemaTypes.Mixed],
26
26
  dateSynced: Date,
27
27
  relatedOffer: mongoose_1.SchemaTypes.Mixed
@@ -61,6 +61,32 @@ const indexes = [
61
61
  unique: true,
62
62
  name: 'uniqueIdentifier'
63
63
  }
64
+ ],
65
+ [
66
+ { identifier: 1 },
67
+ { name: 'identifier' }
68
+ ],
69
+ [
70
+ { 'itemOffered.typeOf': 1, identifier: 1 },
71
+ { name: 'itemOfferedTypeOf' }
72
+ ],
73
+ [
74
+ { 'itemListElement.typeOf': 1, identifier: 1 },
75
+ {
76
+ name: 'itemListElementTypeOf',
77
+ partialFilterExpression: {
78
+ 'itemListElement.typeOf': { $exists: true }
79
+ }
80
+ }
81
+ ],
82
+ [
83
+ { 'itemListElement.id': 1, identifier: 1 },
84
+ {
85
+ name: 'itemListElementId',
86
+ partialFilterExpression: {
87
+ 'itemListElement.id': { $exists: true }
88
+ }
89
+ }
64
90
  ]
65
91
  ];
66
92
  exports.indexes = indexes;
@@ -1,9 +1,13 @@
1
1
  import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
2
2
  import * as factory from '../../../factory';
3
- type IDocType = factory.place.screeningRoom.IPlace & {
3
+ type ISeatSection = Pick<factory.place.screeningRoomSection.IPlace, 'additionalProperty' | 'branchCode' | 'name' | 'typeOf'> & {
4
+ containsPlace?: factory.place.seat.IPlace[];
5
+ };
6
+ type IDocType = Omit<factory.place.screeningRoom.IPlace, 'containsPlace'> & {
4
7
  description?: any;
5
8
  openingHoursSpecification?: any;
6
9
  smokingAllowed?: boolean;
10
+ containsPlace: ISeatSection[];
7
11
  };
8
12
  type IModel = Model<IDocType>;
9
13
  type ISchemaDefinition = SchemaDefinition<IDocType>;
@@ -11,4 +15,4 @@ type ISchema = Schema<IDocType, IModel, {}, {}, {}, {}, ISchemaDefinition, IDocT
11
15
  declare const modelName = "Place";
12
16
  declare const indexes: [d: IndexDefinition, o: IndexOptions][];
13
17
  declare function createSchema(): ISchema;
14
- export { createSchema, IModel, indexes, modelName };
18
+ export { createSchema, IDocType, IModel, indexes, modelName };
@@ -110,6 +110,43 @@ export interface IJWTSetting {
110
110
  */
111
111
  algorithm: Algorithm;
112
112
  }
113
+ export interface IOrderNumberSetting {
114
+ validFrom: Date;
115
+ /**
116
+ * fpe暗号鍵
117
+ */
118
+ fpeSecret: string;
119
+ /**
120
+ * "A"
121
+ */
122
+ version: string;
123
+ versioningForceProjects?: string[];
124
+ /**
125
+ * 強制的にバージョニング不使用のプロジェクト
126
+ */
127
+ versioningExceptionProjects?: string[];
128
+ }
129
+ export interface ITransactionNumberSetting {
130
+ validFrom: Date;
131
+ /**
132
+ * fpe暗号鍵
133
+ */
134
+ fpeSecret: string;
135
+ /**
136
+ * "1"
137
+ */
138
+ version: string;
139
+ }
140
+ export interface IServiceOutputIdentifierSetting {
141
+ /**
142
+ * fpe暗号鍵
143
+ */
144
+ fpeSecret: string;
145
+ /**
146
+ * "1"
147
+ */
148
+ version: string;
149
+ }
113
150
  export interface ISetting {
114
151
  defaultSenderEmail?: string;
115
152
  jwt?: IJWTSetting;
@@ -121,12 +158,15 @@ export interface ISetting {
121
158
  informResource?: factory.project.IInformParams[];
122
159
  };
123
160
  onTransactionStatusChanged?: IOnTransactionStatusChanged;
161
+ orderNumber?: IOrderNumberSetting;
124
162
  project: {
125
163
  id: string;
126
164
  typeOf: factory.organizationType.Project;
127
165
  };
128
166
  quota?: IQuotaSettings;
167
+ serviceOutputIdentifier?: IServiceOutputIdentifierSetting;
129
168
  storage?: IStorageSettings;
169
+ transactionNumber?: ITransactionNumberSetting;
130
170
  /**
131
171
  * 通知設定
132
172
  */
@@ -17,8 +17,11 @@ const schemaDefinition = {
17
17
  onTaskStatusChanged: mongoose_1.SchemaTypes.Mixed,
18
18
  onResourceUpdated: mongoose_1.SchemaTypes.Mixed,
19
19
  onTransactionStatusChanged: mongoose_1.SchemaTypes.Mixed,
20
+ orderNumber: mongoose_1.SchemaTypes.Mixed,
20
21
  quota: mongoose_1.SchemaTypes.Mixed,
22
+ serviceOutputIdentifier: mongoose_1.SchemaTypes.Mixed,
21
23
  storage: mongoose_1.SchemaTypes.Mixed,
24
+ transactionNumber: mongoose_1.SchemaTypes.Mixed,
22
25
  triggerWebhook: mongoose_1.SchemaTypes.Mixed,
23
26
  useInformResourceTypes: [String],
24
27
  userPoolIdOld: String,
@@ -35,7 +35,20 @@ export declare class OfferCatalogRepo {
35
35
  $unset?: {
36
36
  [key in keyof factory.offerCatalog.IOfferCatalog]?: 1;
37
37
  };
38
- }[]): Promise<{
38
+ }[], options: {
39
+ /**
40
+ * support only update(2026-01-30~)
41
+ */
42
+ update: boolean;
43
+ /**
44
+ * プロダクトタイプでfilter(2026-01-30~)
45
+ */
46
+ productType: factory.product.ProductType;
47
+ /**
48
+ * アイテムタイプでfilter(2026-02-03~)
49
+ */
50
+ itemListElementType: factory.offerCatalog.IItemListElement['typeOf'];
51
+ }): Promise<{
39
52
  bulkWriteResult: BulkWriteResult;
40
53
  modifiedCatalogs: {
41
54
  id: string;