@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.
- package/example/src/chevre/deleteEvents.ts +9 -1
- package/example/src/chevre/migrateAccountTitleAdditionalProperties.ts +157 -0
- package/example/src/chevre/migrateCreativeWorkAdditionalProperties.ts +116 -0
- package/example/src/chevre/migrateEventOffersSellerMakesOffer.ts +139 -0
- package/example/src/chevre/migrateEventProjectAttributes.ts +57 -0
- package/example/src/chevre/migratePlaceAdditionalProperties.ts +162 -0
- package/example/src/chevre/migrateSSKTEventCOAEndpoint.ts +64 -0
- package/example/src/chevre/searchEvents.ts +36 -16
- package/lib/chevre/repo/accountAction.d.ts +0 -18
- package/lib/chevre/repo/accountAction.js +402 -355
- package/lib/chevre/repo/accountTitle.d.ts +1 -0
- package/lib/chevre/repo/accountTitle.js +6 -1
- package/lib/chevre/repo/additionalProperty.d.ts +35 -0
- package/lib/chevre/repo/additionalProperty.js +205 -0
- package/lib/chevre/repo/categoryCode.d.ts +1 -0
- package/lib/chevre/repo/categoryCode.js +15 -1
- package/lib/chevre/repo/creativeWork.js +10 -1
- package/lib/chevre/repo/customer.d.ts +1 -0
- package/lib/chevre/repo/customer.js +5 -0
- package/lib/chevre/repo/event.d.ts +12 -4
- package/lib/chevre/repo/event.js +84 -48
- package/lib/chevre/repo/merchantReturnPolicy.d.ts +1 -0
- package/lib/chevre/repo/merchantReturnPolicy.js +5 -0
- package/lib/chevre/repo/mongoose/model/additionalProperty.d.ts +7 -0
- package/lib/chevre/repo/mongoose/model/additionalProperty.js +81 -0
- package/lib/chevre/repo/mongoose/model/categoryCode.js +18 -2
- package/lib/chevre/repo/mongoose/model/creativeWork.js +6 -0
- package/lib/chevre/repo/mongoose/model/event.js +53 -0
- package/lib/chevre/repo/mongoose/model/offer.js +7 -1
- package/lib/chevre/repo/mongoose/model/offerCatalog.js +21 -2
- package/lib/chevre/repo/mongoose/model/ownershipInfo.js +3 -15
- package/lib/chevre/repo/mongoose/model/place.js +42 -0
- package/lib/chevre/repo/offer.js +10 -1
- package/lib/chevre/repo/offerCatalog.js +10 -10
- package/lib/chevre/repo/place.d.ts +1 -0
- package/lib/chevre/repo/place.js +54 -7
- package/lib/chevre/repo/reservation.d.ts +13 -0
- package/lib/chevre/repo/reservation.js +28 -0
- package/lib/chevre/repo/transaction.js +20 -5
- package/lib/chevre/repository.d.ts +6 -3
- package/lib/chevre/repository.js +10 -5
- package/lib/chevre/service/account.d.ts +0 -4
- package/lib/chevre/service/account.js +24 -22
- package/lib/chevre/service/accountTransaction/deposit.d.ts +0 -2
- package/lib/chevre/service/accountTransaction/deposit.js +3 -3
- package/lib/chevre/service/accountTransaction/transfer.d.ts +0 -2
- package/lib/chevre/service/accountTransaction/transfer.js +3 -3
- package/lib/chevre/service/accountTransaction/withdraw.d.ts +0 -2
- package/lib/chevre/service/accountTransaction/withdraw.js +3 -3
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +9 -19
- package/lib/chevre/service/assetTransaction/reserve/factory.js +119 -115
- package/lib/chevre/service/assetTransaction/reserve.js +99 -89
- package/lib/chevre/service/delivery/factory.js +2 -1
- package/lib/chevre/service/event.js +20 -6
- package/lib/chevre/service/offer/event/authorize.d.ts +4 -0
- package/lib/chevre/service/offer/event/authorize.js +65 -27
- package/lib/chevre/service/offer/event/factory.d.ts +1 -1
- package/lib/chevre/service/offer/event/factory.js +17 -12
- package/lib/chevre/service/offer/eventServiceByCOA/factory.js +19 -9
- package/lib/chevre/service/offer/factory.js +7 -20
- package/lib/chevre/service/offer.js +6 -6
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +4 -2
- package/lib/chevre/service/order/onOrderStatusChanged.js +3 -2
- package/lib/chevre/service/order/placeOrder.js +13 -5
- package/lib/chevre/service/order/returnOrder.js +2 -1
- package/lib/chevre/service/order/sendOrder.js +2 -1
- package/lib/chevre/service/reserve/cancelReservation.js +135 -87
- package/lib/chevre/service/reserve/confirmReservation.js +65 -33
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.d.ts +1 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +67 -30
- package/lib/chevre/service/task/confirmReserveTransaction.js +1 -1
- package/lib/chevre/service/transaction/orderProgramMembership.js +6 -8
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +6 -3
- package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +9 -4
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/givePointAward.js +2 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +2 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +2 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/sendEmailMessage.js +4 -3
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.js +2 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +10 -6
- package/lib/chevre/service/transaction/placeOrderInProgress/result.js +2 -4
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.d.ts +3 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.js +3 -2
- package/lib/chevre/service/transaction/placeOrderInProgress.js +16 -2
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.js +4 -5
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +6 -3
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.js +4 -6
- package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +2 -1
- package/lib/chevre/service/transaction/returnOrder.js +10 -1
- package/lib/chevre/service/transaction.js +1 -14
- package/package.json +4 -4
- package/example/src/chevre/accountBlanceTest.ts +0 -24
- package/example/src/chevre/checkOffersAppliesToMovieTicket.ts +0 -56
- package/example/src/chevre/createSeats.ts +0 -59
- package/example/src/chevre/manageOwnedByOfOwnershipInfo.ts +0 -35
- package/example/src/chevre/migrateEventOffersItemOfferedName.ts +0 -82
- package/example/src/chevre/migrateMovieTicketChargePriceSpecs.ts +0 -92
- package/example/src/chevre/migrateSellerMakesOffers.ts +0 -84
- package/example/src/chevre/migrateTTTSOldEventId.ts +0 -68
- package/example/src/chevre/publishConfirmationNumber.ts +0 -30
- package/example/src/chevre/publishServiceOutputIdentifier.ts +0 -28
- package/example/src/chevre/publishTransactionNumber.ts +0 -28
- package/example/src/chevre/renameTransaction.ts +0 -22
- package/lib/chevre/service/task/accountMoneyTransfer.d.ts +0 -3
- package/lib/chevre/service/task/accountMoneyTransfer.js +0 -31
- package/lib/chevre/service/task/cancelAccountMoneyTransfer.d.ts +0 -3
- 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(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
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(
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
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
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
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
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
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
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
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
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
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(
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
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
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
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* () {
|