@chevre/domain 21.2.0-alpha.143 → 21.2.0-alpha.145

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.
@@ -81,13 +81,14 @@ function aggregateByEvent(params) {
81
81
  }
82
82
  const screeningRoom = yield repos.place.findScreeningRoomsByBranchCode({
83
83
  branchCode: { $eq: event.location.branchCode },
84
- containedInPlace: { id: { $eq: movieTheaterId } }
84
+ containedInPlace: { id: { $eq: movieTheaterId } },
85
+ useScreeningRoomType: settings_1.USE_READ_SCREENING_ROOM_TYPE
85
86
  });
86
87
  // 予約集計
87
88
  const { maximumAttendeeCapacity, remainingAttendeeCapacity, aggregateReservation } = yield aggregateReservationByEvent({
88
89
  aggregateDate: now,
89
90
  event: event,
90
- screeningRoom: screeningRoom
91
+ screeningRoom
91
92
  })(repos);
92
93
  // オファーごとの集計
93
94
  let aggregateOffer;
@@ -429,10 +430,15 @@ function aggregateReservationByEvent(params) {
429
430
  }
430
431
  const hasTicketedSeat = reservedSeatsAvailable({ event: params.event });
431
432
  if (hasTicketedSeat) {
432
- const screeningRoomSeatCount = (Array.isArray(params.screeningRoom.containsPlace))
433
- // b.containsPlaceがundefinedの場合があるので注意(座席未登録)
434
- ? params.screeningRoom.containsPlace.reduce((a, b) => a + ((Array.isArray(b.containsPlace)) ? b.containsPlace.length : 0), 0)
435
- : 0;
433
+ // seatCountを利用する(2023-06-24~)
434
+ const screeningRoomSeatCount = (typeof params.screeningRoom.seatCount === 'number') ? params.screeningRoom.seatCount : 0;
435
+ // const screeningRoomSeatCount = (Array.isArray(params.screeningRoom.containsPlace))
436
+ // // b.containsPlaceがundefinedの場合があるので注意(座席未登録)
437
+ // ? params.screeningRoom.containsPlace.reduce(
438
+ // (a, b) => a + ((Array.isArray(b.containsPlace)) ? b.containsPlace.length : 0),
439
+ // 0
440
+ // )
441
+ // : 0;
436
442
  maximumAttendeeCapacity = screeningRoomSeatCount;
437
443
  // イベントのキャパシティ設定がスクリーン座席数より小さければmaximumAttendeeCapacityを上書き
438
444
  if (typeof eventLocationMaximumAttendeeCapacity === 'number' && eventLocationMaximumAttendeeCapacity < screeningRoomSeatCount) {
@@ -236,7 +236,7 @@ function searchEventSeatOffers(params) {
236
236
  }
237
237
  },
238
238
  $projection: params.$projection
239
- });
239
+ }, settings_1.USE_READ_SCREENING_ROOM_TYPE);
240
240
  if (seats.length > 0) {
241
241
  const availabilities = yield repos.stockHolder.searchHolders({
242
242
  project: { id: params.event.project.id },
@@ -21,6 +21,7 @@ const difference = require("lodash.difference");
21
21
  const moment = require("moment-timezone");
22
22
  const credentials_1 = require("../credentials");
23
23
  const factory = require("../factory");
24
+ const settings_1 = require("../settings");
24
25
  const offer_1 = require("./offer");
25
26
  const debug = createDebug('chevre-domain:service:event');
26
27
  const coaAuthClient = new COA.auth.RefreshToken({
@@ -120,7 +121,7 @@ function importFromCOA(params) {
120
121
  }
121
122
  const screeningRooms = yield repos.place.searchScreeningRooms({
122
123
  containedInPlace: { branchCode: { $eq: movieTheater.branchCode } }
123
- });
124
+ }, settings_1.USE_READ_SCREENING_ROOM_TYPE);
124
125
  const targetImportFrom = moment(`${moment(params.importFrom)
125
126
  .tz('Asia/Tokyo')
126
127
  .format('YYYY-MM-DD')}T00:00:00+09:00`);
@@ -88,7 +88,7 @@ function searchEventSeatOffersWithPaging(params) {
88
88
  branchCode: { $eq: movieTheaterBranchCode }
89
89
  }
90
90
  }
91
- } }));
91
+ } }), settings_1.USE_READ_SCREENING_ROOM_TYPE);
92
92
  if (seats.length > 0) {
93
93
  const availabilities = yield repos.stockHolder.searchHolders({
94
94
  project: { id: event.project.id },
@@ -252,11 +252,6 @@ function createInformMovieTheaterTasks(params) {
252
252
  'telephone',
253
253
  'url',
254
254
  'typeOf'
255
- // 'containsPlace.branchCode',
256
- // 'containsPlace.name',
257
- // 'containsPlace.typeOf',
258
- // 'containsPlace.additionalProperty',
259
- // 'containsPlace.address'
260
255
  ], []);
261
256
  const movieTheater = movieTheaters.shift();
262
257
  if (movieTheater === undefined) {
@@ -265,7 +260,7 @@ function createInformMovieTheaterTasks(params) {
265
260
  // ルームを検索
266
261
  const screeningRooms = yield repos.place.searchScreeningRooms({
267
262
  containedInPlace: { id: { $eq: movieTheater.id } }
268
- });
263
+ }, settings_1.USE_READ_SCREENING_ROOM_TYPE);
269
264
  const movieTheaters4inform = [Object.assign(Object.assign({}, movieTheater), { containsPlace: screeningRooms.map((room) => {
270
265
  return {
271
266
  branchCode: room.branchCode,
@@ -41,6 +41,8 @@ export declare const USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
41
41
  export declare const USE_NEW_EVENT_AVAILABILITY_KEY_FROM: moment.Moment;
42
42
  export declare const USE_NEW_STOCK_HOLDER_REPO_FROM: moment.Moment;
43
43
  export declare const USE_NEW_STOCK_HOLDER_REPO_IDS: string[];
44
+ export declare const USE_READ_SCREENING_ROOM_TYPE: boolean;
45
+ export declare const USE_WRITE_SCREENING_ROOM_TYPE: boolean;
44
46
  export declare const INFORM_RESERVATION_TASK_DELAY_IN_SECONDS: number;
45
47
  export declare const MONGO_MAX_TIME_MS: number;
46
48
  /**
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.settings = exports.MONGO_MAX_TIME_MS = exports.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS = exports.USE_NEW_STOCK_HOLDER_REPO_IDS = exports.USE_NEW_STOCK_HOLDER_REPO_FROM = exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = exports.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS = exports.ABORTED_TASKS_WITHOUT_REPORT = exports.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS = exports.TRIGGER_WEBHOOK_MAX_RETRY_COUNT = void 0;
3
+ exports.settings = exports.MONGO_MAX_TIME_MS = exports.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS = exports.USE_WRITE_SCREENING_ROOM_TYPE = exports.USE_READ_SCREENING_ROOM_TYPE = exports.USE_NEW_STOCK_HOLDER_REPO_IDS = exports.USE_NEW_STOCK_HOLDER_REPO_FROM = exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = exports.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS = exports.ABORTED_TASKS_WITHOUT_REPORT = exports.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS = exports.TRIGGER_WEBHOOK_MAX_RETRY_COUNT = void 0;
4
4
  const moment = require("moment");
5
5
  const factory = require("./factory");
6
6
  const transactionWebhookUrls = (typeof process.env.INFORM_TRANSACTION_URL === 'string')
@@ -71,6 +71,8 @@ exports.USE_NEW_STOCK_HOLDER_REPO_FROM = (typeof process.env.USE_NEW_STOCK_HOLDE
71
71
  exports.USE_NEW_STOCK_HOLDER_REPO_IDS = (typeof process.env.USE_NEW_STOCK_HOLDER_REPO_IDS === 'string')
72
72
  ? process.env.USE_NEW_STOCK_HOLDER_REPO_IDS.split(' ')
73
73
  : [];
74
+ exports.USE_READ_SCREENING_ROOM_TYPE = process.env.USE_READ_SCREENING_ROOM_TYPE === '1';
75
+ exports.USE_WRITE_SCREENING_ROOM_TYPE = process.env.USE_WRITE_SCREENING_ROOM_TYPE === '1';
74
76
  exports.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS = (typeof process.env.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS === 'string')
75
77
  ? Number(process.env.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS)
76
78
  : 0;
package/package.json CHANGED
@@ -117,5 +117,5 @@
117
117
  "postversion": "git push origin --tags",
118
118
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
119
119
  },
120
- "version": "21.2.0-alpha.143"
120
+ "version": "21.2.0-alpha.145"
121
121
  }