@chevre/domain 24.0.0-alpha.34 → 24.0.0-alpha.35

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.
@@ -20,4 +20,13 @@ export declare class AcceptCOAOfferActionRepo extends ActionProcessRepo<IAcceptC
20
20
  id: string;
21
21
  };
22
22
  }, inclusion: IKeyOfProjection[]): Promise<IAcceptCOAOfferAction>;
23
+ findAcceptCOAOfferActionsByPurpose(params: {
24
+ /**
25
+ * 注文取引でフィルター
26
+ */
27
+ purpose: {
28
+ typeOf: factory.transactionType;
29
+ id: string;
30
+ };
31
+ }): Promise<IAcceptCOAOfferAction[]>;
23
32
  }
@@ -58,5 +58,16 @@ class AcceptCOAOfferActionRepo extends actionProcess_1.ActionProcessRepo {
58
58
  }
59
59
  return doc;
60
60
  }
61
+ async findAcceptCOAOfferActionsByPurpose(params) {
62
+ return this.findAnyActionsByPurpose({
63
+ ...params,
64
+ typeOf: factory.actionType.AcceptAction,
65
+ purpose: {
66
+ typeOf: params.purpose.typeOf,
67
+ id: params.purpose.id
68
+ },
69
+ object: { typeOf: { $eq: factory.offerType.AggregateOffer } }
70
+ });
71
+ }
61
72
  }
62
73
  exports.AcceptCOAOfferActionRepo = AcceptCOAOfferActionRepo;
@@ -56,7 +56,7 @@ export declare class ActionProcessRepo<TAction extends IAction<factory.actionTyp
56
56
  * アクション取消
57
57
  */
58
58
  cancelWithVoid(params: {
59
- typeOf: factory.actionType.AcceptAction | factory.actionType.AuthorizeAction;
59
+ typeOf: TAction['typeOf'];
60
60
  id: string;
61
61
  cancelAction?: Pick<ICancelActionAction, 'agent' | 'sameAs' | 'startTime'>;
62
62
  }): Promise<void>;
@@ -20,6 +20,21 @@ export declare class AuthorizeOfferActionRepo extends ActionProcessRepo<IAuthori
20
20
  */
21
21
  ids: string[];
22
22
  }): Promise<IAuthorizeOfferActionWithInstrument[]>;
23
+ findAuthorizeOfferActionsByPurpose(params: {
24
+ /**
25
+ * 注文取引でフィルター
26
+ */
27
+ purpose: {
28
+ typeOf: factory.transactionType;
29
+ id: string;
30
+ };
31
+ /**
32
+ * アクションステータスでフィルター
33
+ */
34
+ actionStatus?: {
35
+ $eq?: factory.actionStatusType.CompletedActionStatus;
36
+ };
37
+ }): Promise<IAuthorizeEventServiceOfferAction[]>;
23
38
  /**
24
39
  * アクション再開
25
40
  */
@@ -52,6 +52,17 @@ class AuthorizeOfferActionRepo extends actionProcess_1.ActionProcessRepo {
52
52
  id: { $in: params.ids }
53
53
  }, ['instrument']);
54
54
  }
55
+ async findAuthorizeOfferActionsByPurpose(params) {
56
+ return this.findAnyActionsByPurpose({
57
+ ...params,
58
+ typeOf: factory.actionType.AuthorizeAction,
59
+ purpose: {
60
+ typeOf: params.purpose.typeOf,
61
+ id: params.purpose.id
62
+ },
63
+ object: { typeOf: { $eq: factory.action.authorize.offer.eventService.ObjectType.SeatReservation } }
64
+ });
65
+ }
55
66
  /**
56
67
  * アクション再開
57
68
  */
@@ -1,4 +1,4 @@
1
- import { FilterQuery, UpdateQuery } from 'mongoose';
1
+ import { FilterQuery } from 'mongoose';
2
2
  import * as factory from '../factory';
3
3
  import type { IDocType } from './mongoose/schemas/action';
4
4
  import { IAction, IKeyOfProjection, ActionProcessRepo, ICancelActionAction, IActionRecipe } from './action/actionProcess';
@@ -16,7 +16,7 @@ export declare class ActionRepo extends ActionProcessRepo<IAction<StartableActio
16
16
  /**
17
17
  * アクション検索
18
18
  */
19
- search<T extends StartableActionType>(params: factory.action.ISearchConditions, inclusion: IKeyOfProjection[]): Promise<IAction<T>[]>;
19
+ search<T extends StartableActionType>(params: factory.action.ISearchConditions & {}, inclusion: IKeyOfProjection[]): Promise<IAction<T>[]>;
20
20
  findPayAction(params: {
21
21
  project: {
22
22
  id: string;
@@ -29,7 +29,7 @@ export declare class ActionRepo extends ActionProcessRepo<IAction<StartableActio
29
29
  /**
30
30
  * 取引に対するアクションを検索する
31
31
  */
32
- searchByPurpose<T extends factory.actionType.AcceptAction | factory.actionType.AuthorizeAction>(params: {
32
+ searchByPurpose<T extends factory.actionType.AuthorizeAction>(params: {
33
33
  typeOf?: T;
34
34
  purpose: {
35
35
  typeOf: factory.transactionType;
@@ -60,14 +60,6 @@ export declare class ActionRepo extends ActionProcessRepo<IAction<StartableActio
60
60
  id: string;
61
61
  };
62
62
  }): Promise<void>;
63
- updateById(params: {
64
- id: string;
65
- update: any;
66
- }): Promise<void>;
67
- findByIdAndUpdate(params: {
68
- id: string;
69
- update: UpdateQuery<IAction<factory.actionType>>;
70
- }): Promise<void>;
71
63
  /**
72
64
  * イベントと入場ゲート指定で予約使用アクションを集計する
73
65
  * discontinue(2024-12-26~)
@@ -365,20 +365,33 @@ class ActionRepo extends actionProcess_1.ActionProcessRepo {
365
365
  // }
366
366
  // });
367
367
  // }
368
- async updateById(params) {
369
- await this.actionModel.updateOne({ _id: { $eq: params.id } }, params.update)
370
- .exec();
371
- }
372
- async findByIdAndUpdate(params) {
373
- await this.actionModel.findOneAndUpdate({ _id: { $eq: params.id } }, params.update, { projection: { _id: 1 } })
374
- .lean()
375
- .exec()
376
- .then((doc) => {
377
- if (doc === null) {
378
- throw new factory.errors.NotFound(this.actionModel.modelName);
379
- }
380
- });
381
- }
368
+ // public async updateById(params: {
369
+ // id: string;
370
+ // update: any;
371
+ // }): Promise<void> {
372
+ // await this.actionModel.updateOne(
373
+ // { _id: { $eq: params.id } },
374
+ // params.update
375
+ // )
376
+ // .exec();
377
+ // }
378
+ // public async findByIdAndUpdate(params: {
379
+ // id: string;
380
+ // update: UpdateQuery<IAction<factory.actionType>>;
381
+ // }): Promise<void> {
382
+ // await this.actionModel.findOneAndUpdate(
383
+ // { _id: { $eq: params.id } },
384
+ // params.update,
385
+ // { projection: { _id: 1 } }
386
+ // )
387
+ // .lean<{ _id: ObjectId }>()
388
+ // .exec()
389
+ // .then((doc) => {
390
+ // if (doc === null) {
391
+ // throw new factory.errors.NotFound(this.actionModel.modelName);
392
+ // }
393
+ // });
394
+ // }
382
395
  /**
383
396
  * イベントと入場ゲート指定で予約使用アクションを集計する
384
397
  * discontinue(2024-12-26~)
@@ -13,6 +13,9 @@ import type { StockHolderRepo } from '../../../repo/stockHolder';
13
13
  import type { TaskRepo } from '../../../repo/task';
14
14
  import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
15
15
  interface IVoidTransactionRepos {
16
+ /**
17
+ * CancelAction開始で使用される
18
+ */
16
19
  action: ActionRepo;
17
20
  acceptCOAOfferAction: AcceptCOAOfferActionRepo;
18
21
  authorizeOfferAction: AuthorizeOfferActionRepo;
@@ -44,4 +47,4 @@ declare function voidTransaction(params: factory.task.IData<factory.taskName.Voi
44
47
  id: string;
45
48
  };
46
49
  }): (repos: IVoidTransactionRepos, settings: Settings) => Promise<void>;
47
- export { voidTransaction };
50
+ export { IVoidTransactionRepos, voidTransaction };
@@ -47,13 +47,13 @@ function voidTransaction(params) {
47
47
  };
48
48
  const transaction = await repos.placeOrder.findPlaceOrderById({ typeOf: params.purpose.typeOf, id: params.purpose.id }, ['typeOf', 'status', 'object']);
49
49
  // 興行オファー承認アクション検索
50
- let authorizeActions = await repos.action.searchByPurpose({
51
- typeOf: factory.actionType.AuthorizeAction,
50
+ let authorizeActions = await repos.authorizeOfferAction.findAuthorizeOfferActionsByPurpose({
51
+ // typeOf: factory.actionType.AuthorizeAction,
52
52
  purpose: {
53
53
  typeOf: params.purpose.typeOf,
54
54
  id: params.purpose.id
55
55
  },
56
- object: { typeOf: { $eq: factory.action.authorize.offer.eventService.ObjectType.SeatReservation } }
56
+ // object: { typeOf: { $eq: factory.action.authorize.offer.eventService.ObjectType.SeatReservation } }
57
57
  });
58
58
  switch (transaction.status) {
59
59
  case factory.transactionStatusType.InProgress:
@@ -89,7 +89,7 @@ function voidTransaction(params) {
89
89
  }
90
90
  }
91
91
  await Promise.all(authorizeActions.map(async (action) => {
92
- await repos.action.cancelWithVoid({ typeOf: action.typeOf, id: action.id, cancelAction });
92
+ await repos.authorizeOfferAction.cancelWithVoid({ typeOf: action.typeOf, id: action.id, cancelAction });
93
93
  switch (action.instrument.typeOf) {
94
94
  // case WebAPIIdentifier.COA:
95
95
  case factory.assetTransactionType.COAReserveTransaction:
@@ -129,23 +129,23 @@ function cancelAcceptActions(params) {
129
129
  id: params.purpose.id
130
130
  }, ['typeOf', 'status']);
131
131
  // 興行オファー承認アクション検索
132
- const completedAuthorizeActions = await repos.action.searchByPurpose({
133
- typeOf: factory.actionType.AuthorizeAction,
132
+ const completedAuthorizeActions = await repos.authorizeOfferAction.findAuthorizeOfferActionsByPurpose({
133
+ // typeOf: factory.actionType.AuthorizeAction,
134
134
  purpose: {
135
135
  typeOf: params.purpose.typeOf,
136
136
  id: params.purpose.id
137
137
  },
138
- object: { typeOf: { $eq: factory.action.authorize.offer.eventService.ObjectType.SeatReservation } },
138
+ // object: { typeOf: { $eq: factory.action.authorize.offer.eventService.ObjectType.SeatReservation } },
139
139
  actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
140
140
  });
141
141
  // 興行オファー採用アクション検索
142
- let acceptActions = await repos.action.searchByPurpose({
143
- typeOf: factory.actionType.AcceptAction,
142
+ let acceptActions = await repos.acceptCOAOfferAction.findAcceptCOAOfferActionsByPurpose({
143
+ // typeOf: factory.actionType.AcceptAction,
144
144
  purpose: {
145
145
  typeOf: params.purpose.typeOf,
146
146
  id: params.purpose.id
147
147
  },
148
- object: { typeOf: { $eq: factory.offerType.AggregateOffer } }
148
+ // object: { typeOf: { $eq: factory.offerType.AggregateOffer } }
149
149
  });
150
150
  switch (transaction.status) {
151
151
  case factory.transactionStatusType.InProgress:
@@ -173,7 +173,7 @@ function cancelAcceptActions(params) {
173
173
  }
174
174
  const { reserveService } = repos;
175
175
  await Promise.all(acceptActions.map(async (action) => {
176
- await repos.action.cancelWithVoid({ typeOf: action.typeOf, id: action.id, cancelAction });
176
+ await repos.acceptCOAOfferAction.cancelWithVoid({ typeOf: action.typeOf, id: action.id, cancelAction });
177
177
  if (reserveService === undefined) {
178
178
  throw new factory.errors.Internal('repos.reserveService required');
179
179
  }
package/package.json CHANGED
@@ -99,5 +99,5 @@
99
99
  "postversion": "git push origin --tags",
100
100
  "prepublishOnly": "npm run clean && npm run build"
101
101
  },
102
- "version": "24.0.0-alpha.34"
102
+ "version": "24.0.0-alpha.35"
103
103
  }