@chevre/domain 21.20.0-alpha.28 → 21.20.0-alpha.29

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.
@@ -30,6 +30,7 @@ export interface IUseActionCountByOffer {
30
30
  _id: string[];
31
31
  useActionCount?: number;
32
32
  }
33
+ type KeyOfAction = keyof factory.action.IAction<factory.action.IAttributes<factory.actionType, any, any>> | '_id';
33
34
  interface IAggregationByStatus {
34
35
  actionCount: number;
35
36
  avgDuration: number;
@@ -57,7 +58,7 @@ export declare class MongoRepository {
57
58
  /**
58
59
  * アクション検索
59
60
  */
60
- search<T extends factory.actionType>(params: factory.action.ISearchConditions, inclusion: string[], exclusion: string[]): Promise<IAction<T>[]>;
61
+ search<T extends factory.actionType>(params: factory.action.ISearchConditions, inclusion: KeyOfAction[], exclusion: KeyOfAction[]): Promise<IAction<T>[]>;
61
62
  /**
62
63
  * アクション開始
63
64
  */
@@ -10,7 +10,7 @@ interface IAcceptOfferOperationRepos {
10
10
  transaction: TransactionRepo;
11
11
  }
12
12
  type IAcceptOfferOperation<T> = (repos: IAcceptOfferOperationRepos) => Promise<T>;
13
- type IAuthorizeOfferAction = factory.action.authorize.offer.eventService.IAction<factory.service.webAPI.Identifier>;
13
+ type IAuthorizeEventServiceOfferAction = factory.action.authorize.offer.eventService.IAction<factory.service.webAPI.Identifier>;
14
14
  export declare function acceptOffer(params: {
15
15
  project: {
16
16
  id: string;
@@ -24,7 +24,7 @@ export declare function voidAcceptedOffer(params: {
24
24
  /**
25
25
  * 取消対象の承認アクション
26
26
  */
27
- authorizeActions: IAuthorizeOfferAction[];
27
+ authorizeActions: Pick<IAuthorizeEventServiceOfferAction, 'object'>[];
28
28
  orderNumber: string;
29
29
  }): (repos: {
30
30
  orderInTransaction: OrderInTransactionRepo;
@@ -13,7 +13,7 @@ exports.placeOrderWithoutTransaction = exports.placeOrder = void 0;
13
13
  const createDebug = require("debug");
14
14
  const moment = require("moment");
15
15
  const order_1 = require("../../factory/order");
16
- // import { voidAcceptedOffer } from '../offer/any';
16
+ const any_1 = require("../offer/any");
17
17
  const createAccountingReportIfNotExist_1 = require("./createAccountingReportIfNotExist");
18
18
  const onAssetTransactionStatusChanged_1 = require("./onAssetTransactionStatusChanged");
19
19
  const onOrderStatusChanged_1 = require("./onOrderStatusChanged");
@@ -165,22 +165,20 @@ function voidAcceptedOfferIfNecessary(params) {
165
165
  if (Array.isArray(authorizeActionsAsResult) && authorizeActionsAsResult.length > 0) {
166
166
  const completedAuthorizeActionIds = authorizeActionsAsResult.map(({ id }) => id);
167
167
  debug(completedAuthorizeActionIds.length, 'completedAuthorizeActionIds found from transaction', params.purpose.id);
168
- const authorizeActions = yield repos.action.searchByPurpose({
168
+ const authorizeActions = yield repos.action.search({
169
169
  typeOf: factory.actionType.AuthorizeAction,
170
170
  purpose: {
171
- typeOf: factory.transactionType.PlaceOrder,
172
- id: params.purpose.id
171
+ typeOf: { $in: [factory.transactionType.PlaceOrder] },
172
+ id: { $in: [params.purpose.id] }
173
173
  },
174
174
  object: { typeOf: { $eq: factory.action.authorize.offer.eventService.ObjectType.SeatReservation } },
175
175
  id: { $nin: completedAuthorizeActionIds }
176
- });
176
+ }, ['object'], []);
177
177
  debug('processing voidAcceptedOffer', authorizeActions.length, 'authorizeActions...', authorizeActions);
178
- // tslint:disable-next-line:no-suspicious-comment
179
- // TODO implement
180
- // await voidAcceptedOffer({
181
- // authorizeActions,
182
- // orderNumber: params.object.orderNumber
183
- // })(repos);
178
+ yield (0, any_1.voidAcceptedOffer)({
179
+ authorizeActions,
180
+ orderNumber: params.object.orderNumber
181
+ })(repos);
184
182
  }
185
183
  });
186
184
  }
package/package.json CHANGED
@@ -115,5 +115,5 @@
115
115
  "postversion": "git push origin --tags",
116
116
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
117
117
  },
118
- "version": "21.20.0-alpha.28"
118
+ "version": "21.20.0-alpha.29"
119
119
  }