@chevre/domain 21.2.0 → 21.3.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.
@@ -49,7 +49,7 @@ export declare class MongoRepository {
49
49
  /**
50
50
  * 販売者検索
51
51
  */
52
- search(conditions: factory.seller.ISearchConditions, projection?: any): Promise<ISeller[]>;
52
+ search(conditions: factory.seller.ISearchConditions, inclusion: string[], exclusion: string[]): Promise<ISeller[]>;
53
53
  /**
54
54
  * 対応決済方法を検索する
55
55
  */
@@ -189,11 +189,32 @@ class MongoRepository {
189
189
  /**
190
190
  * 販売者検索
191
191
  */
192
- search(conditions, projection) {
192
+ search(conditions,
193
+ // inclusion化(2023-07-07~)
194
+ // projection?: any
195
+ inclusion, exclusion) {
193
196
  var _a;
194
197
  return __awaiter(this, void 0, void 0, function* () {
195
198
  const andConditions = MongoRepository.CREATE_MONGO_CONDITIONS(conditions);
196
- const query = this.organizationModel.find((andConditions.length > 0) ? { $and: andConditions } : {}, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection));
199
+ let projection = {};
200
+ if (Array.isArray(inclusion) && inclusion.length > 0) {
201
+ inclusion.forEach((field) => {
202
+ projection[field] = 1;
203
+ });
204
+ }
205
+ else {
206
+ projection = {
207
+ __v: 0,
208
+ createdAt: 0,
209
+ updatedAt: 0
210
+ };
211
+ if (Array.isArray(exclusion) && exclusion.length > 0) {
212
+ exclusion.forEach((field) => {
213
+ projection[field] = 0;
214
+ });
215
+ }
216
+ }
217
+ const query = this.organizationModel.find((andConditions.length > 0) ? { $and: andConditions } : {}, projection);
197
218
  if (typeof conditions.limit === 'number' && conditions.limit > 0) {
198
219
  const page = (typeof conditions.page === 'number' && conditions.page > 0) ? conditions.page : 1;
199
220
  query.limit(conditions.limit)
@@ -81,8 +81,7 @@ 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 } },
85
- useScreeningRoomType: settings_1.USE_READ_SCREENING_ROOM_TYPE
84
+ containedInPlace: { id: { $eq: movieTheaterId } }
86
85
  });
87
86
  // 予約集計
88
87
  const { maximumAttendeeCapacity, remainingAttendeeCapacity, aggregateReservation } = yield aggregateReservationByEvent({
@@ -236,7 +236,7 @@ function searchEventSeatOffers(params) {
236
236
  }
237
237
  },
238
238
  $projection: params.$projection
239
- }, settings_1.USE_READ_SCREENING_ROOM_TYPE);
239
+ });
240
240
  if (seats.length > 0) {
241
241
  const availabilities = yield repos.stockHolder.searchHolders({
242
242
  project: { id: params.event.project.id },
@@ -21,7 +21,6 @@ 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");
25
24
  const offer_1 = require("./offer");
26
25
  const debug = createDebug('chevre-domain:service:event');
27
26
  const coaAuthClient = new COA.auth.RefreshToken({
@@ -94,7 +93,7 @@ function importFromCOA(params) {
94
93
  limit: 1,
95
94
  page: 1,
96
95
  branchCode: { $eq: params.locationBranchCode }
97
- });
96
+ }, ['_id'], []);
98
97
  const seller = sellersWithSameBranchCode.shift();
99
98
  if (typeof (seller === null || seller === void 0 ? void 0 : seller.id) !== 'string') {
100
99
  throw new factory.errors.NotFound('Seller', `Seller with branchCod '${params.locationBranchCode}' not found`);
@@ -121,7 +120,7 @@ function importFromCOA(params) {
121
120
  }
122
121
  const screeningRooms = yield repos.place.searchScreeningRooms({
123
122
  containedInPlace: { branchCode: { $eq: movieTheater.branchCode } }
124
- }, settings_1.USE_READ_SCREENING_ROOM_TYPE);
123
+ });
125
124
  const targetImportFrom = moment(`${moment(params.importFrom)
126
125
  .tz('Asia/Tokyo')
127
126
  .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
- } }), settings_1.USE_READ_SCREENING_ROOM_TYPE);
91
+ } }));
92
92
  if (seats.length > 0) {
93
93
  const availabilities = yield repos.stockHolder.searchHolders({
94
94
  project: { id: event.project.id },
@@ -261,7 +261,7 @@ function createInformMovieTheaterTasks(params) {
261
261
  // ルームを検索
262
262
  const screeningRooms = yield repos.place.searchScreeningRooms({
263
263
  containedInPlace: { id: { $eq: movieTheater.id } }
264
- }, settings_1.USE_READ_SCREENING_ROOM_TYPE);
264
+ });
265
265
  const movieTheaters4inform = [Object.assign(Object.assign({}, movieTheater), { containsPlace: screeningRooms.map((room) => {
266
266
  return {
267
267
  branchCode: room.branchCode,
@@ -11,14 +11,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.call = void 0;
13
13
  const place_1 = require("../../repo/place");
14
- const settings_1 = require("../../settings");
15
14
  /**
16
15
  * タスク実行関数
17
16
  */
18
17
  function call(data) {
19
18
  return (connectionSettings) => __awaiter(this, void 0, void 0, function* () {
20
19
  const placeRepo = new place_1.MongoRepository(connectionSettings.connection);
21
- yield placeRepo.syncScreeningRooms({ id: data.id, useScreeningRoomType: settings_1.USE_WRITE_SCREENING_ROOM_TYPE });
20
+ yield placeRepo.syncScreeningRooms({ id: data.id });
22
21
  });
23
22
  }
24
23
  exports.call = call;
@@ -41,8 +41,6 @@ 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;
46
44
  export declare const INFORM_RESERVATION_TASK_DELAY_IN_SECONDS: number;
47
45
  export declare const MONGO_MAX_TIME_MS: number;
48
46
  /**
@@ -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_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;
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;
4
4
  const moment = require("moment");
5
5
  const factory = require("./factory");
6
6
  const transactionWebhookUrls = (typeof process.env.INFORM_TRANSACTION_URL === 'string')
@@ -71,8 +71,6 @@ 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';
76
74
  exports.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS = (typeof process.env.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS === 'string')
77
75
  ? Number(process.env.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS)
78
76
  : 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"
120
+ "version": "21.3.0"
121
121
  }