@chevre/domain 25.1.0-alpha.3 → 25.2.0-alpha.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.
@@ -65,7 +65,7 @@ export declare class AuthorizeOfferActionRepo extends ActionProcessRepo<IAuthori
65
65
  }): Promise<void>;
66
66
  reCompleteAuthorizeEventOfferAction(params: {
67
67
  id: string;
68
- object: factory.action.authorize.offer.eventService.IObject;
68
+ object: factory.action.authorize.offer.eventService.IObject4COA;
69
69
  result: factory.action.authorize.offer.eventService.IResult;
70
70
  }): Promise<void>;
71
71
  }
@@ -29,7 +29,6 @@ class WaiterSettingRepo {
29
29
  .exec();
30
30
  // キャッシュを更新
31
31
  if (settingDoc?.waiter !== undefined) {
32
- console.log('document exist!', settingDoc);
33
32
  WaiterSettingRepo.cachedSettings = settingDoc.waiter;
34
33
  WaiterSettingRepo.cacheExpiry = now + WaiterSettingRepo.CACHE_TTL_MS;
35
34
  }
@@ -8,7 +8,6 @@ interface ICancelRepos {
8
8
  reserveService: COA.service.Reserve;
9
9
  task: TaskRepo;
10
10
  }
11
- type ICancelOperation<T> = (repos: ICancelRepos) => Promise<T>;
12
11
  interface ICancelByAcceptActionRepos {
13
12
  action: ActionRepo;
14
13
  acceptCOAOfferAction: AcceptCOAOfferActionRepo;
@@ -16,17 +15,6 @@ interface ICancelByAcceptActionRepos {
16
15
  task: TaskRepo;
17
16
  }
18
17
  type ICancelByAcceptActionOperation<T> = (repos: ICancelByAcceptActionRepos) => Promise<T>;
19
- /**
20
- * 興行オファー承認アクションからCOA予約を取り消す
21
- */
22
- declare function cancel(params: {
23
- action: factory.action.authorize.offer.eventService.IAction;
24
- }, options: {
25
- /**
26
- * cancelPendingReservation async?(2025-03-03~)
27
- */
28
- asyncCancelPendingReservation: boolean;
29
- }): ICancelOperation<void>;
30
18
  /**
31
19
  * 興行オファー採用アクションからCOA予約を取り消す
32
20
  */
@@ -38,4 +26,4 @@ declare function cancelByAcceptAction(params: {
38
26
  */
39
27
  asyncCancelPendingReservation: boolean;
40
28
  }): ICancelByAcceptActionOperation<void>;
41
- export { ICancelRepos, ICancelByAcceptActionRepos, cancel, cancelByAcceptAction };
29
+ export { ICancelRepos, ICancelByAcceptActionRepos, cancelByAcceptAction };
@@ -1,62 +1,74 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cancel = cancel;
4
3
  exports.cancelByAcceptAction = cancelByAcceptAction;
5
4
  const factory_1 = require("../../../factory");
6
5
  const cancelReservation_1 = require("../../reserveCOA/cancelReservation");
7
- /**
8
- * 興行オファー承認アクションからCOA予約を取り消す
9
- */
10
- function cancel(params, options) {
11
- return async (repos) => {
12
- // object.pendingTransactionに連携内容情報が記録されているので、その情報を元に仮予約を取り消す
13
- let delTmpReserveParams;
14
- // objectに進行中取引情報があれば利用する(2023-09-11~)
15
- const pendingTransaction = params.action.object.pendingTransaction;
16
- if (typeof pendingTransaction?.typeOf === 'string') {
17
- delTmpReserveParams = {
18
- theaterCode: pendingTransaction.theaterCode,
19
- dateJouei: pendingTransaction.dateJouei,
20
- titleCode: pendingTransaction.titleCode,
21
- titleBranchNum: pendingTransaction.titleBranchNum,
22
- timeBegin: pendingTransaction.timeBegin,
23
- tmpReserveNum: pendingTransaction.tmpReserveNum
24
- };
25
- }
26
- if (delTmpReserveParams !== undefined) {
27
- const { asyncCancelPendingReservation } = options;
28
- const object = {
29
- ...delTmpReserveParams,
30
- reservationStatus: factory_1.factory.reservationStatusType.ReservationPending,
31
- transactionNumber: delTmpReserveParams.tmpReserveNum,
32
- typeOf: factory_1.factory.assetTransactionType.COAReserveTransaction
33
- };
34
- const instrument = [params.action.purpose];
35
- if (asyncCancelPendingReservation) {
36
- // support async(2025-03-03~)
37
- const data = { object, instrument };
38
- const cancelPendingReservationTask = {
39
- project: { id: params.action.project.id, typeOf: factory_1.factory.organizationType.Project },
40
- name: factory_1.factory.taskName.CancelPendingReservation,
41
- status: factory_1.factory.taskStatus.Ready,
42
- runsAt: new Date(),
43
- remainingNumberOfTries: 10,
44
- numberOfTried: 0,
45
- executionResults: [],
46
- data
47
- };
48
- await repos.task.saveMany([cancelPendingReservationTask], { emitImmediately: true });
49
- }
50
- else {
51
- await (0, cancelReservation_1.cancelPendingReservation)({
52
- project: { id: params.action.project.id },
53
- object,
54
- instrument
55
- })(repos);
56
- }
57
- }
58
- };
59
- }
6
+ // /**
7
+ // * 興行オファー承認アクションからCOA予約を取り消す
8
+ // */
9
+ // function cancel(
10
+ // params: {
11
+ // action: factory.action.authorize.offer.eventService.IAction;
12
+ // },
13
+ // options: {
14
+ // /**
15
+ // * cancelPendingReservation async?(2025-03-03~)
16
+ // */
17
+ // asyncCancelPendingReservation: boolean;
18
+ // }
19
+ // ): ICancelOperation<void> {
20
+ // return async (repos: {
21
+ // action: ActionRepo;
22
+ // reserveService: COA.service.Reserve;
23
+ // task: TaskRepo;
24
+ // }) => {
25
+ // // object.pendingTransactionに連携内容情報が記録されているので、その情報を元に仮予約を取り消す
26
+ // let delTmpReserveParams: COA.factory.reserve.IDelTmpReserveArgs | undefined;
27
+ // // objectに進行中取引情報があれば利用する(2023-09-11~)
28
+ // const pendingTransaction = params.action.object.pendingTransaction;
29
+ // if (typeof pendingTransaction?.typeOf === 'string') {
30
+ // delTmpReserveParams = {
31
+ // theaterCode: pendingTransaction.theaterCode,
32
+ // dateJouei: pendingTransaction.dateJouei,
33
+ // titleCode: pendingTransaction.titleCode,
34
+ // titleBranchNum: pendingTransaction.titleBranchNum,
35
+ // timeBegin: pendingTransaction.timeBegin,
36
+ // tmpReserveNum: pendingTransaction.tmpReserveNum
37
+ // };
38
+ // }
39
+ // if (delTmpReserveParams !== undefined) {
40
+ // const { asyncCancelPendingReservation } = options;
41
+ // const object: factory.action.cancel.coaReserve.IObject = {
42
+ // ...delTmpReserveParams,
43
+ // reservationStatus: factory.reservationStatusType.ReservationPending,
44
+ // transactionNumber: delTmpReserveParams.tmpReserveNum,
45
+ // typeOf: factory.assetTransactionType.COAReserveTransaction
46
+ // };
47
+ // const instrument: factory.action.cancel.coaReserve.IPlaceOrderAsInstrument[] = [params.action.purpose];
48
+ // if (asyncCancelPendingReservation) {
49
+ // // support async(2025-03-03~)
50
+ // const data: factory.task.cancelPendingReservation.IPotentialCancelCOAReserveAction = { object, instrument };
51
+ // const cancelPendingReservationTask: factory.task.cancelPendingReservation.IAttributes = {
52
+ // project: { id: params.action.project.id, typeOf: factory.organizationType.Project },
53
+ // name: factory.taskName.CancelPendingReservation,
54
+ // status: factory.taskStatus.Ready,
55
+ // runsAt: new Date(),
56
+ // remainingNumberOfTries: 10,
57
+ // numberOfTried: 0,
58
+ // executionResults: [],
59
+ // data
60
+ // };
61
+ // await repos.task.saveMany([cancelPendingReservationTask], { emitImmediately: true });
62
+ // } else {
63
+ // await cancelPendingReservation({
64
+ // project: { id: params.action.project.id },
65
+ // object,
66
+ // instrument
67
+ // })(repos);
68
+ // }
69
+ // }
70
+ // };
71
+ // }
60
72
  /**
61
73
  * 興行オファー採用アクションからCOA予約を取り消す
62
74
  */
@@ -12,6 +12,7 @@ declare function processVoidTransaction4coa(params: {
12
12
  asyncCancelPendingReservation: boolean;
13
13
  }): (repos: {
14
14
  action: ActionRepo;
15
+ acceptCOAOfferAction: AcceptCOAOfferActionRepo;
15
16
  reserveService: COA.service.Reserve;
16
17
  task: TaskRepo;
17
18
  }) => Promise<void>;
@@ -2,10 +2,20 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.processVoidTransaction4coa = processVoidTransaction4coa;
4
4
  exports.processVoidTransactionByAcceptAction4coa = processVoidTransactionByAcceptAction4coa;
5
+ const factory_1 = require("../../../../factory");
5
6
  const cancel_1 = require("../../../assetTransaction/reserveCOA/cancel");
6
7
  function processVoidTransaction4coa(params, options) {
7
8
  return async (repos) => {
8
- await (0, cancel_1.cancel)(params, options)(repos);
9
+ // 採用アクションから取り消すように変更(2026-07-03~)
10
+ // await cancel(params, options)(repos);
11
+ // COA承認の場合、採用アクションは必ず存在するはず
12
+ const acceptActionId = params.action.object.id;
13
+ if (typeof acceptActionId !== 'string') {
14
+ throw new factory_1.factory.errors.NotFound('action.object.id');
15
+ }
16
+ const acceptAction = await repos.acceptCOAOfferAction.findById({ id: acceptActionId, typeOf: factory_1.factory.actionType.AcceptAction });
17
+ console.log('processVoidTransaction4coa processing...', params.action.id, params.action.purpose.id, acceptAction);
18
+ await (0, cancel_1.cancelByAcceptAction)({ action: acceptAction }, options)(repos);
9
19
  };
10
20
  }
11
21
  function processVoidTransactionByAcceptAction4coa(params, options) {
@@ -89,6 +89,7 @@ function voidTransaction(params) {
89
89
  }
90
90
  await (0, processVoidTransaction4coa_1.processVoidTransaction4coa)({ action }, { asyncCancelPendingReservation: true })({
91
91
  action: repos.action,
92
+ acceptCOAOfferAction: repos.acceptCOAOfferAction,
92
93
  reserveService,
93
94
  task: repos.task
94
95
  });
@@ -2,6 +2,7 @@ import type { COA } from '@motionpicture/coa-service';
2
2
  import { factory } from '../../../factory';
3
3
  import type { IntegrationSettingRepo as Settings } from '../../../repo/setting/integration';
4
4
  import type { ActionRepo } from '../../../repo/action';
5
+ import { AcceptCOAOfferActionRepo } from '../../../repo/action/acceptCOAOffer';
5
6
  import type { AuthorizeOfferActionRepo } from '../../../repo/action/authorizeOffer';
6
7
  import type { AssetTransactionRepo } from '../../../repo/assetTransaction';
7
8
  import type { OrderInTransactionRepo } from '../../../repo/orderInTransaction';
@@ -16,6 +17,7 @@ interface IVoidTransactionByActionIdRepos {
16
17
  * CancelAction開始で使用される
17
18
  */
18
19
  action: ActionRepo;
20
+ acceptCOAOfferAction: AcceptCOAOfferActionRepo;
19
21
  authorizeOfferAction: AuthorizeOfferActionRepo;
20
22
  assetTransaction: AssetTransactionRepo;
21
23
  stockHolder: StockHolderRepo;
@@ -57,6 +57,7 @@ function voidTransactionByActionId(params) {
57
57
  }
58
58
  await (0, processVoidTransaction4coa_1.processVoidTransaction4coa)({ action }, { asyncCancelPendingReservation: false })({
59
59
  action: repos.action,
60
+ acceptCOAOfferAction: repos.acceptCOAOfferAction,
60
61
  reserveService,
61
62
  task: repos.task
62
63
  });
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "dependencies": {
12
12
  "@aws-sdk/client-cognito-identity-provider": "3.600.0",
13
13
  "@aws-sdk/credential-providers": "3.600.0",
14
- "@chevre/factory": "9.4.0",
14
+ "@chevre/factory": "9.5.0-alpha.0",
15
15
  "@motionpicture/coa-service": "10.0.0",
16
16
  "@motionpicture/gmo-service": "6.1.0-alpha.0",
17
17
  "@sendgrid/client": "8.1.4",
@@ -91,5 +91,5 @@
91
91
  "postversion": "git push origin --tags",
92
92
  "prepublishOnly": "npm run clean && npm run build"
93
93
  },
94
- "version": "25.1.0-alpha.3"
94
+ "version": "25.2.0-alpha.0"
95
95
  }