@chevre/domain 21.19.0-alpha.14 → 21.19.0-alpha.15

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.
@@ -23,12 +23,17 @@ async function main() {
23
23
  targetCollection: { typeOf: chevre.factory.offerType.Offer }
24
24
  }
25
25
  });
26
- const error = new Error('sample error');
27
- await actionRepo.giveUp({
26
+ // const error = new Error('sample error');
27
+ // await actionRepo.giveUp({
28
+ // typeOf: action.typeOf,
29
+ // id: action.id,
30
+ // // error: { ...error, message: error.message, name: error.name }
31
+ // error
32
+ // });
33
+ await actionRepo.completeWithVoid({
28
34
  typeOf: action.typeOf,
29
35
  id: action.id,
30
- // error: { ...error, message: error.message, name: error.name }
31
- error
36
+ result: {}
32
37
  });
33
38
  }
34
39
 
@@ -70,6 +70,11 @@ export declare class MongoRepository {
70
70
  id: string;
71
71
  result: any;
72
72
  }): Promise<IAction<T>>;
73
+ completeWithVoid(params: {
74
+ typeOf: factory.actionType;
75
+ id: string;
76
+ result: any;
77
+ }): Promise<void>;
73
78
  /**
74
79
  * アクション取消
75
80
  */
@@ -492,6 +492,22 @@ class MongoRepository {
492
492
  return doc.toObject();
493
493
  });
494
494
  }
495
+ completeWithVoid(params) {
496
+ return __awaiter(this, void 0, void 0, function* () {
497
+ const doc = yield this.actionModel.findOneAndUpdate({
498
+ _id: { $eq: params.id },
499
+ typeOf: { $eq: params.typeOf }
500
+ }, {
501
+ actionStatus: factory.actionStatusType.CompletedActionStatus,
502
+ result: params.result,
503
+ endDate: new Date()
504
+ }, { new: false, projection: { _id: 1 } })
505
+ .exec();
506
+ if (doc === null) {
507
+ throw new factory.errors.NotFound(this.actionModel.modelName);
508
+ }
509
+ });
510
+ }
495
511
  /**
496
512
  * アクション取消
497
513
  */
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.19.0-alpha.14"
118
+ "version": "21.19.0-alpha.15"
119
119
  }