@chevre/domain 22.5.0-alpha.9 → 22.5.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 (155) hide show
  1. package/example/src/chevre/activateOptionalAggregationSettings.ts +19 -0
  2. package/example/src/chevre/aggregateAllEvents2.ts +7 -5
  3. package/example/src/chevre/aggregateEventPublicFields.ts +47 -0
  4. package/example/src/chevre/aggregateEventSellerMakesOffer.ts +32 -0
  5. package/example/src/chevre/findReservationByCode.ts +11 -10
  6. package/example/src/chevre/migrateEventSellerMakesOfferAvailableAt.ts +101 -0
  7. package/example/src/chevre/migrateProjectMakesOfferAvailableAt.ts +85 -0
  8. package/example/src/chevre/person/cleanUpCognitoUsers.ts +90 -0
  9. package/example/src/chevre/searchCategoryCodesByAggregate.ts +1 -2
  10. package/example/src/chevre/searchProjects.ts +2 -4
  11. package/example/src/chevre/searchSellersByAggregate.ts +4 -6
  12. package/example/src/chevre/unsetUnnecessaryFields.ts +17 -19
  13. package/example/src/chevre/upsertManyEventsByAdditionalProperty.ts +25 -14
  14. package/example/src/chevre/upsertProductsByProductId.ts +1 -1
  15. package/example/src/createMongooseConnection.ts +26 -0
  16. package/lib/chevre/repo/action.d.ts +41 -41
  17. package/lib/chevre/repo/action.js +5 -39
  18. package/lib/chevre/repo/assetTransaction.d.ts +1 -1
  19. package/lib/chevre/repo/categoryCode.d.ts +4 -8
  20. package/lib/chevre/repo/categoryCode.js +8 -36
  21. package/lib/chevre/repo/creativeWork.js +1 -20
  22. package/lib/chevre/repo/customer.d.ts +1 -1
  23. package/lib/chevre/repo/customer.js +4 -4
  24. package/lib/chevre/repo/event.d.ts +21 -12
  25. package/lib/chevre/repo/event.js +135 -37
  26. package/lib/chevre/repo/eventSellerMakesOffer.d.ts +54 -0
  27. package/lib/chevre/repo/eventSellerMakesOffer.js +73 -0
  28. package/lib/chevre/repo/mongoose/schemas/aggregateReservation.js +0 -3
  29. package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +0 -3
  30. package/lib/chevre/repo/mongoose/schemas/categoryCode.js +0 -3
  31. package/lib/chevre/repo/mongoose/schemas/creativeWork.js +0 -3
  32. package/lib/chevre/repo/mongoose/schemas/customer.js +0 -3
  33. package/lib/chevre/repo/mongoose/schemas/event.js +9 -54
  34. package/lib/chevre/repo/mongoose/schemas/member.js +0 -3
  35. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +0 -3
  36. package/lib/chevre/repo/mongoose/schemas/paymentService.js +0 -3
  37. package/lib/chevre/repo/mongoose/schemas/priceSpecification.js +0 -3
  38. package/lib/chevre/repo/mongoose/schemas/productModel.js +0 -3
  39. package/lib/chevre/repo/mongoose/schemas/project.js +0 -3
  40. package/lib/chevre/repo/mongoose/schemas/reservation.js +0 -3
  41. package/lib/chevre/repo/mongoose/schemas/seller.js +0 -3
  42. package/lib/chevre/repo/mongoose/schemas/trip.js +0 -3
  43. package/lib/chevre/repo/paymentService.d.ts +1 -1
  44. package/lib/chevre/repo/paymentService.js +0 -19
  45. package/lib/chevre/repo/place/movieTheater.js +1 -25
  46. package/lib/chevre/repo/product.js +1 -6
  47. package/lib/chevre/repo/project.d.ts +8 -2
  48. package/lib/chevre/repo/project.js +25 -26
  49. package/lib/chevre/repo/projectMakesOffer.d.ts +3 -1
  50. package/lib/chevre/repo/projectMakesOffer.js +5 -2
  51. package/lib/chevre/repo/role.js +0 -7
  52. package/lib/chevre/repo/seller.d.ts +18 -16
  53. package/lib/chevre/repo/seller.js +13 -31
  54. package/lib/chevre/repo/task.d.ts +12 -12
  55. package/lib/chevre/repo/transaction.d.ts +1 -1
  56. package/lib/chevre/repository.d.ts +5 -0
  57. package/lib/chevre/repository.js +15 -2
  58. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.d.ts +4 -18
  59. package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +28 -13
  60. package/lib/chevre/service/aggregation/project.js +1 -2
  61. package/lib/chevre/service/assetTransaction/cancelReservation.js +2 -4
  62. package/lib/chevre/service/assetTransaction/registerService.js +1 -2
  63. package/lib/chevre/service/assetTransaction/reserve/start.d.ts +2 -1
  64. package/lib/chevre/service/assetTransaction/reserve/start.js +11 -38
  65. package/lib/chevre/service/assetTransaction/reserve/validateStartRequest.js +4 -1
  66. package/lib/chevre/service/event.js +2 -2
  67. package/lib/chevre/service/moneyTransfer.js +1 -2
  68. package/lib/chevre/service/notification.d.ts +2 -4
  69. package/lib/chevre/service/notification.js +30 -9
  70. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +2 -1
  71. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.js +2 -2
  72. package/lib/chevre/service/offer/event/authorize.d.ts +2 -1
  73. package/lib/chevre/service/offer/event/authorize.js +2 -2
  74. package/lib/chevre/service/offer/event/importFromCOA.js +2 -2
  75. package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +1 -30
  76. package/lib/chevre/service/offer/event/searchEventTicketOffers.js +21 -113
  77. package/lib/chevre/service/offer/event/searchOfferAppliesToMovieTicket.d.ts +38 -0
  78. package/lib/chevre/service/offer/event/searchOfferAppliesToMovieTicket.js +97 -0
  79. package/lib/chevre/service/offer/event/searchOffersByIds.js +26 -20
  80. package/lib/chevre/service/offer/event.d.ts +2 -1
  81. package/lib/chevre/service/offer/event.js +2 -1
  82. package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +3 -3
  83. package/lib/chevre/service/offer/eventServiceByCOA/authorizeByAcceptAction.js +1 -1
  84. package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +4 -4
  85. package/lib/chevre/service/offer/onEventChanged.d.ts +1 -13
  86. package/lib/chevre/service/offer/onEventChanged.js +64 -71
  87. package/lib/chevre/service/offer.d.ts +6 -0
  88. package/lib/chevre/service/offer.js +12 -15
  89. package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +1 -1
  90. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.js +7 -8
  91. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +1 -1
  92. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.js +7 -8
  93. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +8 -11
  94. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +1 -1
  95. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.js +7 -8
  96. package/lib/chevre/service/order/onOrderUpdated/factory.d.ts +1 -4
  97. package/lib/chevre/service/order/onOrderUpdated/factory.js +4 -7
  98. package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +2 -2
  99. package/lib/chevre/service/order/placeOrder.js +1 -1
  100. package/lib/chevre/service/payment/any/handlePrePublishedPaymentMethodIdOnAuthorizing.js +1 -1
  101. package/lib/chevre/service/payment/any.js +1 -1
  102. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.d.ts +1 -1
  103. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.js +0 -3
  104. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard3ds.d.ts +1 -1
  105. package/lib/chevre/service/payment/creditCard/searchGMOTrade.d.ts +1 -1
  106. package/lib/chevre/service/payment/creditCard/voidTransaction.js +1 -1
  107. package/lib/chevre/service/payment/movieTicket/refundMovieTicket.js +50 -57
  108. package/lib/chevre/service/payment/movieTicket/validation.js +1 -1
  109. package/lib/chevre/service/payment/paymentCard.js +0 -5
  110. package/lib/chevre/service/payment.d.ts +1 -1
  111. package/lib/chevre/service/report/telemetry.js +1 -1
  112. package/lib/chevre/service/reserve/cancelReservation.d.ts +1 -1
  113. package/lib/chevre/service/reserve/cancelReservation.js +14 -6
  114. package/lib/chevre/service/reserve/confirmReservation.js +1 -1
  115. package/lib/chevre/service/reserve/factory.d.ts +2 -61
  116. package/lib/chevre/service/reserve/factory.js +0 -11
  117. package/lib/chevre/service/reserve/findByCode.js +0 -1
  118. package/lib/chevre/service/reserve/potentialActions/onPendingReservationCanceled.d.ts +19 -0
  119. package/lib/chevre/service/reserve/potentialActions/onPendingReservationCanceled.js +64 -0
  120. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +0 -4
  121. package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +37 -61
  122. package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +22 -76
  123. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +26 -28
  124. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.d.ts +0 -3
  125. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +17 -50
  126. package/lib/chevre/service/reserve/potentialActions/onReservationsCreated.d.ts +18 -0
  127. package/lib/chevre/service/reserve/potentialActions/onReservationsCreated.js +66 -0
  128. package/lib/chevre/service/reserve/useReservation.d.ts +1 -1
  129. package/lib/chevre/service/reserve/useReservation.js +4 -4
  130. package/lib/chevre/service/reserve/verifyToken4reservation.d.ts +0 -7
  131. package/lib/chevre/service/reserve/verifyToken4reservation.js +17 -12
  132. package/lib/chevre/service/task/aggregateScreeningEvent.js +4 -2
  133. package/lib/chevre/service/task/aggregateUseActionsOnEvent.d.ts +1 -1
  134. package/lib/chevre/service/task/aggregateUseActionsOnEvent.js +1 -5
  135. package/lib/chevre/service/task/deletePerson.d.ts +6 -0
  136. package/lib/chevre/service/task/deletePerson.js +420 -0
  137. package/lib/chevre/service/task/handleNotification.d.ts +3 -0
  138. package/lib/chevre/service/task/handleNotification.js +26 -0
  139. package/lib/chevre/service/task/onResourceUpdated/syncCategoryCode.js +1 -1
  140. package/lib/chevre/service/task/onResourceUpdated.js +1 -1
  141. package/lib/chevre/service/task/triggerWebhook.js +2 -2
  142. package/lib/chevre/service/task.d.ts +3 -0
  143. package/lib/chevre/service/task.js +2 -0
  144. package/lib/chevre/service/transaction/moneyTransfer.js +1 -1
  145. package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +1 -3
  146. package/lib/chevre/service/transaction/placeOrder/start/validateStartRequest.js +4 -2
  147. package/lib/chevre/service/transaction/returnOrder/preStart.js +4 -3
  148. package/lib/chevre/settings/aggregation.d.ts +23 -0
  149. package/lib/chevre/settings/aggregation.js +17 -0
  150. package/lib/chevre/settings.d.ts +52 -38
  151. package/lib/chevre/settings.js +12 -13
  152. package/package.json +5 -7
  153. package/example/src/chevre/migratePayTransactionRecipes.ts +0 -252
  154. package/example/src/chevre/migrateProductHasOfferCatalog.ts +0 -80
  155. package/example/src/chevre/migrateProjectMakesOffer.ts +0 -78
@@ -174,9 +174,7 @@ class ProductRepo {
174
174
  /**
175
175
  * プロダクトを検索する
176
176
  */
177
- projectFields(conditions, inclusion
178
- // exclusion: IKeyOfProjection[] // discontinue(2024-09-28~)
179
- ) {
177
+ projectFields(conditions, inclusion) {
180
178
  var _a;
181
179
  return __awaiter(this, void 0, void 0, function* () {
182
180
  const andConditions = ProductRepo.CREATE_MONGO_CONDITIONS(conditions);
@@ -186,9 +184,6 @@ class ProductRepo {
186
184
  }
187
185
  else {
188
186
  throw new factory.errors.ArgumentNull('inclusion', 'inclusion must be specified');
189
- // if (Array.isArray(exclusion) && exclusion.length > 0) {
190
- // positiveProjectionFields = positiveProjectionFields.filter((key) => !exclusion.includes(key));
191
- // }
192
187
  }
193
188
  const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
194
189
  const query = this.productModel.find((andConditions.length > 0) ? { $and: andConditions } : {}, projection);
@@ -36,7 +36,6 @@ export declare class ProjectRepo {
36
36
  findById(params: {
37
37
  id: string;
38
38
  inclusion: IKeyOfProjection[];
39
- exclusion: IKeyOfProjection[];
40
39
  }): Promise<factory.project.IProject>;
41
40
  findAlternateNameById(params: {
42
41
  id: string;
@@ -44,7 +43,7 @@ export declare class ProjectRepo {
44
43
  /**
45
44
  * プロジェクト検索
46
45
  */
47
- projectFields(conditions: factory.project.ISearchConditions, inclusion: IKeyOfProjection[], exclusion: IKeyOfProjection[]): Promise<factory.project.IProject[]>;
46
+ projectFields(conditions: factory.project.ISearchConditions, inclusion: IKeyOfProjection[]): Promise<factory.project.IProject[]>;
48
47
  createById(params: factory.project.IProject): Promise<Pick<factory.project.IProject, 'id'>>;
49
48
  updateById(params: {
50
49
  id: string;
@@ -61,6 +60,13 @@ export declare class ProjectRepo {
61
60
  useEventServiceAsProduct?: boolean;
62
61
  };
63
62
  }): Promise<void>;
63
+ updateMakesOfferById(params: {
64
+ id: string;
65
+ makesOffer: factory.project.IMakesOffer[];
66
+ }): Promise<void>;
67
+ activateOptionalAggregationSettings(params: {
68
+ id: string;
69
+ }): Promise<void>;
64
70
  updateAggregateReservation(params: {
65
71
  id: string;
66
72
  aggregateReservation?: any;
@@ -69,7 +69,7 @@ class ProjectRepo {
69
69
  limit: 1,
70
70
  page: 1,
71
71
  id: { $eq: params.id }
72
- }, params.inclusion, params.exclusion)).shift();
72
+ }, params.inclusion)).shift();
73
73
  if (project === undefined) {
74
74
  throw new factory.errors.NotFound(this.projectModel.modelName);
75
75
  }
@@ -90,7 +90,7 @@ class ProjectRepo {
90
90
  /**
91
91
  * プロジェクト検索
92
92
  */
93
- projectFields(conditions, inclusion, exclusion) {
93
+ projectFields(conditions, inclusion) {
94
94
  var _a;
95
95
  return __awaiter(this, void 0, void 0, function* () {
96
96
  const andConditions = ProjectRepo.CREATE_MONGO_CONDITIONS(conditions);
@@ -99,31 +99,10 @@ class ProjectRepo {
99
99
  positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
100
100
  }
101
101
  else {
102
- if (Array.isArray(exclusion) && exclusion.length > 0) {
103
- positiveProjectionFields = positiveProjectionFields.filter((key) => !exclusion.includes(key));
104
- }
102
+ // discontinue(2024-10-09~)
103
+ throw new factory.errors.ArgumentNull('inclusion', 'inclusion must be specified');
105
104
  }
106
105
  const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
107
- // let projection: { [key: string]: number } = {};
108
- // if (Array.isArray(inclusion) && inclusion.length > 0) {
109
- // inclusion.forEach((field) => {
110
- // if (String(field) !== 'makesOffer') {
111
- // projection[field] = 1;
112
- // }
113
- // });
114
- // } else {
115
- // projection = {
116
- // __v: 0,
117
- // createdAt: 0,
118
- // updatedAt: 0,
119
- // makesOffer: 0
120
- // };
121
- // if (Array.isArray(exclusion) && exclusion.length > 0) {
122
- // exclusion.forEach((field) => {
123
- // projection[field] = 0;
124
- // });
125
- // }
126
- // }
127
106
  const query = this.projectModel.find((andConditions.length > 0) ? { $and: andConditions } : {}, projection);
128
107
  if (typeof conditions.limit === 'number' && conditions.limit > 0) {
129
108
  const page = (typeof conditions.page === 'number' && conditions.page > 0) ? conditions.page : 1;
@@ -161,7 +140,7 @@ class ProjectRepo {
161
140
  hasMerchantReturnPolicy = Object.assign({ sameAs: params.hasMerchantReturnPolicy.sameAs, typeOf: 'MerchantReturnPolicy' }, (typeof params.hasMerchantReturnPolicy.identifier === 'string')
162
141
  ? { identifier: params.hasMerchantReturnPolicy.identifier } : undefined);
163
142
  }
164
- yield this.projectModel.findOneAndUpdate({ _id: params.id }, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ updatedAt: new Date() }, (typeof params.alternateName === 'string' && params.alternateName.length > 0)
143
+ yield this.projectModel.findOneAndUpdate({ _id: { $eq: params.id } }, Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (typeof params.alternateName === 'string' && params.alternateName.length > 0)
165
144
  ? { alternateName: params.alternateName }
166
145
  : undefined), (typeof params.name === 'string' && params.name.length > 0) ? { name: params.name } : undefined), (typeof params.logo === 'string' && params.logo.length > 0) ? { logo: params.logo } : undefined), (typeof ((_d = (_c = (_b = params.settings) === null || _b === void 0 ? void 0 : _b.sendEmailMessage) === null || _c === void 0 ? void 0 : _c.sender) === null || _d === void 0 ? void 0 : _d.email) === 'string')
167
146
  ? {
@@ -181,6 +160,26 @@ class ProjectRepo {
181
160
  .exec();
182
161
  });
183
162
  }
163
+ updateMakesOfferById(params) {
164
+ return __awaiter(this, void 0, void 0, function* () {
165
+ yield this.projectModel.findOneAndUpdate({ _id: { $eq: params.id } }, {
166
+ $set: { makesOffer: params.makesOffer }
167
+ }, { projection: { _id: 1 } })
168
+ .exec();
169
+ });
170
+ }
171
+ activateOptionalAggregationSettings(params) {
172
+ return __awaiter(this, void 0, void 0, function* () {
173
+ yield this.projectModel.findOneAndUpdate({ _id: { $eq: params.id } }, {
174
+ $set: {
175
+ 'settings.useAggregateEntranceGate': true,
176
+ 'settings.useAggregateOffer': true,
177
+ 'settings.useOfferRateLimit': true
178
+ }
179
+ }, { projection: { _id: 1 } })
180
+ .exec();
181
+ });
182
+ }
184
183
  updateAggregateReservation(params) {
185
184
  return __awaiter(this, void 0, void 0, function* () {
186
185
  yield this.projectModel.findOneAndUpdate({ _id: { $eq: params.id } }, {
@@ -1,6 +1,8 @@
1
1
  import { Connection } from 'mongoose';
2
2
  import * as factory from '../factory';
3
- type IMakesOffer = factory.project.IMakesOffer;
3
+ type IMakesOffer = Pick<factory.project.IMakesOffer, 'eligibleCustomerType' | 'typeOf'> & {
4
+ availableAtOrFrom: Pick<factory.offer.IAvailableAtOrFrom, 'id'>;
5
+ };
4
6
  /**
5
7
  * プロジェクト提供オファーリポジトリ
6
8
  */
@@ -69,7 +69,8 @@ class ProjectMakesOfferRepo {
69
69
  }
70
70
  const creatingMakesOffer = {
71
71
  typeOf: factory.offerType.Offer,
72
- availableAtOrFrom: [{ id: params.availableAtOrFrom.id }]
72
+ // availableAtOrFrom: [{ id: params.availableAtOrFrom.id }]
73
+ availableAtOrFrom: { id: params.availableAtOrFrom.id } // support non-array(2024-10-22~)
73
74
  };
74
75
  doc = yield this.projectModel.findOneAndUpdate({
75
76
  _id: { $eq: params.offeredBy.id },
@@ -87,7 +88,9 @@ class ProjectMakesOfferRepo {
87
88
  }
88
89
  updateOne(params) {
89
90
  return __awaiter(this, void 0, void 0, function* () {
90
- const updatingMakesOffer = Object.assign({ typeOf: factory.offerType.Offer, availableAtOrFrom: [{ id: params.availableAtOrFrom.id }] }, (Array.isArray(params.eligibleCustomerType))
91
+ const updatingMakesOffer = Object.assign({ typeOf: factory.offerType.Offer,
92
+ // availableAtOrFrom: [{ id: params.availableAtOrFrom.id }],
93
+ availableAtOrFrom: { id: params.availableAtOrFrom.id } }, (Array.isArray(params.eligibleCustomerType))
91
94
  ? {
92
95
  eligibleCustomerType: params.eligibleCustomerType.map(({ codeValue }) => ({
93
96
  codeValue,
@@ -44,13 +44,6 @@ class RoleRepo {
44
44
  return __awaiter(this, void 0, void 0, function* () {
45
45
  const conditions = RoleRepo.CREATE_MONGO_CONDITIONS(params);
46
46
  const positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
47
- // if (Array.isArray(inclusion) && inclusion.length > 0) {
48
- // positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
49
- // } else {
50
- // if (Array.isArray(exclusion) && exclusion.length > 0) {
51
- // positiveProjectionFields = positiveProjectionFields.filter((key) => !exclusion.includes(key));
52
- // }
53
- // }
54
47
  const projection = Object.assign({ _id: 0 }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
55
48
  const query = this.roleModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
56
49
  if (typeof params.limit === 'number' && params.limit > 0) {
@@ -33,7 +33,9 @@ interface IUnset {
33
33
  [key: string]: 1;
34
34
  };
35
35
  }
36
- type ISellerByAggregate = Pick<ISellerWithId, 'additionalProperty' | 'branchCode' | 'hasMerchantReturnPolicy' | 'id' | 'name' | 'project' | 'telephone' | 'typeOf' | 'url'>;
36
+ type ISellerByAggregate = Pick<ISellerWithId, 'additionalProperty' | 'branchCode' | 'id' | 'name' | 'project' | 'telephone' | 'typeOf' | 'url'> & {
37
+ hasMerchantReturnPolicy?: Pick<factory.seller.ISellerMerchantReturnPolicy, 'typeOf' | 'url'>[];
38
+ };
37
39
  interface IMemberSearchConditions {
38
40
  /**
39
41
  * 販売者メンバーで絞る場合
@@ -56,7 +58,7 @@ export declare class SellerRepo {
56
58
  private readonly sellerModel;
57
59
  constructor(connection: Connection);
58
60
  static CREATE_MONGO_CONDITIONS(params: factory.seller.ISearchConditions & IMemberSearchConditions): FilterQuery<factory.seller.ISeller>[];
59
- static CREATE_AGGREGATE_SELLERS_PROJECTION(inclusion: string[], exclusion: (keyof ISellerByAggregate)[]): {
61
+ static CREATE_AGGREGATE_SELLERS_PROJECTION(exclusion: (keyof ISellerByAggregate)[]): {
60
62
  [field: string]: AnyExpression;
61
63
  };
62
64
  /**
@@ -71,11 +73,11 @@ export declare class SellerRepo {
71
73
  /**
72
74
  * 集計検索(publicな属性検索が目的)
73
75
  */
74
- searchByAggregate(conditions: factory.seller.ISearchConditions & IMemberSearchConditions, inclusion: (keyof ISellerByAggregate)[], exclusion: (keyof ISellerByAggregate)[]): Promise<ISellerByAggregate[]>;
76
+ searchByAggregate(conditions: factory.seller.ISearchConditions & IMemberSearchConditions, exclusion: (keyof ISellerByAggregate)[]): Promise<ISellerByAggregate[]>;
75
77
  /**
76
78
  * 販売者検索
77
79
  */
78
- projectFields(conditions: factory.seller.ISearchConditions & IMemberSearchConditions, inclusion: IKeyOfProjection[], exclusion: IKeyOfProjection[]): Promise<ISellerWithId[]>;
80
+ projectFields(conditions: factory.seller.ISearchConditions & IMemberSearchConditions, inclusion: IKeyOfProjection[]): Promise<ISellerWithId[]>;
79
81
  /**
80
82
  * 販売者を削除する
81
83
  */
@@ -102,24 +104,24 @@ export declare class SellerRepo {
102
104
  project: Pick<factory.project.IProject, "id" | "typeOf">;
103
105
  name: import("@chevre/factory/lib/multilingualString").IMultilingualString;
104
106
  typeOf: factory.organizationType.Corporation;
105
- additionalProperty?: import("@chevre/factory/lib/propertyValue").IPropertyValue<string>[] | undefined;
106
107
  location?: import("@chevre/factory/lib/place").IPlace | undefined;
107
- telephone?: string | undefined;
108
108
  hasMerchantReturnPolicy?: factory.seller.IHasMerchantReturnPolicy | undefined;
109
- branchCode: string;
110
109
  makesOffer?: factory.seller.IMakesOffer[] | undefined;
110
+ additionalProperty?: import("@chevre/factory/lib/propertyValue").IPropertyValue<string>[] | undefined;
111
+ telephone?: string | undefined;
112
+ branchCode: string;
111
113
  paymentAccepted?: factory.seller.IPaymentAccepted[] | undefined;
112
114
  }> & {
113
115
  url?: string | undefined;
114
116
  project: Pick<factory.project.IProject, "id" | "typeOf">;
115
117
  name: import("@chevre/factory/lib/multilingualString").IMultilingualString;
116
118
  typeOf: factory.organizationType.Corporation;
117
- additionalProperty?: import("@chevre/factory/lib/propertyValue").IPropertyValue<string>[] | undefined;
118
119
  location?: import("@chevre/factory/lib/place").IPlace | undefined;
119
- telephone?: string | undefined;
120
120
  hasMerchantReturnPolicy?: factory.seller.IHasMerchantReturnPolicy | undefined;
121
- branchCode: string;
122
121
  makesOffer?: factory.seller.IMakesOffer[] | undefined;
122
+ additionalProperty?: import("@chevre/factory/lib/propertyValue").IPropertyValue<string>[] | undefined;
123
+ telephone?: string | undefined;
124
+ branchCode: string;
123
125
  paymentAccepted?: factory.seller.IPaymentAccepted[] | undefined;
124
126
  } & {
125
127
  _id: Types.ObjectId;
@@ -128,24 +130,24 @@ export declare class SellerRepo {
128
130
  project: Pick<factory.project.IProject, "id" | "typeOf">;
129
131
  name: import("@chevre/factory/lib/multilingualString").IMultilingualString;
130
132
  typeOf: factory.organizationType.Corporation;
131
- additionalProperty?: import("@chevre/factory/lib/propertyValue").IPropertyValue<string>[] | undefined;
132
133
  location?: import("@chevre/factory/lib/place").IPlace | undefined;
133
- telephone?: string | undefined;
134
134
  hasMerchantReturnPolicy?: factory.seller.IHasMerchantReturnPolicy | undefined;
135
- branchCode: string;
136
135
  makesOffer?: factory.seller.IMakesOffer[] | undefined;
136
+ additionalProperty?: import("@chevre/factory/lib/propertyValue").IPropertyValue<string>[] | undefined;
137
+ telephone?: string | undefined;
138
+ branchCode: string;
137
139
  paymentAccepted?: factory.seller.IPaymentAccepted[] | undefined;
138
140
  }> & {
139
141
  url?: string | undefined;
140
142
  project: Pick<factory.project.IProject, "id" | "typeOf">;
141
143
  name: import("@chevre/factory/lib/multilingualString").IMultilingualString;
142
144
  typeOf: factory.organizationType.Corporation;
143
- additionalProperty?: import("@chevre/factory/lib/propertyValue").IPropertyValue<string>[] | undefined;
144
145
  location?: import("@chevre/factory/lib/place").IPlace | undefined;
145
- telephone?: string | undefined;
146
146
  hasMerchantReturnPolicy?: factory.seller.IHasMerchantReturnPolicy | undefined;
147
- branchCode: string;
148
147
  makesOffer?: factory.seller.IMakesOffer[] | undefined;
148
+ additionalProperty?: import("@chevre/factory/lib/propertyValue").IPropertyValue<string>[] | undefined;
149
+ telephone?: string | undefined;
150
+ branchCode: string;
149
151
  paymentAccepted?: factory.seller.IPaymentAccepted[] | undefined;
150
152
  } & {
151
153
  _id: Types.ObjectId;
@@ -157,7 +157,9 @@ class SellerRepo {
157
157
  }
158
158
  return andConditions;
159
159
  }
160
- static CREATE_AGGREGATE_SELLERS_PROJECTION(inclusion, exclusion) {
160
+ static CREATE_AGGREGATE_SELLERS_PROJECTION(
161
+ // inclusion: string[], // discontinue(2024-10-20~)
162
+ exclusion) {
161
163
  const projectStage = {
162
164
  _id: 0,
163
165
  id: { $toString: '$_id' },
@@ -185,10 +187,10 @@ class SellerRepo {
185
187
  url: '$url',
186
188
  telephone: '$telephone'
187
189
  };
188
- if (inclusion.length > 0) {
189
- // no op
190
- }
191
- else if (exclusion.length > 0) {
190
+ // if (inclusion.length > 0) {
191
+ // // no op
192
+ // } else
193
+ if (exclusion.length > 0) {
192
194
  exclusion.forEach((field) => {
193
195
  if (typeof projectStage[field] === 'string' || typeof projectStage[field] === 'object') {
194
196
  // tslint:disable-next-line:no-dynamic-delete
@@ -247,12 +249,14 @@ class SellerRepo {
247
249
  /**
248
250
  * 集計検索(publicな属性検索が目的)
249
251
  */
250
- searchByAggregate(conditions, inclusion, exclusion) {
252
+ searchByAggregate(conditions,
253
+ // inclusion: (keyof ISellerByAggregate)[], // discontinue(2024-10-20~)
254
+ exclusion) {
251
255
  var _a;
252
256
  return __awaiter(this, void 0, void 0, function* () {
253
257
  const matchStages = SellerRepo.CREATE_MONGO_CONDITIONS(conditions)
254
258
  .map((c) => ({ $match: c }));
255
- const projectStage = SellerRepo.CREATE_AGGREGATE_SELLERS_PROJECTION(inclusion, exclusion);
259
+ const projectStage = SellerRepo.CREATE_AGGREGATE_SELLERS_PROJECTION(exclusion);
256
260
  const sortByBranchCode = (_a = conditions.sort) === null || _a === void 0 ? void 0 : _a.branchCode;
257
261
  const aggregate = this.sellerModel.aggregate([
258
262
  ...matchStages,
@@ -274,7 +278,7 @@ class SellerRepo {
274
278
  /**
275
279
  * 販売者検索
276
280
  */
277
- projectFields(conditions, inclusion, exclusion) {
281
+ projectFields(conditions, inclusion) {
278
282
  var _a;
279
283
  return __awaiter(this, void 0, void 0, function* () {
280
284
  const andConditions = SellerRepo.CREATE_MONGO_CONDITIONS(conditions);
@@ -283,37 +287,15 @@ class SellerRepo {
283
287
  positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
284
288
  }
285
289
  else {
286
- if (Array.isArray(exclusion) && exclusion.length > 0) {
287
- positiveProjectionFields = positiveProjectionFields.filter((key) => !exclusion.includes(key));
288
- }
290
+ // discontinue(2024-10-19~)
289
291
  }
290
292
  const projection = Object.assign({ _id: 0, id: { $toString: '$_id' } }, Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1]))));
291
- // let projection: { [key: string]: number } = {};
292
- // if (Array.isArray(inclusion) && inclusion.length > 0) {
293
- // inclusion.forEach((field) => {
294
- // projection[field] = 1;
295
- // });
296
- // } else {
297
- // projection = {
298
- // __v: 0,
299
- // createdAt: 0,
300
- // updatedAt: 0,
301
- // paymentAccepted: 0 // 除外(2023-12-01~)
302
- // };
303
- // if (Array.isArray(exclusion) && exclusion.length > 0) {
304
- // exclusion.forEach((field) => {
305
- // projection[field] = 0;
306
- // });
307
- // }
308
- // }
309
293
  const query = this.sellerModel.find((andConditions.length > 0) ? { $and: andConditions } : {}, projection);
310
294
  if (typeof conditions.limit === 'number' && conditions.limit > 0) {
311
295
  const page = (typeof conditions.page === 'number' && conditions.page > 0) ? conditions.page : 1;
312
296
  query.limit(conditions.limit)
313
297
  .skip(conditions.limit * (page - 1));
314
298
  }
315
- // tslint:disable-next-line:no-single-line-block-comment
316
- /* istanbul ignore else */
317
299
  if (((_a = conditions.sort) === null || _a === void 0 ? void 0 : _a.branchCode) !== undefined) {
318
300
  query.sort({ branchCode: conditions.sort.branchCode });
319
301
  }
@@ -184,11 +184,9 @@ export declare class TaskRepo {
184
184
  };
185
185
  }): Promise<number>;
186
186
  getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, {}, {
187
- project: Pick<factory.project.IProject, "id" | "typeOf">;
188
187
  identifier?: string | undefined;
188
+ project: Pick<factory.project.IProject, "id" | "typeOf">;
189
189
  name: factory.taskName;
190
- expires?: Date | undefined;
191
- data: any;
192
190
  status: factory.taskStatus;
193
191
  runsAt: Date;
194
192
  remainingNumberOfTries: number;
@@ -196,13 +194,13 @@ export declare class TaskRepo {
196
194
  numberOfTried: number;
197
195
  executionResults: import("@chevre/factory/lib/task").IExecutionResult[];
198
196
  executor?: import("@chevre/factory/lib/task").IExecutor | undefined;
197
+ data: any;
199
198
  dateAborted?: Date | undefined;
199
+ expires?: Date | undefined;
200
200
  }> & {
201
- project: Pick<factory.project.IProject, "id" | "typeOf">;
202
201
  identifier?: string | undefined;
202
+ project: Pick<factory.project.IProject, "id" | "typeOf">;
203
203
  name: factory.taskName;
204
- expires?: Date | undefined;
205
- data: any;
206
204
  status: factory.taskStatus;
207
205
  runsAt: Date;
208
206
  remainingNumberOfTries: number;
@@ -210,15 +208,15 @@ export declare class TaskRepo {
210
208
  numberOfTried: number;
211
209
  executionResults: import("@chevre/factory/lib/task").IExecutionResult[];
212
210
  executor?: import("@chevre/factory/lib/task").IExecutor | undefined;
211
+ data: any;
213
212
  dateAborted?: Date | undefined;
213
+ expires?: Date | undefined;
214
214
  } & {
215
215
  _id: import("mongoose").Types.ObjectId;
216
216
  }, import("mongoose").QueryOptions<import("mongoose").Document<unknown, {}, {
217
- project: Pick<factory.project.IProject, "id" | "typeOf">;
218
217
  identifier?: string | undefined;
218
+ project: Pick<factory.project.IProject, "id" | "typeOf">;
219
219
  name: factory.taskName;
220
- expires?: Date | undefined;
221
- data: any;
222
220
  status: factory.taskStatus;
223
221
  runsAt: Date;
224
222
  remainingNumberOfTries: number;
@@ -226,13 +224,13 @@ export declare class TaskRepo {
226
224
  numberOfTried: number;
227
225
  executionResults: import("@chevre/factory/lib/task").IExecutionResult[];
228
226
  executor?: import("@chevre/factory/lib/task").IExecutor | undefined;
227
+ data: any;
229
228
  dateAborted?: Date | undefined;
229
+ expires?: Date | undefined;
230
230
  }> & {
231
- project: Pick<factory.project.IProject, "id" | "typeOf">;
232
231
  identifier?: string | undefined;
232
+ project: Pick<factory.project.IProject, "id" | "typeOf">;
233
233
  name: factory.taskName;
234
- expires?: Date | undefined;
235
- data: any;
236
234
  status: factory.taskStatus;
237
235
  runsAt: Date;
238
236
  remainingNumberOfTries: number;
@@ -240,7 +238,9 @@ export declare class TaskRepo {
240
238
  numberOfTried: number;
241
239
  executionResults: import("@chevre/factory/lib/task").IExecutionResult[];
242
240
  executor?: import("@chevre/factory/lib/task").IExecutor | undefined;
241
+ data: any;
243
242
  dateAborted?: Date | undefined;
243
+ expires?: Date | undefined;
244
244
  } & {
245
245
  _id: import("mongoose").Types.ObjectId;
246
246
  }>>;
@@ -158,7 +158,7 @@ export declare class TransactionRepo {
158
158
  status: {
159
159
  $in: factory.transactionStatusType[];
160
160
  };
161
- }): Promise<Pick<import("@chevre/factory/lib/transaction/moneyTransfer").ITransaction | import("@chevre/factory/lib/transaction/placeOrder").ITransaction | import("@chevre/factory/lib/transaction/returnOrder").ITransaction, "id" | "typeOf" | "status">[]>;
161
+ }): Promise<Pick<import("@chevre/factory/lib/transaction/moneyTransfer").ITransaction | import("@chevre/factory/lib/transaction/placeOrder").ITransaction | import("@chevre/factory/lib/transaction/returnOrder").ITransaction, "id" | "status" | "typeOf">[]>;
162
162
  /**
163
163
  * set task status exported by transaction id
164
164
  * IDでタスクをエクスポート済に変更する
@@ -20,6 +20,7 @@ import type { CustomerRepo } from './repo/customer';
20
20
  import type { CustomerTypeRepo } from './repo/customerType';
21
21
  import type { EmailMessageRepo } from './repo/emailMessage';
22
22
  import type { EventRepo } from './repo/event';
23
+ import type { EventSellerMakesOfferRepo } from './repo/eventSellerMakesOffer';
23
24
  import type { EventSeriesRepo } from './repo/eventSeries';
24
25
  import type { MemberRepo } from './repo/member';
25
26
  import type { MerchantReturnPolicyRepo } from './repo/merchantReturnPolicy';
@@ -147,6 +148,10 @@ export type Event = EventRepo;
147
148
  export declare namespace Event {
148
149
  function createInstance(...params: ConstructorParameters<typeof EventRepo>): Promise<EventRepo>;
149
150
  }
151
+ export type EventSellerMakesOffer = EventSellerMakesOfferRepo;
152
+ export declare namespace EventSellerMakesOffer {
153
+ function createInstance(...params: ConstructorParameters<typeof EventSellerMakesOfferRepo>): Promise<EventSellerMakesOfferRepo>;
154
+ }
150
155
  export type EventSeries = EventSeriesRepo;
151
156
  export declare namespace EventSeries {
152
157
  function createInstance(...params: ConstructorParameters<typeof EventSeriesRepo>): Promise<EventSeriesRepo>;
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.SellerPaymentAccepted = exports.Seller = exports.Role = exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductOffer = exports.ProductModel = exports.Product = exports.PriceSpecification = exports.place = exports.Permit = exports.Person = exports.paymentMethod = exports.PaymentServiceProvider = exports.PaymentService = exports.Passport = exports.OwnershipInfo = exports.OrderNumber = exports.OrderInTransaction = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalogItem = exports.OfferCatalog = exports.Note = exports.Message = exports.MerchantReturnPolicy = exports.Member = exports.EventSeries = exports.Event = exports.EmailMessage = exports.CustomerType = exports.Customer = exports.CreativeWork = exports.ConfirmationNumber = exports.Comment = exports.Authorization = exports.CategoryCode = exports.AssetTransaction = exports.Aggregation = exports.AggregateReservation = exports.AggregateOffer = exports.AdditionalProperty = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = exports.AcceptedOffer = void 0;
13
- exports.rateLimit = exports.Trip = exports.TransactionProcess = exports.TransactionNumber = exports.Transaction = exports.Ticket = exports.Telemetry = exports.Task = exports.StockHolder = exports.ServiceOutputIdentifier = exports.ServiceOutput = void 0;
12
+ exports.Seller = exports.Role = exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductOffer = exports.ProductModel = exports.Product = exports.PriceSpecification = exports.place = exports.Permit = exports.Person = exports.paymentMethod = exports.PaymentServiceProvider = exports.PaymentService = exports.Passport = exports.OwnershipInfo = exports.OrderNumber = exports.OrderInTransaction = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalogItem = exports.OfferCatalog = exports.Note = exports.Message = exports.MerchantReturnPolicy = exports.Member = exports.EventSeries = exports.EventSellerMakesOffer = exports.Event = exports.EmailMessage = exports.CustomerType = exports.Customer = exports.CreativeWork = exports.ConfirmationNumber = exports.Comment = exports.Authorization = exports.CategoryCode = exports.AssetTransaction = exports.Aggregation = exports.AggregateReservation = exports.AggregateOffer = exports.AdditionalProperty = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = exports.AcceptedOffer = void 0;
13
+ exports.rateLimit = exports.Trip = exports.TransactionProcess = exports.TransactionNumber = exports.Transaction = exports.Ticket = exports.Telemetry = exports.Task = exports.StockHolder = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.SellerPaymentAccepted = void 0;
14
14
  var AcceptedOffer;
15
15
  (function (AcceptedOffer) {
16
16
  let repo;
@@ -271,6 +271,19 @@ var Event;
271
271
  }
272
272
  Event.createInstance = createInstance;
273
273
  })(Event = exports.Event || (exports.Event = {}));
274
+ var EventSellerMakesOffer;
275
+ (function (EventSellerMakesOffer) {
276
+ let repo;
277
+ function createInstance(...params) {
278
+ return __awaiter(this, void 0, void 0, function* () {
279
+ if (repo === undefined) {
280
+ repo = (yield Promise.resolve().then(() => require('./repo/eventSellerMakesOffer'))).EventSellerMakesOfferRepo;
281
+ }
282
+ return new repo(...params);
283
+ });
284
+ }
285
+ EventSellerMakesOffer.createInstance = createInstance;
286
+ })(EventSellerMakesOffer = exports.EventSellerMakesOffer || (exports.EventSellerMakesOffer = {}));
274
287
  var EventSeries;
275
288
  (function (EventSeries) {
276
289
  let repo;
@@ -1,14 +1,13 @@
1
- import { EventRepo, IMinimizedIndividualEvent } from '../../../repo/event';
1
+ import { EventRepo } from '../../../repo/event';
2
2
  import type { OfferRepo } from '../../../repo/offer';
3
3
  import type { OfferCatalogRepo } from '../../../repo/offerCatalog';
4
4
  import { ScreeningRoomRepo } from '../../../repo/place/screeningRoom';
5
5
  import type { ProductRepo } from '../../../repo/product';
6
+ import type { ProjectRepo } from '../../../repo/project';
6
7
  import { OfferRateLimitRepo } from '../../../repo/rateLimit/offer';
7
8
  import type { ReservationRepo } from '../../../repo/reservation';
8
9
  import type { StockHolderRepo } from '../../../repo/stockHolder';
9
10
  import type { TaskRepo } from '../../../repo/task';
10
- import * as factory from '../../../factory';
11
- import { Settings } from '../../../settings';
12
11
  export interface IAggregateScreeningEventRepos {
13
12
  event: EventRepo;
14
13
  stockHolder: StockHolderRepo;
@@ -17,27 +16,14 @@ export interface IAggregateScreeningEventRepos {
17
16
  offerRateLimit: OfferRateLimitRepo;
18
17
  screeningRoom: ScreeningRoomRepo;
19
18
  product: ProductRepo;
19
+ project: ProjectRepo;
20
20
  reservation: ReservationRepo;
21
21
  task: TaskRepo;
22
22
  }
23
- export type IAggregateScreeningEventOperation<T> = (repos: IAggregateScreeningEventRepos, settings: Settings) => Promise<T>;
24
- type IEvet4aggregate = Pick<IMinimizedIndividualEvent<factory.eventType.Event>, 'id' | 'location' | 'project' | 'startDate' | 'typeOf'> & {
25
- offers?: Pick<factory.event.event.IOffer, 'itemOffered'>;
26
- } | Pick<IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>, 'id' | 'location' | 'project' | 'startDate' | 'typeOf'> & {
27
- offers?: Pick<factory.event.screeningEvent.IOffer, 'itemOffered'> | Pick<factory.event.screeningEvent.IOffer4COA, 'itemOffered'>;
28
- superEvent: {
29
- location: {
30
- id: string;
31
- };
32
- };
33
- };
23
+ export type IAggregateScreeningEventOperation<T> = (repos: IAggregateScreeningEventRepos) => Promise<T>;
34
24
  /**
35
25
  * イベントデータをID指定で集計する
36
26
  */
37
27
  export declare function aggregateScreeningEvent(params: {
38
28
  id: string;
39
29
  }): IAggregateScreeningEventOperation<void>;
40
- export declare function aggregateByEvent(params: {
41
- event: IEvet4aggregate;
42
- }): IAggregateScreeningEventOperation<void>;
43
- export {};
@@ -9,25 +9,36 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.aggregateByEvent = exports.aggregateScreeningEvent = void 0;
12
+ exports.aggregateScreeningEvent = void 0;
13
13
  /**
14
14
  * イベントの予約集計サービス
15
15
  */
16
16
  const createDebug = require("debug");
17
17
  const moment = require("moment-timezone");
18
18
  const factory = require("../../../factory");
19
+ // import { Settings } from '../../../settings';
19
20
  const findEventOffers_1 = require("./findEventOffers");
20
21
  const debug = createDebug('chevre-domain:service:aggregation');
21
22
  /**
22
23
  * イベントデータをID指定で集計する
23
24
  */
24
25
  function aggregateScreeningEvent(params) {
25
- return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
26
+ return (repos
27
+ // settings: Settings
28
+ ) => __awaiter(this, void 0, void 0, function* () {
29
+ var _a, _b;
26
30
  // 集計対象イベント検索
27
31
  const event = yield repos.event.projectEventFieldsById({ id: params.id }, ['location', 'project', 'startDate', 'typeOf', 'superEvent.location.id', 'offers.itemOffered']);
32
+ // プロジェクト設定検索
33
+ const project = yield repos.project.findById({
34
+ id: event.project.id,
35
+ inclusion: ['settings']
36
+ });
37
+ const useAggregateOffer = ((_a = project.settings) === null || _a === void 0 ? void 0 : _a.useAggregateOffer) === true;
38
+ const useOfferRateLimit = ((_b = project.settings) === null || _b === void 0 ? void 0 : _b.useOfferRateLimit) === true;
28
39
  let aggregatingEvents = [event];
29
- // プロジェクト限定(2023-02-22~)
30
- if (settings.useOfferRateLimitProjects.includes(event.project.id)) {
40
+ // dependent on project settings(2024-10-29~)
41
+ if (useOfferRateLimit) {
31
42
  const availableOffers = yield (0, findEventOffers_1.findEventOffers)({ event })(repos);
32
43
  const offerRateLimitExists = availableOffers.some((o) => { var _a; return typeof ((_a = o.validRateLimit) === null || _a === void 0 ? void 0 : _a.scope) === 'string'; });
33
44
  if (offerRateLimitExists) {
@@ -70,13 +81,15 @@ function aggregateScreeningEvent(params) {
70
81
  }
71
82
  debug(aggregatingEvents.length, 'aggregatingEvents found', aggregatingEvents.map((e) => e.id));
72
83
  for (const aggregatingEvent of aggregatingEvents) {
73
- yield aggregateByEvent({ event: aggregatingEvent })(repos, settings);
84
+ yield aggregateByEvent({ event: aggregatingEvent }, { useAggregateOffer })(repos);
74
85
  }
75
86
  });
76
87
  }
77
88
  exports.aggregateScreeningEvent = aggregateScreeningEvent;
78
- function aggregateByEvent(params) {
79
- return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
89
+ function aggregateByEvent(params, options) {
90
+ return (repos
91
+ // settings: Settings
92
+ ) => __awaiter(this, void 0, void 0, function* () {
80
93
  var _a;
81
94
  const now = new Date();
82
95
  const event = params.event;
@@ -117,18 +130,20 @@ function aggregateByEvent(params) {
117
130
  debug('update:', update);
118
131
  // 保管
119
132
  yield repos.event.updateAggregationById({ id: event.id }, update);
120
- yield onAggregated({ event })({
133
+ yield onAggregated({ event }, options)({
121
134
  task: repos.task
122
- }, settings);
135
+ }
136
+ // settings
137
+ );
123
138
  });
124
139
  }
125
- exports.aggregateByEvent = aggregateByEvent;
126
140
  /**
127
141
  * 集計後アクション
128
142
  */
129
- function onAggregated(params) {
130
- return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
131
- if (settings.useAggregateOfferProjects.includes(params.event.project.id)) {
143
+ function onAggregated(params, options) {
144
+ return (repos) => __awaiter(this, void 0, void 0, function* () {
145
+ // dependent on project settings(2024-10-29~)
146
+ if (options.useAggregateOffer) {
132
147
  // AggregateOffersタスクへ移行(2024-03-25~)
133
148
  const aggregateOffersTaskAttributes = {
134
149
  project: params.event.project,