@chevre/domain 20.4.0-alpha.0 → 20.4.0-alpha.10
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/createManyEventsIfNotExist.ts +10 -10
- package/example/src/chevre/migrateMoneyTransferPendingTransactionIdentifier.ts +96 -0
- package/example/src/chevre/unsetUnnecessaryFields.ts +26 -0
- package/lib/chevre/repo/account.d.ts +4 -10
- package/lib/chevre/repo/account.js +72 -60
- package/lib/chevre/repo/accountTransaction.d.ts +0 -1
- package/lib/chevre/repo/accountTransaction.js +1 -1
- package/lib/chevre/repo/assetTransaction.d.ts +1 -0
- package/lib/chevre/repo/assetTransaction.js +5 -0
- package/lib/chevre/repo/comment.d.ts +31 -0
- package/lib/chevre/repo/comment.js +113 -0
- package/lib/chevre/repo/event.js +7 -1
- package/lib/chevre/repo/mongoose/model/{accountAction.d.ts → comments.d.ts} +2 -2
- package/lib/chevre/repo/mongoose/model/comments.js +82 -0
- package/lib/chevre/repo/mongoose/model/order.js +8 -2
- package/lib/chevre/repo/order.d.ts +6 -0
- package/lib/chevre/repo/order.js +58 -14
- package/lib/chevre/repo/serviceOutput.d.ts +4 -0
- package/lib/chevre/repo/serviceOutput.js +6 -0
- package/lib/chevre/repository.d.ts +6 -3
- package/lib/chevre/repository.js +8 -5
- package/lib/chevre/service/account.d.ts +0 -8
- package/lib/chevre/service/account.js +16 -37
- package/lib/chevre/service/accountTransaction/deposit.js +2 -5
- package/lib/chevre/service/accountTransaction/factory.js +36 -40
- package/lib/chevre/service/accountTransaction/transfer.js +4 -6
- package/lib/chevre/service/accountTransaction/withdraw.js +2 -5
- package/lib/chevre/service/accountTransaction.js +1 -1
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +19 -11
- package/lib/chevre/service/assetTransaction/pay.js +17 -11
- package/lib/chevre/service/assetTransaction/registerService/factory.js +9 -4
- package/lib/chevre/service/delivery.js +12 -3
- package/lib/chevre/service/event.js +3 -23
- package/lib/chevre/service/moneyTransfer.d.ts +1 -1
- package/lib/chevre/service/moneyTransfer.js +8 -9
- package/lib/chevre/service/offer/moneyTransfer/authorize.js +0 -1
- package/lib/chevre/service/offer/moneyTransfer/returnMoneyTransfer.js +0 -1
- package/lib/chevre/service/payment/paymentCard.d.ts +6 -2
- package/lib/chevre/service/payment/paymentCard.js +16 -8
- package/lib/chevre/service/permit.d.ts +5 -1
- package/lib/chevre/service/permit.js +18 -11
- package/lib/chevre/service/transaction/moneyTransfer.js +0 -1
- package/lib/chevre/settings.d.ts +1 -0
- package/lib/chevre/settings.js +2 -2
- package/package.json +3 -3
- package/example/src/chevre/migrateAccountTitleAdditionalProperties.ts +0 -157
- package/example/src/chevre/migrateProjectSubscription.ts +0 -51
- package/example/src/chevre/migrateSection.ts +0 -105
- package/lib/chevre/repo/accountAction.d.ts +0 -42
- package/lib/chevre/repo/accountAction.js +0 -474
- package/lib/chevre/repo/mongoose/model/accountAction.js +0 -177
|
@@ -1,474 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.MongoRepository = exports.modelName = void 0;
|
|
13
|
-
const factory = require("../factory");
|
|
14
|
-
const accountAction_1 = require("./mongoose/model/accountAction");
|
|
15
|
-
Object.defineProperty(exports, "modelName", { enumerable: true, get: function () { return accountAction_1.modelName; } });
|
|
16
|
-
/**
|
|
17
|
-
* 口座アクションリポジトリ
|
|
18
|
-
*/
|
|
19
|
-
class MongoRepository {
|
|
20
|
-
constructor(connection) {
|
|
21
|
-
this.actionModel = connection.model(accountAction_1.modelName);
|
|
22
|
-
}
|
|
23
|
-
// tslint:disable-next-line:max-func-body-length
|
|
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
|
-
// }
|
|
193
|
-
/**
|
|
194
|
-
* アクション開始
|
|
195
|
-
*/
|
|
196
|
-
// public async start<T extends factory.actionType>(
|
|
197
|
-
// params: factory.account.action.moneyTransfer.IAttributes
|
|
198
|
-
// ): Promise<IAction<T>> {
|
|
199
|
-
// return this.actionModel.create({
|
|
200
|
-
// ...params,
|
|
201
|
-
// actionStatus: factory.actionStatusType.ActiveActionStatus,
|
|
202
|
-
// startDate: new Date()
|
|
203
|
-
// })
|
|
204
|
-
// .then(
|
|
205
|
-
// (doc) => doc.toObject()
|
|
206
|
-
// );
|
|
207
|
-
// }
|
|
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
|
-
// }
|
|
249
|
-
/**
|
|
250
|
-
* アクション完了
|
|
251
|
-
*/
|
|
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
|
-
// }
|
|
277
|
-
/**
|
|
278
|
-
* アクション中止
|
|
279
|
-
*/
|
|
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
|
-
// }
|
|
300
|
-
/**
|
|
301
|
-
* アクション失敗
|
|
302
|
-
*/
|
|
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
|
-
// }
|
|
328
|
-
/**
|
|
329
|
-
* アクション検索
|
|
330
|
-
*/
|
|
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
|
-
// }
|
|
357
|
-
/**
|
|
358
|
-
* 転送アクションを検索する
|
|
359
|
-
*/
|
|
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
|
-
// }
|
|
387
|
-
/**
|
|
388
|
-
* アクションを検索する
|
|
389
|
-
* @param searchConditions 検索条件
|
|
390
|
-
*/
|
|
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
|
-
// }
|
|
460
|
-
clean(params) {
|
|
461
|
-
var _a;
|
|
462
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
463
|
-
yield this.actionModel.deleteMany(Object.assign({ actionStatus: {
|
|
464
|
-
$in: [
|
|
465
|
-
factory.actionStatusType.CanceledActionStatus,
|
|
466
|
-
factory.actionStatusType.CompletedActionStatus,
|
|
467
|
-
factory.actionStatusType.FailedActionStatus
|
|
468
|
-
]
|
|
469
|
-
}, startDate: { $lt: params.startDate.$lt } }, (typeof ((_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === 'string') ? { 'project.id': { $eq: params.project.id } } : undefined))
|
|
470
|
-
.exec();
|
|
471
|
-
});
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
exports.MongoRepository = MongoRepository;
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.schema = exports.modelName = void 0;
|
|
4
|
-
const mongoose = require("mongoose");
|
|
5
|
-
const modelName = 'AccountAction';
|
|
6
|
-
exports.modelName = modelName;
|
|
7
|
-
const writeConcern = { j: true, w: 'majority', wtimeout: 10000 };
|
|
8
|
-
/**
|
|
9
|
-
* アクションスキーマ
|
|
10
|
-
*/
|
|
11
|
-
const schema = new mongoose.Schema({
|
|
12
|
-
project: mongoose.SchemaTypes.Mixed,
|
|
13
|
-
actionStatus: String,
|
|
14
|
-
typeOf: String,
|
|
15
|
-
identifier: String,
|
|
16
|
-
description: String,
|
|
17
|
-
agent: mongoose.SchemaTypes.Mixed,
|
|
18
|
-
recipient: mongoose.SchemaTypes.Mixed,
|
|
19
|
-
result: mongoose.SchemaTypes.Mixed,
|
|
20
|
-
error: mongoose.SchemaTypes.Mixed,
|
|
21
|
-
object: mongoose.SchemaTypes.Mixed,
|
|
22
|
-
startDate: Date,
|
|
23
|
-
endDate: Date,
|
|
24
|
-
purpose: mongoose.SchemaTypes.Mixed,
|
|
25
|
-
potentialActions: mongoose.SchemaTypes.Mixed,
|
|
26
|
-
amount: mongoose.SchemaTypes.Mixed,
|
|
27
|
-
fromLocation: mongoose.SchemaTypes.Mixed,
|
|
28
|
-
toLocation: mongoose.SchemaTypes.Mixed,
|
|
29
|
-
instrument: mongoose.SchemaTypes.Mixed
|
|
30
|
-
}, {
|
|
31
|
-
collection: 'accountActions',
|
|
32
|
-
id: true,
|
|
33
|
-
read: 'primaryPreferred',
|
|
34
|
-
writeConcern: writeConcern,
|
|
35
|
-
strict: true,
|
|
36
|
-
useNestedStrict: true,
|
|
37
|
-
timestamps: {
|
|
38
|
-
createdAt: 'createdAt',
|
|
39
|
-
updatedAt: 'updatedAt'
|
|
40
|
-
},
|
|
41
|
-
toJSON: {
|
|
42
|
-
getters: false,
|
|
43
|
-
virtuals: false,
|
|
44
|
-
minimize: false,
|
|
45
|
-
versionKey: false
|
|
46
|
-
},
|
|
47
|
-
toObject: {
|
|
48
|
-
getters: false,
|
|
49
|
-
virtuals: true,
|
|
50
|
-
minimize: false,
|
|
51
|
-
versionKey: false
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
exports.schema = schema;
|
|
55
|
-
schema.index({ createdAt: 1 }, { name: 'searchByCreatedAt' });
|
|
56
|
-
schema.index({ updatedAt: 1 }, { name: 'searchByUpdatedAt' });
|
|
57
|
-
schema.index({ identifier: 1 }, {
|
|
58
|
-
unique: true,
|
|
59
|
-
partialFilterExpression: {
|
|
60
|
-
identifier: { $exists: true }
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
schema.index({ identifier: 1, startDate: -1 }, {
|
|
64
|
-
partialFilterExpression: {
|
|
65
|
-
identifier: { $exists: true }
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
schema.index({ 'project.id': 1, startDate: -1 }, {
|
|
69
|
-
name: 'searchByProjectId-v20220721'
|
|
70
|
-
});
|
|
71
|
-
schema.index({ typeOf: 1, startDate: -1 }, { name: 'searchByTypeOf-v2' });
|
|
72
|
-
schema.index({ actionStatus: 1, startDate: -1 }, { name: 'searchByActionStatus-v2' });
|
|
73
|
-
schema.index({ startDate: -1 }, { name: 'searchByStartDate-v2' });
|
|
74
|
-
schema.index({ endDate: -1, startDate: -1 }, {
|
|
75
|
-
name: 'searchByEndDate-v2',
|
|
76
|
-
partialFilterExpression: {
|
|
77
|
-
endDate: { $exists: true }
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
schema.index({ 'amount.currency': 1, startDate: -1 }, {
|
|
81
|
-
name: 'searchByAmountCurrency',
|
|
82
|
-
partialFilterExpression: {
|
|
83
|
-
'amount.currency': { $exists: true }
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
schema.index({ 'purpose.typeOf': 1, startDate: -1 }, {
|
|
87
|
-
name: 'searchByPurposeTypeOf-v2',
|
|
88
|
-
partialFilterExpression: {
|
|
89
|
-
'purpose.typeOf': { $exists: true }
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
schema.index({ 'purpose.id': 1, startDate: -1 }, {
|
|
93
|
-
name: 'searchByPurposeId-v2',
|
|
94
|
-
partialFilterExpression: {
|
|
95
|
-
'purpose.id': { $exists: true }
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
schema.index({ 'purpose.identifier': 1, startDate: -1 }, {
|
|
99
|
-
name: 'searchByPurposeIdentifier',
|
|
100
|
-
partialFilterExpression: {
|
|
101
|
-
'purpose.identifier': { $exists: true }
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
schema.index({ 'purpose.transactionNumber': 1, startDate: -1 }, {
|
|
105
|
-
name: 'searchByPurposeTransactionNumber',
|
|
106
|
-
partialFilterExpression: {
|
|
107
|
-
'purpose.transactionNumber': { $exists: true }
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
schema.index({ 'object.typeOf': 1, startDate: -1 }, {
|
|
111
|
-
name: 'searchByObjectTypeOf-v2',
|
|
112
|
-
partialFilterExpression: {
|
|
113
|
-
'object.typeOf': { $exists: true }
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
schema.index({ 'fromLocation.typeOf': 1, startDate: -1 }, {
|
|
117
|
-
name: 'searchByFromLocationTypeOf-v2',
|
|
118
|
-
partialFilterExpression: {
|
|
119
|
-
'fromLocation.typeOf': { $exists: true }
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
schema.index({ 'fromLocation.accountNumber': 1, startDate: -1 }, {
|
|
123
|
-
name: 'searchByFromLocationAccountNumber-v2',
|
|
124
|
-
partialFilterExpression: {
|
|
125
|
-
'fromLocation.accountNumber': { $exists: true }
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
schema.index({ 'fromLocation.accountType': 1, startDate: -1 }, {
|
|
129
|
-
name: 'searchByFromLocationAccountType-v2',
|
|
130
|
-
partialFilterExpression: {
|
|
131
|
-
'fromLocation.accountType': { $exists: true }
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
schema.index({ 'toLocation.typeOf': 1, startDate: -1 }, {
|
|
135
|
-
name: 'searchByToLocationTypeOf-v2',
|
|
136
|
-
partialFilterExpression: {
|
|
137
|
-
'toLocation.typeOf': { $exists: true }
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
schema.index({ 'toLocation.accountNumber': 1, startDate: -1 }, {
|
|
141
|
-
name: 'searchByToLocationAccountNumber-v2',
|
|
142
|
-
partialFilterExpression: {
|
|
143
|
-
'toLocation.accountNumber': { $exists: true }
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
schema.index({ 'toLocation.accountType': 1, startDate: -1 }, {
|
|
147
|
-
name: 'searchByToLocationAccountType-v2',
|
|
148
|
-
partialFilterExpression: {
|
|
149
|
-
'toLocation.accountType': { $exists: true }
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
schema.index({ 'fromLocation.typeOf': 1, 'fromLocation.accountType': 1, 'fromLocation.accountNumber': 1, endDate: -1 }, {
|
|
153
|
-
name: 'searchTransferActionsByFromAccountLocation',
|
|
154
|
-
partialFilterExpression: {
|
|
155
|
-
'fromLocation.typeOf': { $exists: true },
|
|
156
|
-
'fromLocation.accountType': { $exists: true },
|
|
157
|
-
'fromLocation.accountNumber': { $exists: true }
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
schema.index({ 'toLocation.typeOf': 1, 'toLocation.accountType': 1, 'toLocation.accountNumber': 1, endDate: -1 }, {
|
|
161
|
-
name: 'searchTransferActionsByToAccountLocation',
|
|
162
|
-
partialFilterExpression: {
|
|
163
|
-
'toLocation.typeOf': { $exists: true },
|
|
164
|
-
'toLocation.accountType': { $exists: true },
|
|
165
|
-
'toLocation.accountNumber': { $exists: true }
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
mongoose.model(modelName, schema)
|
|
169
|
-
.on('index',
|
|
170
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
171
|
-
/* istanbul ignore next */
|
|
172
|
-
(error) => {
|
|
173
|
-
if (error !== undefined) {
|
|
174
|
-
// tslint:disable-next-line:no-console
|
|
175
|
-
console.error(error);
|
|
176
|
-
}
|
|
177
|
-
});
|