@chevre/domain 20.1.0-alpha.4 → 20.1.0-alpha.40

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 (107) hide show
  1. package/example/src/chevre/deleteEvents.ts +9 -1
  2. package/example/src/chevre/migrateAccountTitleAdditionalProperties.ts +157 -0
  3. package/example/src/chevre/migrateCreativeWorkAdditionalProperties.ts +116 -0
  4. package/example/src/chevre/migrateEventOffersSellerMakesOffer.ts +139 -0
  5. package/example/src/chevre/migrateEventProjectAttributes.ts +57 -0
  6. package/example/src/chevre/migratePlaceAdditionalProperties.ts +162 -0
  7. package/example/src/chevre/migrateSSKTEventCOAEndpoint.ts +64 -0
  8. package/example/src/chevre/searchEvents.ts +36 -16
  9. package/lib/chevre/repo/accountAction.d.ts +0 -18
  10. package/lib/chevre/repo/accountAction.js +402 -355
  11. package/lib/chevre/repo/accountTitle.d.ts +1 -0
  12. package/lib/chevre/repo/accountTitle.js +6 -1
  13. package/lib/chevre/repo/additionalProperty.d.ts +35 -0
  14. package/lib/chevre/repo/additionalProperty.js +205 -0
  15. package/lib/chevre/repo/categoryCode.d.ts +1 -0
  16. package/lib/chevre/repo/categoryCode.js +15 -1
  17. package/lib/chevre/repo/creativeWork.js +10 -1
  18. package/lib/chevre/repo/customer.d.ts +1 -0
  19. package/lib/chevre/repo/customer.js +5 -0
  20. package/lib/chevre/repo/event.d.ts +12 -4
  21. package/lib/chevre/repo/event.js +84 -48
  22. package/lib/chevre/repo/merchantReturnPolicy.d.ts +1 -0
  23. package/lib/chevre/repo/merchantReturnPolicy.js +5 -0
  24. package/lib/chevre/repo/mongoose/model/additionalProperty.d.ts +7 -0
  25. package/lib/chevre/repo/mongoose/model/additionalProperty.js +81 -0
  26. package/lib/chevre/repo/mongoose/model/categoryCode.js +18 -2
  27. package/lib/chevre/repo/mongoose/model/creativeWork.js +6 -0
  28. package/lib/chevre/repo/mongoose/model/event.js +53 -0
  29. package/lib/chevre/repo/mongoose/model/offer.js +7 -1
  30. package/lib/chevre/repo/mongoose/model/offerCatalog.js +21 -2
  31. package/lib/chevre/repo/mongoose/model/ownershipInfo.js +3 -15
  32. package/lib/chevre/repo/mongoose/model/place.js +42 -0
  33. package/lib/chevre/repo/offer.js +10 -1
  34. package/lib/chevre/repo/offerCatalog.js +10 -10
  35. package/lib/chevre/repo/place.d.ts +1 -0
  36. package/lib/chevre/repo/place.js +54 -7
  37. package/lib/chevre/repo/reservation.d.ts +13 -0
  38. package/lib/chevre/repo/reservation.js +28 -0
  39. package/lib/chevre/repo/transaction.js +20 -5
  40. package/lib/chevre/repository.d.ts +6 -3
  41. package/lib/chevre/repository.js +10 -5
  42. package/lib/chevre/service/account.d.ts +0 -4
  43. package/lib/chevre/service/account.js +24 -22
  44. package/lib/chevre/service/accountTransaction/deposit.d.ts +0 -2
  45. package/lib/chevre/service/accountTransaction/deposit.js +3 -3
  46. package/lib/chevre/service/accountTransaction/transfer.d.ts +0 -2
  47. package/lib/chevre/service/accountTransaction/transfer.js +3 -3
  48. package/lib/chevre/service/accountTransaction/withdraw.d.ts +0 -2
  49. package/lib/chevre/service/accountTransaction/withdraw.js +3 -3
  50. package/lib/chevre/service/assetTransaction/pay/potentialActions.js +9 -19
  51. package/lib/chevre/service/assetTransaction/reserve/factory.js +119 -115
  52. package/lib/chevre/service/assetTransaction/reserve.js +99 -89
  53. package/lib/chevre/service/delivery/factory.js +2 -1
  54. package/lib/chevre/service/event.js +20 -6
  55. package/lib/chevre/service/offer/event/authorize.d.ts +4 -0
  56. package/lib/chevre/service/offer/event/authorize.js +65 -27
  57. package/lib/chevre/service/offer/event/factory.d.ts +1 -1
  58. package/lib/chevre/service/offer/event/factory.js +17 -12
  59. package/lib/chevre/service/offer/eventServiceByCOA/factory.js +19 -9
  60. package/lib/chevre/service/offer/factory.js +7 -20
  61. package/lib/chevre/service/offer.js +6 -6
  62. package/lib/chevre/service/order/onOrderStatusChanged/factory.js +4 -2
  63. package/lib/chevre/service/order/onOrderStatusChanged.js +3 -2
  64. package/lib/chevre/service/order/placeOrder.js +13 -5
  65. package/lib/chevre/service/order/returnOrder.js +2 -1
  66. package/lib/chevre/service/order/sendOrder.js +2 -1
  67. package/lib/chevre/service/reserve/cancelReservation.js +135 -87
  68. package/lib/chevre/service/reserve/confirmReservation.js +65 -33
  69. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.d.ts +1 -1
  70. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +67 -30
  71. package/lib/chevre/service/task/confirmReserveTransaction.js +1 -1
  72. package/lib/chevre/service/transaction/orderProgramMembership.js +6 -8
  73. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +6 -3
  74. package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +9 -4
  75. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/givePointAward.js +2 -1
  76. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +2 -1
  77. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +2 -1
  78. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/sendEmailMessage.js +4 -3
  79. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.js +2 -1
  80. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +10 -6
  81. package/lib/chevre/service/transaction/placeOrderInProgress/result.js +2 -4
  82. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.d.ts +3 -1
  83. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.js +3 -2
  84. package/lib/chevre/service/transaction/placeOrderInProgress.js +16 -2
  85. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.js +4 -5
  86. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +6 -3
  87. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.js +4 -6
  88. package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +2 -1
  89. package/lib/chevre/service/transaction/returnOrder.js +10 -1
  90. package/lib/chevre/service/transaction.js +1 -14
  91. package/package.json +4 -4
  92. package/example/src/chevre/accountBlanceTest.ts +0 -24
  93. package/example/src/chevre/checkOffersAppliesToMovieTicket.ts +0 -56
  94. package/example/src/chevre/createSeats.ts +0 -59
  95. package/example/src/chevre/manageOwnedByOfOwnershipInfo.ts +0 -35
  96. package/example/src/chevre/migrateEventOffersItemOfferedName.ts +0 -82
  97. package/example/src/chevre/migrateMovieTicketChargePriceSpecs.ts +0 -92
  98. package/example/src/chevre/migrateSellerMakesOffers.ts +0 -84
  99. package/example/src/chevre/migrateTTTSOldEventId.ts +0 -68
  100. package/example/src/chevre/publishConfirmationNumber.ts +0 -30
  101. package/example/src/chevre/publishServiceOutputIdentifier.ts +0 -28
  102. package/example/src/chevre/publishTransactionNumber.ts +0 -28
  103. package/example/src/chevre/renameTransaction.ts +0 -22
  104. package/lib/chevre/service/task/accountMoneyTransfer.d.ts +0 -3
  105. package/lib/chevre/service/task/accountMoneyTransfer.js +0 -31
  106. package/lib/chevre/service/task/cancelAccountMoneyTransfer.d.ts +0 -3
  107. package/lib/chevre/service/task/cancelAccountMoneyTransfer.js +0 -33
@@ -21,174 +21,175 @@ class MongoRepository {
21
21
  this.actionModel = connection.model(accountAction_1.modelName);
22
22
  }
23
23
  // tslint:disable-next-line:max-func-body-length
24
- static CREATE_MONEY_TRANSFER_ACTIONS_MONGO_CONDITIONS(params) {
25
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
26
- const andConditions = [
27
- { typeOf: factory.actionType.MoneyTransfer }
28
- ];
29
- // tslint:disable-next-line:no-single-line-block-comment
30
- /* istanbul ignore else */
31
- if (params.project !== undefined && params.project !== null) {
32
- // tslint:disable-next-line:no-single-line-block-comment
33
- /* istanbul ignore else */
34
- if (params.project.id !== undefined && params.project.id !== null) {
35
- // tslint:disable-next-line:no-single-line-block-comment
36
- /* istanbul ignore else */
37
- if (typeof params.project.id.$eq === 'string') {
38
- andConditions.push({
39
- 'project.id': {
40
- $eq: params.project.id.$eq
41
- }
42
- });
43
- }
44
- // tslint:disable-next-line:no-single-line-block-comment
45
- /* istanbul ignore else */
46
- if (typeof params.project.id.$ne === 'string') {
47
- andConditions.push({
48
- 'project.id': {
49
- $ne: params.project.id.$ne
50
- }
51
- });
52
- }
53
- }
54
- }
55
- // tslint:disable-next-line:no-single-line-block-comment
56
- /* istanbul ignore else */
57
- // if (typeof params.accountNumber === 'string') {
58
- // andConditions.push({
59
- // $or: [
60
- // {
61
- // 'fromLocation.accountNumber': {
62
- // $exists: true,
63
- // $eq: params.accountNumber
64
- // }
65
- // },
66
- // {
67
- // 'toLocation.accountNumber': {
68
- // $exists: true,
69
- // $eq: params.accountNumber
70
- // }
71
- // }
72
- // ]
73
- // });
74
- // }
75
- const actionStatusIn = (_a = params.actionStatus) === null || _a === void 0 ? void 0 : _a.$in;
76
- // tslint:disable-next-line:no-single-line-block-comment
77
- /* istanbul ignore else */
78
- if (Array.isArray(actionStatusIn)) {
79
- andConditions.push({
80
- actionStatus: { $in: actionStatusIn }
81
- });
82
- }
83
- const amountCurrencyEq = (_c = (_b = params.amount) === null || _b === void 0 ? void 0 : _b.currency) === null || _c === void 0 ? void 0 : _c.$eq;
84
- if (typeof amountCurrencyEq === 'string') {
85
- andConditions.push({
86
- 'amount.currency': {
87
- $exists: true,
88
- $eq: amountCurrencyEq
89
- }
90
- });
91
- }
92
- const locationAccountNumberEq = (_e = (_d = params.location) === null || _d === void 0 ? void 0 : _d.accountNumber) === null || _e === void 0 ? void 0 : _e.$eq;
93
- if (typeof locationAccountNumberEq === 'string') {
94
- andConditions.push({
95
- $or: [
96
- {
97
- 'fromLocation.accountNumber': {
98
- $exists: true,
99
- $eq: locationAccountNumberEq
100
- }
101
- },
102
- {
103
- 'toLocation.accountNumber': {
104
- $exists: true,
105
- $eq: locationAccountNumberEq
106
- }
107
- }
108
- ]
109
- });
110
- }
111
- const locationTypeOfEq = (_g = (_f = params.location) === null || _f === void 0 ? void 0 : _f.typeOf) === null || _g === void 0 ? void 0 : _g.$eq;
112
- if (typeof locationTypeOfEq === 'string') {
113
- andConditions.push({
114
- $or: [
115
- {
116
- 'fromLocation.typeOf': {
117
- $exists: true,
118
- $eq: locationTypeOfEq
119
- }
120
- },
121
- {
122
- 'toLocation.typeOf': {
123
- $exists: true,
124
- $eq: locationTypeOfEq
125
- }
126
- }
127
- ]
128
- });
129
- }
130
- const purposeTypeOfEq = (_j = (_h = params.purpose) === null || _h === void 0 ? void 0 : _h.typeOf) === null || _j === void 0 ? void 0 : _j.$eq;
131
- // tslint:disable-next-line:no-single-line-block-comment
132
- /* istanbul ignore else */
133
- if (typeof purposeTypeOfEq === 'string') {
134
- andConditions.push({
135
- 'purpose.typeOf': {
136
- $exists: true,
137
- $eq: purposeTypeOfEq
138
- }
139
- });
140
- }
141
- const purposeIdEq = (_l = (_k = params.purpose) === null || _k === void 0 ? void 0 : _k.id) === null || _l === void 0 ? void 0 : _l.$eq;
142
- // tslint:disable-next-line:no-single-line-block-comment
143
- /* istanbul ignore else */
144
- if (typeof purposeIdEq === 'string') {
145
- andConditions.push({
146
- 'purpose.id': {
147
- $exists: true,
148
- $eq: purposeIdEq
149
- }
150
- });
151
- }
152
- const purposeIdentifierEq = (_o = (_m = params.purpose) === null || _m === void 0 ? void 0 : _m.identifier) === null || _o === void 0 ? void 0 : _o.$eq;
153
- // tslint:disable-next-line:no-single-line-block-comment
154
- /* istanbul ignore else */
155
- if (typeof purposeIdentifierEq === 'string') {
156
- andConditions.push({
157
- 'purpose.identifier': {
158
- $exists: true,
159
- $eq: purposeIdentifierEq
160
- }
161
- });
162
- }
163
- const purposeTransactionNumberEq = (_q = (_p = params.purpose) === null || _p === void 0 ? void 0 : _p.transactionNumber) === null || _q === void 0 ? void 0 : _q.$eq;
164
- // tslint:disable-next-line:no-single-line-block-comment
165
- /* istanbul ignore else */
166
- if (typeof purposeTransactionNumberEq === 'string') {
167
- andConditions.push({
168
- 'purpose.transactionNumber': {
169
- $exists: true,
170
- $eq: purposeTransactionNumberEq
171
- }
172
- });
173
- }
174
- const startDateGte = (_r = params.startDate) === null || _r === void 0 ? void 0 : _r.$gte;
175
- // tslint:disable-next-line:no-single-line-block-comment
176
- /* istanbul ignore else */
177
- if (startDateGte instanceof Date) {
178
- andConditions.push({
179
- startDate: { $gte: startDateGte }
180
- });
181
- }
182
- const startDateLte = (_s = params.startDate) === null || _s === void 0 ? void 0 : _s.$lte;
183
- // tslint:disable-next-line:no-single-line-block-comment
184
- /* istanbul ignore else */
185
- if (startDateLte instanceof Date) {
186
- andConditions.push({
187
- startDate: { $lte: startDateLte }
188
- });
189
- }
190
- return andConditions;
191
- }
24
+ // public static CREATE_MONEY_TRANSFER_ACTIONS_MONGO_CONDITIONS(
25
+ // params: factory.account.action.moneyTransfer.ISearchConditions
26
+ // ) {
27
+ // const andConditions: any[] = [
28
+ // { typeOf: factory.actionType.MoneyTransfer }
29
+ // ];
30
+ // // tslint:disable-next-line:no-single-line-block-comment
31
+ // /* istanbul ignore else */
32
+ // if (params.project !== undefined && params.project !== null) {
33
+ // // tslint:disable-next-line:no-single-line-block-comment
34
+ // /* istanbul ignore else */
35
+ // if (params.project.id !== undefined && params.project.id !== null) {
36
+ // // tslint:disable-next-line:no-single-line-block-comment
37
+ // /* istanbul ignore else */
38
+ // if (typeof params.project.id.$eq === 'string') {
39
+ // andConditions.push({
40
+ // 'project.id': {
41
+ // $eq: params.project.id.$eq
42
+ // }
43
+ // });
44
+ // }
45
+ // // tslint:disable-next-line:no-single-line-block-comment
46
+ // /* istanbul ignore else */
47
+ // if (typeof params.project.id.$ne === 'string') {
48
+ // andConditions.push({
49
+ // 'project.id': {
50
+ // $ne: params.project.id.$ne
51
+ // }
52
+ // });
53
+ // }
54
+ // }
55
+ // }
56
+ // // tslint:disable-next-line:no-single-line-block-comment
57
+ // /* istanbul ignore else */
58
+ // // if (typeof params.accountNumber === 'string') {
59
+ // // andConditions.push({
60
+ // // $or: [
61
+ // // {
62
+ // // 'fromLocation.accountNumber': {
63
+ // // $exists: true,
64
+ // // $eq: params.accountNumber
65
+ // // }
66
+ // // },
67
+ // // {
68
+ // // 'toLocation.accountNumber': {
69
+ // // $exists: true,
70
+ // // $eq: params.accountNumber
71
+ // // }
72
+ // // }
73
+ // // ]
74
+ // // });
75
+ // // }
76
+ // const actionStatusIn = params.actionStatus?.$in;
77
+ // // tslint:disable-next-line:no-single-line-block-comment
78
+ // /* istanbul ignore else */
79
+ // if (Array.isArray(actionStatusIn)) {
80
+ // andConditions.push({
81
+ // actionStatus: { $in: actionStatusIn }
82
+ // });
83
+ // }
84
+ // const amountCurrencyEq = params.amount?.currency?.$eq;
85
+ // if (typeof amountCurrencyEq === 'string') {
86
+ // andConditions.push({
87
+ // 'amount.currency': {
88
+ // $exists: true,
89
+ // $eq: amountCurrencyEq
90
+ // }
91
+ // });
92
+ // }
93
+ // const locationAccountNumberEq = params.location?.accountNumber?.$eq;
94
+ // if (typeof locationAccountNumberEq === 'string') {
95
+ // andConditions.push({
96
+ // $or: [
97
+ // {
98
+ // 'fromLocation.accountNumber': {
99
+ // $exists: true,
100
+ // $eq: locationAccountNumberEq
101
+ // }
102
+ // },
103
+ // {
104
+ // 'toLocation.accountNumber': {
105
+ // $exists: true,
106
+ // $eq: locationAccountNumberEq
107
+ // }
108
+ // }
109
+ // ]
110
+ // });
111
+ // }
112
+ // const locationTypeOfEq = params.location?.typeOf?.$eq;
113
+ // if (typeof locationTypeOfEq === 'string') {
114
+ // andConditions.push({
115
+ // $or: [
116
+ // {
117
+ // 'fromLocation.typeOf': {
118
+ // $exists: true,
119
+ // $eq: locationTypeOfEq
120
+ // }
121
+ // },
122
+ // {
123
+ // 'toLocation.typeOf': {
124
+ // $exists: true,
125
+ // $eq: locationTypeOfEq
126
+ // }
127
+ // }
128
+ // ]
129
+ // });
130
+ // }
131
+ // const purposeTypeOfEq = params.purpose?.typeOf?.$eq;
132
+ // // tslint:disable-next-line:no-single-line-block-comment
133
+ // /* istanbul ignore else */
134
+ // if (typeof purposeTypeOfEq === 'string') {
135
+ // andConditions.push({
136
+ // 'purpose.typeOf': {
137
+ // $exists: true,
138
+ // $eq: purposeTypeOfEq
139
+ // }
140
+ // });
141
+ // }
142
+ // const purposeIdEq = params.purpose?.id?.$eq;
143
+ // // tslint:disable-next-line:no-single-line-block-comment
144
+ // /* istanbul ignore else */
145
+ // if (typeof purposeIdEq === 'string') {
146
+ // andConditions.push({
147
+ // 'purpose.id': {
148
+ // $exists: true,
149
+ // $eq: purposeIdEq
150
+ // }
151
+ // });
152
+ // }
153
+ // const purposeIdentifierEq = params.purpose?.identifier?.$eq;
154
+ // // tslint:disable-next-line:no-single-line-block-comment
155
+ // /* istanbul ignore else */
156
+ // if (typeof purposeIdentifierEq === 'string') {
157
+ // andConditions.push({
158
+ // 'purpose.identifier': {
159
+ // $exists: true,
160
+ // $eq: purposeIdentifierEq
161
+ // }
162
+ // });
163
+ // }
164
+ // const purposeTransactionNumberEq = params.purpose?.transactionNumber?.$eq;
165
+ // // tslint:disable-next-line:no-single-line-block-comment
166
+ // /* istanbul ignore else */
167
+ // if (typeof purposeTransactionNumberEq === 'string') {
168
+ // andConditions.push({
169
+ // 'purpose.transactionNumber': {
170
+ // $exists: true,
171
+ // $eq: purposeTransactionNumberEq
172
+ // }
173
+ // });
174
+ // }
175
+ // const startDateGte = params.startDate?.$gte;
176
+ // // tslint:disable-next-line:no-single-line-block-comment
177
+ // /* istanbul ignore else */
178
+ // if (startDateGte instanceof Date) {
179
+ // andConditions.push({
180
+ // startDate: { $gte: startDateGte }
181
+ // });
182
+ // }
183
+ // const startDateLte = params.startDate?.$lte;
184
+ // // tslint:disable-next-line:no-single-line-block-comment
185
+ // /* istanbul ignore else */
186
+ // if (startDateLte instanceof Date) {
187
+ // andConditions.push({
188
+ // startDate: { $lte: startDateLte }
189
+ // });
190
+ // }
191
+ // return andConditions;
192
+ // }
192
193
  /**
193
194
  * アクション開始
194
195
  */
@@ -204,212 +205,258 @@ class MongoRepository {
204
205
  // (doc) => doc.toObject()
205
206
  // );
206
207
  // }
207
- startByIdentifier(params) {
208
- return __awaiter(this, void 0, void 0, function* () {
209
- if (typeof params.identifier === 'string') {
210
- return this.actionModel.findOneAndUpdate({
211
- identifier: {
212
- $exists: true,
213
- $eq: params.identifier
214
- }
215
- }, {
216
- $setOnInsert: Object.assign(Object.assign({}, params), { actionStatus: factory.actionStatusType.ActiveActionStatus, startDate: new Date() })
217
- }, {
218
- new: true,
219
- upsert: true
220
- })
221
- .exec()
222
- .then((doc) => {
223
- if (doc === null) {
224
- throw new factory.errors.NotFound(this.actionModel.modelName);
225
- }
226
- return doc.toObject();
227
- });
228
- }
229
- else {
230
- return this.actionModel.create(Object.assign(Object.assign({}, params), { actionStatus: factory.actionStatusType.ActiveActionStatus, startDate: new Date() }))
231
- .then((doc) => doc.toObject());
232
- }
233
- });
234
- }
208
+ // public async startByIdentifier<T extends factory.actionType>(
209
+ // params: factory.account.action.moneyTransfer.IAttributes
210
+ // ): Promise<IAction<T>> {
211
+ // if (typeof params.identifier === 'string') {
212
+ // return this.actionModel.findOneAndUpdate(
213
+ // {
214
+ // identifier: {
215
+ // $exists: true,
216
+ // $eq: params.identifier
217
+ // }
218
+ // },
219
+ // {
220
+ // $setOnInsert: {
221
+ // ...params,
222
+ // actionStatus: factory.actionStatusType.ActiveActionStatus,
223
+ // startDate: new Date()
224
+ // }
225
+ // },
226
+ // {
227
+ // new: true,
228
+ // upsert: true
229
+ // }
230
+ // )
231
+ // .exec()
232
+ // .then((doc) => {
233
+ // if (doc === null) {
234
+ // throw new factory.errors.NotFound(this.actionModel.modelName);
235
+ // }
236
+ // return doc.toObject();
237
+ // });
238
+ // } else {
239
+ // return this.actionModel.create({
240
+ // ...params,
241
+ // actionStatus: factory.actionStatusType.ActiveActionStatus,
242
+ // startDate: new Date()
243
+ // })
244
+ // .then(
245
+ // (doc) => doc.toObject()
246
+ // );
247
+ // }
248
+ // }
235
249
  /**
236
250
  * アクション完了
237
251
  */
238
- complete(typeOf, actionId, result) {
239
- return __awaiter(this, void 0, void 0, function* () {
240
- return this.actionModel.findOneAndUpdate({
241
- typeOf: typeOf,
242
- _id: actionId
243
- }, {
244
- actionStatus: factory.actionStatusType.CompletedActionStatus,
245
- result: result,
246
- endDate: new Date()
247
- }, { new: true })
248
- .exec()
249
- .then((doc) => {
250
- if (doc === null) {
251
- throw new factory.errors.NotFound(this.actionModel.modelName);
252
- }
253
- return doc.toObject();
254
- });
255
- });
256
- }
252
+ // public async complete<T extends factory.actionType>(
253
+ // typeOf: T,
254
+ // actionId: string,
255
+ // result: any
256
+ // ): Promise<IAction<T>> {
257
+ // return this.actionModel.findOneAndUpdate(
258
+ // {
259
+ // typeOf: typeOf,
260
+ // _id: actionId
261
+ // },
262
+ // {
263
+ // actionStatus: factory.actionStatusType.CompletedActionStatus,
264
+ // result: result,
265
+ // endDate: new Date()
266
+ // },
267
+ // { new: true }
268
+ // )
269
+ // .exec()
270
+ // .then((doc) => {
271
+ // if (doc === null) {
272
+ // throw new factory.errors.NotFound(this.actionModel.modelName);
273
+ // }
274
+ // return doc.toObject();
275
+ // });
276
+ // }
257
277
  /**
258
278
  * アクション中止
259
279
  */
260
- cancel(typeOf, actionId) {
261
- return __awaiter(this, void 0, void 0, function* () {
262
- return this.actionModel.findOneAndUpdate({
263
- typeOf: typeOf,
264
- _id: actionId
265
- }, { actionStatus: factory.actionStatusType.CanceledActionStatus }, { new: true })
266
- .exec()
267
- .then((doc) => {
268
- if (doc === null) {
269
- throw new factory.errors.NotFound(this.actionModel.modelName);
270
- }
271
- return doc.toObject();
272
- });
273
- });
274
- }
280
+ // public async cancel<T extends factory.actionType>(
281
+ // typeOf: T,
282
+ // actionId: string
283
+ // ): Promise<IAction<T>> {
284
+ // return this.actionModel.findOneAndUpdate(
285
+ // {
286
+ // typeOf: typeOf,
287
+ // _id: actionId
288
+ // },
289
+ // { actionStatus: factory.actionStatusType.CanceledActionStatus },
290
+ // { new: true }
291
+ // )
292
+ // .exec()
293
+ // .then((doc) => {
294
+ // if (doc === null) {
295
+ // throw new factory.errors.NotFound(this.actionModel.modelName);
296
+ // }
297
+ // return doc.toObject();
298
+ // });
299
+ // }
275
300
  /**
276
301
  * アクション失敗
277
302
  */
278
- giveUp(typeOf, actionId, error) {
279
- return __awaiter(this, void 0, void 0, function* () {
280
- return this.actionModel.findOneAndUpdate({
281
- typeOf: typeOf,
282
- _id: actionId
283
- }, {
284
- actionStatus: factory.actionStatusType.FailedActionStatus,
285
- error: error,
286
- endDate: new Date()
287
- }, { new: true })
288
- .exec()
289
- .then((doc) => {
290
- if (doc === null) {
291
- throw new factory.errors.NotFound(this.actionModel.modelName);
292
- }
293
- return doc.toObject();
294
- });
295
- });
296
- }
303
+ // public async giveUp<T extends factory.actionType>(
304
+ // typeOf: T,
305
+ // actionId: string,
306
+ // error: any
307
+ // ): Promise<IAction<T>> {
308
+ // return this.actionModel.findOneAndUpdate(
309
+ // {
310
+ // typeOf: typeOf,
311
+ // _id: actionId
312
+ // },
313
+ // {
314
+ // actionStatus: factory.actionStatusType.FailedActionStatus,
315
+ // error: error,
316
+ // endDate: new Date()
317
+ // },
318
+ // { new: true }
319
+ // )
320
+ // .exec()
321
+ // .then((doc) => {
322
+ // if (doc === null) {
323
+ // throw new factory.errors.NotFound(this.actionModel.modelName);
324
+ // }
325
+ // return doc.toObject();
326
+ // });
327
+ // }
297
328
  /**
298
329
  * アクション検索
299
330
  */
300
- findById(typeOf, actionId) {
301
- return __awaiter(this, void 0, void 0, function* () {
302
- return this.actionModel.findOne({
303
- typeOf: typeOf,
304
- _id: actionId
305
- })
306
- .exec()
307
- .then((doc) => {
308
- if (doc === null) {
309
- throw new factory.errors.NotFound(this.actionModel.modelName);
310
- }
311
- return doc.toObject();
312
- });
313
- });
314
- }
315
- countTransferActions(params) {
316
- return __awaiter(this, void 0, void 0, function* () {
317
- const conditions = MongoRepository.CREATE_MONEY_TRANSFER_ACTIONS_MONGO_CONDITIONS(params);
318
- return this.actionModel.countDocuments({ $and: conditions })
319
- .setOptions({ maxTimeMS: 10000 })
320
- .exec();
321
- });
322
- }
331
+ // public async findById<T extends factory.actionType>(
332
+ // typeOf: T,
333
+ // actionId: string
334
+ // ): Promise<IAction<T>> {
335
+ // return this.actionModel.findOne(
336
+ // {
337
+ // typeOf: typeOf,
338
+ // _id: actionId
339
+ // }
340
+ // )
341
+ // .exec()
342
+ // .then((doc) => {
343
+ // if (doc === null) {
344
+ // throw new factory.errors.NotFound(this.actionModel.modelName);
345
+ // }
346
+ // return doc.toObject();
347
+ // });
348
+ // }
349
+ // public async countTransferActions(
350
+ // params: factory.account.action.moneyTransfer.ISearchConditions
351
+ // ): Promise<number> {
352
+ // const conditions = MongoRepository.CREATE_MONEY_TRANSFER_ACTIONS_MONGO_CONDITIONS(params);
353
+ // return this.actionModel.countDocuments({ $and: conditions })
354
+ // .setOptions({ maxTimeMS: 10000 })
355
+ // .exec();
356
+ // }
323
357
  /**
324
358
  * 転送アクションを検索する
325
359
  */
326
- searchTransferActions(params) {
327
- return __awaiter(this, void 0, void 0, function* () {
328
- const conditions = MongoRepository.CREATE_MONEY_TRANSFER_ACTIONS_MONGO_CONDITIONS(params);
329
- const query = this.actionModel.find({ $and: conditions }, {
330
- __v: 0,
331
- createdAt: 0,
332
- updatedAt: 0
333
- });
334
- // tslint:disable-next-line:no-single-line-block-comment
335
- /* istanbul ignore else */
336
- if (params.limit !== undefined && params.page !== undefined) {
337
- query.limit(params.limit)
338
- .skip(params.limit * (params.page - 1));
339
- }
340
- // tslint:disable-next-line:no-single-line-block-comment
341
- /* istanbul ignore else */
342
- if (params.sort !== undefined) {
343
- query.sort(params.sort);
344
- }
345
- return query.setOptions({ maxTimeMS: 10000 })
346
- .exec()
347
- .then((docs) => docs.map((doc) => doc.toObject()));
348
- });
349
- }
360
+ // public async searchTransferActions(
361
+ // params: factory.account.action.moneyTransfer.ISearchConditions
362
+ // ): Promise<factory.account.action.moneyTransfer.IAction[]> {
363
+ // const conditions = MongoRepository.CREATE_MONEY_TRANSFER_ACTIONS_MONGO_CONDITIONS(params);
364
+ // const query = this.actionModel.find(
365
+ // { $and: conditions },
366
+ // {
367
+ // __v: 0,
368
+ // createdAt: 0,
369
+ // updatedAt: 0
370
+ // }
371
+ // );
372
+ // // tslint:disable-next-line:no-single-line-block-comment
373
+ // /* istanbul ignore else */
374
+ // if (params.limit !== undefined && params.page !== undefined) {
375
+ // query.limit(params.limit)
376
+ // .skip(params.limit * (params.page - 1));
377
+ // }
378
+ // // tslint:disable-next-line:no-single-line-block-comment
379
+ // /* istanbul ignore else */
380
+ // if (params.sort !== undefined) {
381
+ // query.sort(params.sort);
382
+ // }
383
+ // return query.setOptions({ maxTimeMS: 10000 })
384
+ // .exec()
385
+ // .then((docs) => docs.map((doc) => doc.toObject()));
386
+ // }
350
387
  /**
351
388
  * アクションを検索する
352
389
  * @param searchConditions 検索条件
353
390
  */
354
- search(searchConditions) {
355
- return __awaiter(this, void 0, void 0, function* () {
356
- const andConditions = [
357
- { typeOf: searchConditions.typeOf },
358
- {
359
- startDate: {
360
- $exists: true,
361
- $gte: searchConditions.startDateFrom,
362
- $lte: searchConditions.startDateThrough
363
- }
364
- }
365
- ];
366
- // tslint:disable-next-line:no-single-line-block-comment
367
- /* istanbul ignore else */
368
- if (Array.isArray(searchConditions.actionStatuses) && searchConditions.actionStatuses.length > 0) {
369
- andConditions.push({
370
- actionStatus: { $in: searchConditions.actionStatuses }
371
- });
372
- }
373
- // tslint:disable-next-line:no-single-line-block-comment
374
- /* istanbul ignore else */
375
- if (Array.isArray(searchConditions.purposeTypeOfs) && searchConditions.purposeTypeOfs.length > 0) {
376
- andConditions.push({
377
- 'purpose.typeOf': {
378
- $exists: true,
379
- $in: searchConditions.purposeTypeOfs
380
- }
381
- });
382
- }
383
- // tslint:disable-next-line:no-single-line-block-comment
384
- /* istanbul ignore else */
385
- if (Array.isArray(searchConditions.fromLocationAccountNumbers) && searchConditions.fromLocationAccountNumbers.length > 0) {
386
- andConditions.push({
387
- 'fromLocation.accountNumber': {
388
- $exists: true,
389
- $in: searchConditions.fromLocationAccountNumbers
390
- }
391
- });
392
- }
393
- // tslint:disable-next-line:no-single-line-block-comment
394
- /* istanbul ignore else */
395
- if (Array.isArray(searchConditions.toLocationAccountNumbers) && searchConditions.toLocationAccountNumbers.length > 0) {
396
- andConditions.push({
397
- 'toLocation.accountNumber': {
398
- $exists: true,
399
- $in: searchConditions.toLocationAccountNumbers
400
- }
401
- });
402
- }
403
- return this.actionModel.find({ $and: andConditions }, {
404
- __v: 0,
405
- createdAt: 0,
406
- updatedAt: 0
407
- })
408
- .limit(searchConditions.limit)
409
- .exec()
410
- .then((docs) => docs.map((doc) => doc.toObject()));
411
- });
412
- }
391
+ // public async search<T extends factory.actionType>(searchConditions: {
392
+ // typeOf: T;
393
+ // actionStatuses?: factory.account.AccountStatusType[];
394
+ // startDateFrom?: Date;
395
+ // startDateThrough?: Date;
396
+ // purposeTypeOfs?: factory.account.transactionType[];
397
+ // fromLocationAccountNumbers?: string[];
398
+ // toLocationAccountNumbers?: string[];
399
+ // limit: number;
400
+ // }): Promise<IAction<T>[]> {
401
+ // const andConditions: any[] = [
402
+ // { typeOf: searchConditions.typeOf },
403
+ // {
404
+ // startDate: {
405
+ // $exists: true,
406
+ // $gte: searchConditions.startDateFrom,
407
+ // $lte: searchConditions.startDateThrough
408
+ // }
409
+ // }
410
+ // ];
411
+ // // tslint:disable-next-line:no-single-line-block-comment
412
+ // /* istanbul ignore else */
413
+ // if (Array.isArray(searchConditions.actionStatuses) && searchConditions.actionStatuses.length > 0) {
414
+ // andConditions.push({
415
+ // actionStatus: { $in: searchConditions.actionStatuses }
416
+ // });
417
+ // }
418
+ // // tslint:disable-next-line:no-single-line-block-comment
419
+ // /* istanbul ignore else */
420
+ // if (Array.isArray(searchConditions.purposeTypeOfs) && searchConditions.purposeTypeOfs.length > 0) {
421
+ // andConditions.push({
422
+ // 'purpose.typeOf': {
423
+ // $exists: true,
424
+ // $in: searchConditions.purposeTypeOfs
425
+ // }
426
+ // });
427
+ // }
428
+ // // tslint:disable-next-line:no-single-line-block-comment
429
+ // /* istanbul ignore else */
430
+ // if (Array.isArray(searchConditions.fromLocationAccountNumbers) && searchConditions.fromLocationAccountNumbers.length > 0) {
431
+ // andConditions.push({
432
+ // 'fromLocation.accountNumber': {
433
+ // $exists: true,
434
+ // $in: searchConditions.fromLocationAccountNumbers
435
+ // }
436
+ // });
437
+ // }
438
+ // // tslint:disable-next-line:no-single-line-block-comment
439
+ // /* istanbul ignore else */
440
+ // if (Array.isArray(searchConditions.toLocationAccountNumbers) && searchConditions.toLocationAccountNumbers.length > 0) {
441
+ // andConditions.push({
442
+ // 'toLocation.accountNumber': {
443
+ // $exists: true,
444
+ // $in: searchConditions.toLocationAccountNumbers
445
+ // }
446
+ // });
447
+ // }
448
+ // return this.actionModel.find(
449
+ // { $and: andConditions },
450
+ // {
451
+ // __v: 0,
452
+ // createdAt: 0,
453
+ // updatedAt: 0
454
+ // }
455
+ // )
456
+ // .limit(searchConditions.limit)
457
+ // .exec()
458
+ // .then((docs) => docs.map((doc) => doc.toObject()));
459
+ // }
413
460
  clean(params) {
414
461
  var _a;
415
462
  return __awaiter(this, void 0, void 0, function* () {