@chevre/domain 23.2.0-alpha.2 → 23.2.0-alpha.20

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 (67) hide show
  1. package/example/src/chevre/actions/checkAuthorizePaymentActions.ts +55 -0
  2. package/example/src/chevre/event/importEventsFromCOAByTitle.ts +1 -1
  3. package/example/src/chevre/eventSeries/migrateEventSeriesOffers.ts +75 -0
  4. package/example/src/chevre/eventSeries/migrateEventSeriesVideoFormat.ts +80 -0
  5. package/example/src/chevre/place/adminEntranceGates.ts +68 -0
  6. package/example/src/chevre/place/checkEntranceGatesCount.ts +82 -0
  7. package/example/src/chevre/place/findRooms.ts +24 -0
  8. package/example/src/chevre/place/findSections.ts +28 -0
  9. package/example/src/chevre/place/migrateSectionIdentifier.ts +92 -0
  10. package/example/src/chevre/place/seatsJson2csv.ts +63 -0
  11. package/example/src/chevre/place/upsertSeatsByBranchCode.ts +72 -0
  12. package/example/src/chevre/reIndex.ts +1 -1
  13. package/example/src/chevre/roles/addAdminEventSeriesReadPermissionIfNotExists.ts +49 -0
  14. package/example/src/chevre/roles/addAdminMovieReadPermissionIfNotExists.ts +49 -0
  15. package/example/src/chevre/roles/addAdminMovieTheaterReadPermissionIfNotExists.ts +34 -0
  16. package/example/src/chevre/roles/addAdminMovieTheaterWritePermissionIfNotExists.ts +34 -0
  17. package/example/src/chevre/roles/addAdminRoomReadPermissionIfNotExists.ts +34 -0
  18. package/example/src/chevre/roles/addAdminRoomWritePermissionIfNotExists.ts +34 -0
  19. package/lib/chevre/repo/acceptedPaymentMethod.js +14 -10
  20. package/lib/chevre/repo/aggregateOrder.js +0 -93
  21. package/lib/chevre/repo/aggregateReservation.d.ts +0 -1
  22. package/lib/chevre/repo/aggregateReservation.js +0 -2
  23. package/lib/chevre/repo/creativeWork.js +9 -5
  24. package/lib/chevre/repo/eventSeries.js +16 -12
  25. package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +0 -1
  26. package/lib/chevre/repo/mongoose/schemas/creativeWork.js +10 -9
  27. package/lib/chevre/repo/mongoose/schemas/eventSeries.js +10 -0
  28. package/lib/chevre/repo/place/entranceGate.d.ts +58 -0
  29. package/lib/chevre/repo/place/entranceGate.js +159 -0
  30. package/lib/chevre/repo/place/movieTheater.d.ts +5 -2
  31. package/lib/chevre/repo/place/movieTheater.js +3 -1
  32. package/lib/chevre/repo/place/screeningRoom.d.ts +38 -31
  33. package/lib/chevre/repo/place/screeningRoom.js +166 -135
  34. package/lib/chevre/repo/place/seat.d.ts +47 -45
  35. package/lib/chevre/repo/place/seat.js +175 -45
  36. package/lib/chevre/repo/place/section.d.ts +36 -30
  37. package/lib/chevre/repo/place/section.js +214 -130
  38. package/lib/chevre/repository.d.ts +8 -0
  39. package/lib/chevre/repository.js +16 -0
  40. package/lib/chevre/service/assetTransaction/pay/validateAcceptedPaymentMethodIfNeeded.d.ts +6 -1
  41. package/lib/chevre/service/assetTransaction/pay/validateAcceptedPaymentMethodIfNeeded.js +26 -4
  42. package/lib/chevre/service/assetTransaction/pay.d.ts +3 -0
  43. package/lib/chevre/service/event/processUpdateMovieTheater.d.ts +1 -1
  44. package/lib/chevre/service/event/processUpdateMovieTheater.js +1 -1
  45. package/lib/chevre/service/event/saveScreeningEvents.d.ts +1 -1
  46. package/lib/chevre/service/event/saveScreeningEvents.js +1 -1
  47. package/lib/chevre/service/offer/event/searchEventTicketOffers.js +7 -4
  48. package/lib/chevre/service/offer/event/searchOfferAppliesToMovieTicket.js +9 -6
  49. package/lib/chevre/service/offer/event/searchOffersByIds.js +7 -4
  50. package/lib/chevre/service/offer/onEventChanged.js +7 -5
  51. package/lib/chevre/service/payment/any/factory.d.ts +5 -0
  52. package/lib/chevre/service/payment/any/factory.js +11 -2
  53. package/lib/chevre/service/payment/any.d.ts +8 -0
  54. package/lib/chevre/service/payment/any.js +3 -2
  55. package/lib/chevre/service/task/authorizePayment.js +3 -1
  56. package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.d.ts +1 -1
  57. package/lib/chevre/service/task/createEvent/createEventBySchedule/factory.js +2 -2
  58. package/lib/chevre/service/task/createEvent/createEventBySchedule/schedule2events.js +1 -1
  59. package/lib/chevre/service/task/onResourceUpdated.js +2 -2
  60. package/lib/chevre/service/task/publishPaymentUrl.js +3 -1
  61. package/lib/chevre/service/task/syncResourcesFromCOA.js +1 -1
  62. package/lib/chevre/service/transaction/placeOrder/confirm/validation/factory.d.ts +2 -2
  63. package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +3 -1
  64. package/lib/chevre/service/transaction/placeOrder/confirm.js +3 -1
  65. package/package.json +3 -2
  66. package/lib/chevre/service/eventOld.d.ts +0 -60
  67. package/lib/chevre/service/eventOld.js +0 -864
@@ -226,24 +226,13 @@ class SeatRepo {
226
226
  return matchStages;
227
227
  }
228
228
  // tslint:disable-next-line:max-func-body-length
229
- createSeat(seat) {
229
+ createSeat(seat, options) {
230
230
  return __awaiter(this, void 0, void 0, function* () {
231
- var _a, _b, _c;
232
- const screeningRoomSection = seat.containedInPlace;
233
- if (typeof (screeningRoomSection === null || screeningRoomSection === void 0 ? void 0 : screeningRoomSection.branchCode) !== 'string') {
234
- throw new factory.errors.ArgumentNull('containedInPlace.branchCode');
235
- }
236
- const screeningRoom = screeningRoomSection.containedInPlace;
237
- if (typeof (screeningRoom === null || screeningRoom === void 0 ? void 0 : screeningRoom.branchCode) !== 'string') {
238
- throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.branchCode');
239
- }
240
- const movieTheater = screeningRoom.containedInPlace;
241
- if (typeof (movieTheater === null || movieTheater === void 0 ? void 0 : movieTheater.branchCode) !== 'string') {
242
- throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.containedInPlace.branchCode');
243
- }
231
+ var _a, _b;
232
+ const { project, parentOrganization, movieTheaterCode, roomCode, sectionCode } = options;
244
233
  // 施設存在確認
245
- const movieTheaterDoc = yield this.civicStructureModel.findOne(Object.assign({ typeOf: { $eq: factory.placeType.MovieTheater }, 'project.id': { $eq: seat.project.id }, branchCode: { $eq: movieTheater.branchCode } }, (typeof ((_a = seat.parentOrganization) === null || _a === void 0 ? void 0 : _a.id) === 'string')
246
- ? { 'parentOrganization.id': { $exists: true, $eq: seat.parentOrganization.id } }
234
+ const movieTheaterDoc = yield this.civicStructureModel.findOne(Object.assign({ typeOf: { $eq: factory.placeType.MovieTheater }, 'project.id': { $eq: project.id }, branchCode: { $eq: movieTheaterCode } }, (typeof (parentOrganization === null || parentOrganization === void 0 ? void 0 : parentOrganization.id) === 'string')
235
+ ? { 'parentOrganization.id': { $exists: true, $eq: parentOrganization.id } }
247
236
  : undefined), { _id: 1 })
248
237
  .lean()
249
238
  .exec();
@@ -252,19 +241,19 @@ class SeatRepo {
252
241
  }
253
242
  const doc = yield this.placeModel.findOneAndUpdate({
254
243
  typeOf: { $eq: factory.placeType.ScreeningRoom },
255
- 'project.id': { $eq: seat.project.id },
256
- 'containedInPlace.branchCode': { $exists: true, $eq: movieTheater.branchCode },
257
- branchCode: { $eq: screeningRoom.branchCode },
258
- 'containsPlace.branchCode': { $eq: screeningRoomSection.branchCode }
244
+ 'project.id': { $eq: project.id },
245
+ 'containedInPlace.branchCode': { $exists: true, $eq: movieTheaterCode },
246
+ branchCode: { $eq: roomCode },
247
+ 'containsPlace.branchCode': { $eq: sectionCode }
259
248
  }, {
260
249
  $push: {
261
- 'containsPlace.$[screeningRoomSection].containsPlace': Object.assign(Object.assign(Object.assign({ typeOf: seat.typeOf, branchCode: seat.branchCode, additionalProperty: seat.additionalProperty }, (typeof ((_b = seat.name) === null || _b === void 0 ? void 0 : _b.ja) === 'string' || typeof ((_c = seat.name) === null || _c === void 0 ? void 0 : _c.en) === 'string') ? { name: seat.name } : undefined), (Array.isArray(seat.seatingType)) ? { seatingType: seat.seatingType } : undefined), (seat.maximumAttendeeCapacity === 0) ? { maximumAttendeeCapacity: seat.maximumAttendeeCapacity } : undefined)
250
+ 'containsPlace.$[screeningRoomSection].containsPlace': Object.assign(Object.assign(Object.assign({ typeOf: factory.placeType.Seat, branchCode: seat.branchCode, additionalProperty: seat.additionalProperty }, (typeof ((_a = seat.name) === null || _a === void 0 ? void 0 : _a.ja) === 'string' || typeof ((_b = seat.name) === null || _b === void 0 ? void 0 : _b.en) === 'string') ? { name: seat.name } : undefined), (Array.isArray(seat.seatingType)) ? { seatingType: seat.seatingType } : undefined), (seat.maximumAttendeeCapacity === 0) ? { maximumAttendeeCapacity: seat.maximumAttendeeCapacity } : undefined)
262
251
  }
263
252
  }, {
264
253
  new: true,
265
254
  arrayFilters: [
266
255
  {
267
- 'screeningRoomSection.branchCode': { $eq: screeningRoomSection.branchCode },
256
+ 'screeningRoomSection.branchCode': { $eq: sectionCode },
268
257
  'screeningRoomSection.containsPlace.branchCode': { $ne: seat.branchCode }
269
258
  }
270
259
  ],
@@ -278,25 +267,131 @@ class SeatRepo {
278
267
  return doc.toObject();
279
268
  });
280
269
  }
281
- // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
282
- updateSeat(seat, $unset) {
270
+ /**
271
+ * コードをキーにして冪等追加
272
+ */
273
+ addSeatsByBranchCodeIfNotExist(params, options) {
283
274
  return __awaiter(this, void 0, void 0, function* () {
284
- var _a, _b, _c;
285
- const screeningRoomSection = seat.containedInPlace;
286
- if (typeof (screeningRoomSection === null || screeningRoomSection === void 0 ? void 0 : screeningRoomSection.branchCode) !== 'string') {
287
- throw new factory.errors.ArgumentNull('containedInPlace.branchCode');
275
+ const { project, parentOrganization, movieTheaterCode, roomCode, sectionCode } = options;
276
+ // 施設存在確認
277
+ const movieTheaterDoc = yield this.civicStructureModel.findOne(Object.assign({ typeOf: { $eq: factory.placeType.MovieTheater }, 'project.id': { $eq: project.id }, branchCode: { $eq: movieTheaterCode } }, (typeof (parentOrganization === null || parentOrganization === void 0 ? void 0 : parentOrganization.id) === 'string')
278
+ ? { 'parentOrganization.id': { $exists: true, $eq: parentOrganization.id } }
279
+ : undefined), { _id: 1 })
280
+ .lean()
281
+ .exec();
282
+ if (movieTheaterDoc === null) {
283
+ throw new factory.errors.NotFound(factory.placeType.MovieTheater);
288
284
  }
289
- const screeningRoom = screeningRoomSection.containedInPlace;
290
- if (typeof (screeningRoom === null || screeningRoom === void 0 ? void 0 : screeningRoom.branchCode) !== 'string') {
291
- throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.branchCode');
285
+ const bulkWriteOps = [];
286
+ if (Array.isArray(params)) {
287
+ // セクションの存在するドキュメントでフィルター
288
+ const filter = {
289
+ typeOf: { $eq: factory.placeType.ScreeningRoom },
290
+ 'project.id': { $eq: project.id },
291
+ 'containedInPlace.branchCode': { $exists: true, $eq: movieTheaterCode },
292
+ branchCode: { $eq: roomCode },
293
+ 'containsPlace.branchCode': { $eq: sectionCode }
294
+ };
295
+ params.forEach(({ $set }) => {
296
+ var _a, _b;
297
+ const setFields = __rest($set, []);
298
+ const pushingSeat = Object.assign(Object.assign(Object.assign(Object.assign({ typeOf: factory.placeType.Seat, branchCode: setFields.branchCode }, (typeof ((_a = setFields.name) === null || _a === void 0 ? void 0 : _a.ja) === 'string' || typeof ((_b = setFields.name) === null || _b === void 0 ? void 0 : _b.en) === 'string')
299
+ ? { name: setFields.name }
300
+ : undefined), (Array.isArray(setFields.seatingType)) ? { seatingType: setFields.seatingType } : undefined), (Array.isArray(setFields.additionalProperty)) ? { additionalProperty: setFields.additionalProperty } : undefined), (setFields.maximumAttendeeCapacity === 0)
301
+ ? { maximumAttendeeCapacity: setFields.maximumAttendeeCapacity }
302
+ : undefined);
303
+ const updateFilter = {
304
+ $push: { 'containsPlace.$[screeningRoomSection].containsPlace': pushingSeat }
305
+ };
306
+ const arrayFilters = [
307
+ {
308
+ 'screeningRoomSection.branchCode': { $eq: sectionCode }, // セクションに
309
+ 'screeningRoomSection.containsPlace.branchCode': { $ne: pushingSeat.branchCode } // 座席が存在しなければ
310
+ }
311
+ ];
312
+ const updateOne = {
313
+ filter,
314
+ update: updateFilter,
315
+ arrayFilters
316
+ };
317
+ bulkWriteOps.push({ updateOne });
318
+ });
292
319
  }
293
- const movieTheater = screeningRoom.containedInPlace;
294
- if (typeof (movieTheater === null || movieTheater === void 0 ? void 0 : movieTheater.branchCode) !== 'string') {
295
- throw new factory.errors.ArgumentNull('containedInPlace.containedInPlace.containedInPlace.branchCode');
320
+ if (bulkWriteOps.length > 0) {
321
+ const bulkWriteResult = yield this.placeModel.bulkWrite(bulkWriteOps, { ordered: false });
322
+ return { bulkWriteResult };
296
323
  }
297
- const doc = yield this.placeModel.findOneAndUpdate(Object.assign({ typeOf: { $eq: factory.placeType.ScreeningRoom }, 'project.id': { $eq: seat.project.id }, 'containedInPlace.branchCode': { $exists: true, $eq: movieTheater.branchCode }, branchCode: { $eq: screeningRoom.branchCode }, 'containsPlace.branchCode': { $eq: screeningRoomSection.branchCode }, 'containsPlace.containsPlace.branchCode': { $eq: seat.branchCode } }, (typeof ((_a = seat.parentOrganization) === null || _a === void 0 ? void 0 : _a.id) === 'string')
298
- ? { 'parentOrganization.id': { $exists: true, $eq: seat.parentOrganization.id } }
299
- : undefined), Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ 'containsPlace.$[screeningRoomSection].containsPlace.$[seat].branchCode': seat.branchCode }, (typeof ((_b = seat.name) === null || _b === void 0 ? void 0 : _b.ja) === 'string' || typeof ((_c = seat.name) === null || _c === void 0 ? void 0 : _c.en) === 'string')
324
+ });
325
+ }
326
+ /**
327
+ * コードをキーにして冪等編集
328
+ */
329
+ updateSeatsByBranchCode(params, options) {
330
+ return __awaiter(this, void 0, void 0, function* () {
331
+ const { project, parentOrganization, movieTheaterCode, roomCode, sectionCode } = options;
332
+ const bulkWriteOps = [];
333
+ if (Array.isArray(params)) {
334
+ params.forEach(({ $set, $unset }) => {
335
+ var _a, _b;
336
+ // 座席の存在するドキュメントでフィルター
337
+ 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: $set.branchCode } }, (typeof (parentOrganization === null || parentOrganization === void 0 ? void 0 : parentOrganization.id) === 'string')
338
+ ? { 'parentOrganization.id': { $exists: true, $eq: parentOrganization.id } }
339
+ : undefined);
340
+ const setFields = __rest($set, []);
341
+ const updateFilter = {
342
+ $set: Object.assign(Object.assign(Object.assign(Object.assign({ 'containsPlace.$[screeningRoomSection].containsPlace.$[seat].branchCode': setFields.branchCode }, (typeof ((_a = setFields.name) === null || _a === void 0 ? void 0 : _a.ja) === 'string' || typeof ((_b = setFields.name) === null || _b === void 0 ? void 0 : _b.en) === 'string')
343
+ ? {
344
+ 'containsPlace.$[screeningRoomSection].containsPlace.$[seat].name': setFields.name
345
+ }
346
+ : undefined), (Array.isArray(setFields.seatingType))
347
+ ? {
348
+ 'containsPlace.$[screeningRoomSection].containsPlace.$[seat].seatingType': setFields.seatingType
349
+ }
350
+ : undefined), (Array.isArray(setFields.additionalProperty))
351
+ ? {
352
+ // tslint:disable-next-line:max-line-length
353
+ 'containsPlace.$[screeningRoomSection].containsPlace.$[seat].additionalProperty': setFields.additionalProperty
354
+ }
355
+ : undefined), (setFields.maximumAttendeeCapacity === 0)
356
+ ? {
357
+ // tslint:disable-next-line:max-line-length
358
+ 'containsPlace.$[screeningRoomSection].containsPlace.$[seat].maximumAttendeeCapacity': setFields.maximumAttendeeCapacity
359
+ }
360
+ : undefined),
361
+ $unset: Object.assign(Object.assign(Object.assign({}, (($unset === null || $unset === void 0 ? void 0 : $unset.name) === 1)
362
+ ? { 'containsPlace.$[screeningRoomSection].containsPlace.$[seat].name': 1 }
363
+ : undefined), (($unset === null || $unset === void 0 ? void 0 : $unset.seatingType) === 1)
364
+ ? { 'containsPlace.$[screeningRoomSection].containsPlace.$[seat].seatingType': 1 }
365
+ : undefined), (($unset === null || $unset === void 0 ? void 0 : $unset.maximumAttendeeCapacity) === 1)
366
+ ? { 'containsPlace.$[screeningRoomSection].containsPlace.$[seat].maximumAttendeeCapacity': 1 }
367
+ : undefined)
368
+ };
369
+ const arrayFilters = [
370
+ { 'screeningRoomSection.branchCode': { $eq: sectionCode } },
371
+ { 'seat.branchCode': { $eq: setFields.branchCode } }
372
+ ];
373
+ const updateOne = {
374
+ filter,
375
+ update: updateFilter,
376
+ arrayFilters
377
+ };
378
+ bulkWriteOps.push({ updateOne });
379
+ });
380
+ }
381
+ if (bulkWriteOps.length > 0) {
382
+ const bulkWriteResult = yield this.placeModel.bulkWrite(bulkWriteOps, { ordered: false });
383
+ return { bulkWriteResult };
384
+ }
385
+ });
386
+ }
387
+ // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
388
+ updateSeatByBranchCode(seat, $unset, options) {
389
+ return __awaiter(this, void 0, void 0, function* () {
390
+ var _a, _b;
391
+ const { project, parentOrganization, movieTheaterCode, roomCode, sectionCode } = options;
392
+ const doc = yield this.placeModel.findOneAndUpdate(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: seat.branchCode } }, (typeof (parentOrganization === null || parentOrganization === void 0 ? void 0 : parentOrganization.id) === 'string')
393
+ ? { 'parentOrganization.id': { $exists: true, $eq: parentOrganization.id } }
394
+ : undefined), Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ 'containsPlace.$[screeningRoomSection].containsPlace.$[seat].branchCode': seat.branchCode }, (typeof ((_a = seat.name) === null || _a === void 0 ? void 0 : _a.ja) === 'string' || typeof ((_b = seat.name) === null || _b === void 0 ? void 0 : _b.en) === 'string')
300
395
  ? {
301
396
  'containsPlace.$[screeningRoomSection].containsPlace.$[seat].name': seat.name
302
397
  }
@@ -333,7 +428,7 @@ class SeatRepo {
333
428
  : undefined) }), {
334
429
  new: true,
335
430
  arrayFilters: [
336
- { 'screeningRoomSection.branchCode': { $eq: screeningRoomSection.branchCode } },
431
+ { 'screeningRoomSection.branchCode': { $eq: sectionCode } },
337
432
  { 'seat.branchCode': { $eq: seat.branchCode } }
338
433
  ],
339
434
  projection: { 'containedInPlace.id': 1, typeOf: 1 }
@@ -585,14 +680,49 @@ class SeatRepo {
585
680
  return (result !== undefined) ? result.seatingTypes : [];
586
681
  });
587
682
  }
588
- deleteSeat(seat) {
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
+ }
718
+ deleteSeatByBranchCode(seat, options) {
589
719
  return __awaiter(this, void 0, void 0, function* () {
590
- var _a;
591
- const doc = yield this.placeModel.findOneAndUpdate(Object.assign({ typeOf: { $eq: factory.placeType.ScreeningRoom }, 'project.id': { $eq: seat.project.id }, 'containedInPlace.branchCode': {
720
+ const { project, parentOrganization, movieTheaterCode, roomCode, sectionCode } = options;
721
+ const doc = yield this.placeModel.findOneAndUpdate(Object.assign({ typeOf: { $eq: factory.placeType.ScreeningRoom }, 'project.id': { $eq: project.id }, 'containedInPlace.branchCode': {
592
722
  $exists: true,
593
- $eq: seat.containedInPlace.containedInPlace.containedInPlace.branchCode
594
- }, branchCode: { $eq: seat.containedInPlace.containedInPlace.branchCode }, 'containsPlace.branchCode': { $eq: seat.containedInPlace.branchCode }, 'containsPlace.containsPlace.branchCode': { $eq: seat.branchCode } }, (typeof ((_a = seat.parentOrganization) === null || _a === void 0 ? void 0 : _a.id) === 'string')
595
- ? { 'parentOrganization.id': { $exists: true, $eq: seat.parentOrganization.id } }
723
+ $eq: movieTheaterCode
724
+ }, branchCode: { $eq: roomCode }, 'containsPlace.branchCode': { $eq: sectionCode }, 'containsPlace.containsPlace.branchCode': { $eq: seat.branchCode } }, (typeof (parentOrganization === null || parentOrganization === void 0 ? void 0 : parentOrganization.id) === 'string')
725
+ ? { 'parentOrganization.id': { $exists: true, $eq: parentOrganization.id } }
596
726
  : undefined), {
597
727
  $pull: {
598
728
  'containsPlace.$[screeningRoomSection].containsPlace': {
@@ -602,7 +732,7 @@ class SeatRepo {
602
732
  }, {
603
733
  new: true,
604
734
  arrayFilters: [
605
- { 'screeningRoomSection.branchCode': { $eq: seat.containedInPlace.branchCode } }
735
+ { 'screeningRoomSection.branchCode': { $eq: sectionCode } }
606
736
  ],
607
737
  projection: { 'containedInPlace.id': 1, typeOf: 1 }
608
738
  })
@@ -1,6 +1,18 @@
1
- import type { Connection } from 'mongoose';
1
+ import type { Connection, PipelineStage } from 'mongoose';
2
2
  import * as factory from '../../factory';
3
3
  type IScreeningRoomSectionWithoutContainsPlace = Omit<factory.place.screeningRoomSection.IPlace, 'containsPlace'>;
4
+ type ICreatingSection = Pick<factory.place.screeningRoomSection.IPlace, 'additionalProperty' | 'branchCode' | 'name'>;
5
+ type IMatchStage = PipelineStage.Match;
6
+ interface IUpdateOptions {
7
+ project: {
8
+ id: string;
9
+ };
10
+ parentOrganization?: {
11
+ id?: string;
12
+ };
13
+ movieTheaterCode: string;
14
+ roomCode: string;
15
+ }
4
16
  /**
5
17
  * セクション編集時レスポンス
6
18
  */
@@ -20,22 +32,34 @@ export declare class SectionRepo {
20
32
  private readonly civicStructureModel;
21
33
  private readonly placeModel;
22
34
  constructor(connection: Connection);
23
- createScreeningRoomSection(screeningRoomSection: IScreeningRoomSectionWithoutContainsPlace & {
24
- parentOrganization?: {
25
- id?: string;
35
+ static CREATE_SECTION_MONGO_CONDITIONS(searchConditions: Omit<factory.place.screeningRoomSection.ISearchConditions, '$projection' | 'limit' | 'page'>): IMatchStage[];
36
+ createSection(screeningRoomSection: ICreatingSection, options: IUpdateOptions): Promise<IUpdateSectionResult>;
37
+ /**
38
+ * セクションの名称と追加特性を編集する
39
+ */
40
+ updateSectionByBranchCode(screeningRoomSection: ICreatingSection, $unset: any, options: IUpdateOptions): Promise<IUpdateSectionResult>;
41
+ /**
42
+ * セクションの座席を上書きする
43
+ */
44
+ overwriteSeats(screeningRoomSection: Pick<factory.place.screeningRoomSection.IPlace, 'branchCode' | 'containsPlace'>, options: IUpdateOptions): Promise<IUpdateSectionResult>;
45
+ migrateSectionIdentifier(screeningRoomSection: {
46
+ project: {
47
+ id: string;
26
48
  };
27
- }): Promise<IUpdateSectionResult>;
28
- updateScreeningRoomSection(screeningRoomSection: Omit<factory.place.screeningRoomSection.IPlace, 'containedInPlace'> & {
49
+ identifier: string;
50
+ branchCode: string;
29
51
  containedInPlace: {
30
52
  branchCode: string;
31
53
  containedInPlace: {
32
54
  branchCode: string;
33
55
  };
34
56
  };
35
- parentOrganization?: {
36
- id?: string;
37
- };
38
- }, $unset: any): Promise<IUpdateSectionResult>;
57
+ }): Promise<IUpdateSectionResult>;
58
+ /**
59
+ * 最小限のprojectionでセクション検索を再定義
60
+ * 2026-01-08~
61
+ */
62
+ findSections(params: Omit<factory.place.screeningRoomSection.ISearchConditions, '$projection'>): Promise<Pick<factory.place.screeningRoomSection.IPlace, 'additionalProperty' | 'branchCode' | 'name'>[]>;
39
63
  searchScreeningRoomSections(searchConditions: factory.place.screeningRoomSection.ISearchConditions): Promise<IScreeningRoomSectionWithoutContainsPlace[]>;
40
64
  /**
41
65
  * ルーム指定のセクション検索として再定義(2025-12-07~)
@@ -57,29 +81,11 @@ export declare class SectionRepo {
57
81
  */
58
82
  roomCode: string;
59
83
  }): Promise<Pick<IScreeningRoomSectionWithoutContainsPlace, 'additionalProperty' | 'branchCode' | 'name'>[]>;
60
- deleteScreeningRoomSection(screeningRoomSection: {
61
- project: {
62
- id: string;
63
- };
64
- parentOrganization?: {
65
- id?: string;
66
- };
84
+ deleteSectionByBranchCode(screeningRoomSection: {
67
85
  /**
68
86
  * セクションコード
69
87
  */
70
88
  branchCode: string;
71
- containedInPlace: {
72
- /**
73
- * ルームコード
74
- */
75
- branchCode: string;
76
- containedInPlace: {
77
- /**
78
- * 施設コード
79
- */
80
- branchCode: string;
81
- };
82
- };
83
- }): Promise<IUpdateSectionResult>;
89
+ }, options: IUpdateOptions): Promise<IUpdateSectionResult>;
84
90
  }
85
91
  export {};