@chevre/domain 20.4.0-alpha.1 → 20.4.0-alpha.3
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/lib/chevre/repo/accountTransaction.d.ts +0 -1
- package/lib/chevre/repo/accountTransaction.js +1 -1
- package/lib/chevre/repo/event.js +17 -2
- package/lib/chevre/repository.d.ts +0 -3
- package/lib/chevre/repository.js +0 -4
- package/lib/chevre/service/account.js +0 -27
- package/lib/chevre/service/accountTransaction/deposit.js +0 -4
- package/lib/chevre/service/accountTransaction/factory.js +11 -20
- package/lib/chevre/service/accountTransaction/transfer.js +0 -4
- package/lib/chevre/service/accountTransaction/withdraw.js +0 -4
- package/lib/chevre/service/accountTransaction.js +1 -1
- package/lib/chevre/service/moneyTransfer.js +1 -1
- package/lib/chevre/service/payment/paymentCard.d.ts +1 -1
- package/package.json +3 -3
- package/lib/chevre/repo/accountAction.d.ts +0 -42
- package/lib/chevre/repo/accountAction.js +0 -474
- package/lib/chevre/repo/mongoose/model/accountAction.d.ts +0 -7
- package/lib/chevre/repo/mongoose/model/accountAction.js +0 -177
|
@@ -34,7 +34,6 @@ export declare class MongoRepository {
|
|
|
34
34
|
confirm<T extends factory.account.transactionType>(params: {
|
|
35
35
|
typeOf?: T;
|
|
36
36
|
id: string;
|
|
37
|
-
result: factory.account.transaction.IResult;
|
|
38
37
|
potentialActions: factory.account.transaction.IPotentialActions;
|
|
39
38
|
}): Promise<factory.account.transaction.ITransaction<T>>;
|
|
40
39
|
/**
|
|
@@ -154,7 +154,7 @@ class MongoRepository {
|
|
|
154
154
|
const doc = yield this.transactionModel.findOneAndUpdate(Object.assign({ _id: params.id, status: factory.transactionStatusType.InProgress }, (typeof params.typeOf === 'string') ? { typeOf: params.typeOf } : undefined), {
|
|
155
155
|
status: factory.transactionStatusType.Confirmed,
|
|
156
156
|
endDate: new Date(),
|
|
157
|
-
result: params.result,
|
|
157
|
+
// result: params.result, // resultを更新
|
|
158
158
|
potentialActions: params.potentialActions
|
|
159
159
|
}, { new: true })
|
|
160
160
|
.exec();
|
package/lib/chevre/repo/event.js
CHANGED
|
@@ -466,14 +466,18 @@ class MongoRepository {
|
|
|
466
466
|
if (Array.isArray(params)) {
|
|
467
467
|
params.forEach((creatingEventParams) => {
|
|
468
468
|
var _a, _b;
|
|
469
|
+
if (creatingEventParams.attributes.typeOf !== factory.eventType.ScreeningEvent) {
|
|
470
|
+
throw new factory.errors.NotImplemented(`${factory.eventType.ScreeningEventSeries} not implemented`);
|
|
471
|
+
}
|
|
469
472
|
const additionalPropertyValue = (_b = (_a = creatingEventParams.attributes.additionalProperty) === null || _a === void 0 ? void 0 : _a.find((property) => property.name === creatingEventParams.filter.name)) === null || _b === void 0 ? void 0 : _b.value;
|
|
470
473
|
if (typeof additionalPropertyValue !== 'string') {
|
|
471
474
|
throw new factory.errors.NotFound('additionalProperty.value');
|
|
472
475
|
}
|
|
476
|
+
const _c = creatingEventParams.attributes, { identifier, project, superEvent, workPerformed, typeOf, location, name, remainingAttendeeCapacity, maximumAttendeeCapacity } = _c, updateFields = __rest(_c, ["identifier", "project", "superEvent", "workPerformed", "typeOf", "location", "name", "remainingAttendeeCapacity", "maximumAttendeeCapacity"]);
|
|
473
477
|
bulkWriteOps.push({
|
|
474
478
|
updateOne: {
|
|
475
479
|
filter: {
|
|
476
|
-
typeOf
|
|
480
|
+
typeOf,
|
|
477
481
|
// 追加特性をキーに更新
|
|
478
482
|
additionalProperty: {
|
|
479
483
|
$exists: true,
|
|
@@ -481,7 +485,18 @@ class MongoRepository {
|
|
|
481
485
|
}
|
|
482
486
|
},
|
|
483
487
|
update: {
|
|
484
|
-
$setOnInsert:
|
|
488
|
+
$setOnInsert: {
|
|
489
|
+
_id: uniqid(),
|
|
490
|
+
typeOf,
|
|
491
|
+
project,
|
|
492
|
+
superEvent,
|
|
493
|
+
workPerformed,
|
|
494
|
+
location,
|
|
495
|
+
name
|
|
496
|
+
// ...creatingEventParams.attributes
|
|
497
|
+
},
|
|
498
|
+
// 変更可能な属性のみ上書き
|
|
499
|
+
$set: updateFields
|
|
485
500
|
},
|
|
486
501
|
upsert: true
|
|
487
502
|
}
|
package/lib/chevre/repository.js
CHANGED
|
@@ -53,12 +53,6 @@ exports.close = close;
|
|
|
53
53
|
*/
|
|
54
54
|
function transferMoney(actionAttributes) {
|
|
55
55
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
// 口座取引におけるAccountAction管理を廃止(2022-11-28~)
|
|
57
|
-
// let action = await repos.accountAction.startByIdentifier<factory.actionType.MoneyTransfer>(actionAttributes);
|
|
58
|
-
// すでに完了していれば何もしない
|
|
59
|
-
// if (action.actionStatus === factory.actionStatusType.CompletedActionStatus) {
|
|
60
|
-
// return;
|
|
61
|
-
// }
|
|
62
56
|
const action = actionAttributes;
|
|
63
57
|
let fromAccountNumber;
|
|
64
58
|
let toAccountNumber;
|
|
@@ -81,18 +75,8 @@ function transferMoney(actionAttributes) {
|
|
|
81
75
|
});
|
|
82
76
|
}
|
|
83
77
|
catch (error) {
|
|
84
|
-
// actionにエラー結果を追加
|
|
85
|
-
// try {
|
|
86
|
-
// const actionError = { ...error, message: error.message, name: error.name };
|
|
87
|
-
// await repos.accountAction.giveUp(action.typeOf, action.id, actionError);
|
|
88
|
-
// } catch (__) {
|
|
89
|
-
// // 失敗したら仕方ない
|
|
90
|
-
// }
|
|
91
78
|
throw error;
|
|
92
79
|
}
|
|
93
|
-
// アクション完了
|
|
94
|
-
// const actionResult: factory.account.action.moneyTransfer.IResult = {};
|
|
95
|
-
// action = await repos.accountAction.complete(action.typeOf, action.id, actionResult);
|
|
96
80
|
});
|
|
97
81
|
}
|
|
98
82
|
exports.transferMoney = transferMoney;
|
|
@@ -133,17 +117,6 @@ function cancelMoneyTransfer(params) {
|
|
|
133
117
|
: transaction.object.amount.value,
|
|
134
118
|
transactionId: transaction.id
|
|
135
119
|
});
|
|
136
|
-
// 口座取引におけるAccountAction管理を廃止(2022-11-28~)
|
|
137
|
-
// アクション取得
|
|
138
|
-
// const actions = await repos.accountAction.searchTransferActions({
|
|
139
|
-
// purpose: {
|
|
140
|
-
// typeOf: { $eq: transaction.typeOf },
|
|
141
|
-
// id: { $eq: transaction.id }
|
|
142
|
-
// }
|
|
143
|
-
// });
|
|
144
|
-
// await Promise.all(actions.map(async (action) => {
|
|
145
|
-
// await repos.accountAction.cancel(action.typeOf, action.id);
|
|
146
|
-
// }));
|
|
147
120
|
});
|
|
148
121
|
}
|
|
149
122
|
exports.cancelMoneyTransfer = cancelMoneyTransfer;
|
|
@@ -63,10 +63,6 @@ function start(params) {
|
|
|
63
63
|
accountNumber: params.object.toLocation.accountNumber,
|
|
64
64
|
transaction: pendingTransaction
|
|
65
65
|
});
|
|
66
|
-
// 口座取引におけるAccountAction管理を廃止(2022-11-28~)
|
|
67
|
-
// アクション開始
|
|
68
|
-
// const moneyTransferActionAttributes = createMoneyTransferActionAttributes({ transaction });
|
|
69
|
-
// await repos.accountAction.startByIdentifier(moneyTransferActionAttributes);
|
|
70
66
|
// 結果返却
|
|
71
67
|
return transaction;
|
|
72
68
|
});
|
|
@@ -8,9 +8,7 @@ const factory = require("../../factory");
|
|
|
8
8
|
/**
|
|
9
9
|
* 転送アクション属性作成
|
|
10
10
|
*/
|
|
11
|
-
// tslint:disable-next-line:max-func-body-length
|
|
12
11
|
function createMoneyTransferActionAttributes(params) {
|
|
13
|
-
var _a, _b;
|
|
14
12
|
const transaction = params.transaction;
|
|
15
13
|
let fromLocation = {
|
|
16
14
|
typeOf: transaction.agent.typeOf,
|
|
@@ -22,11 +20,6 @@ function createMoneyTransferActionAttributes(params) {
|
|
|
22
20
|
};
|
|
23
21
|
switch (transaction.typeOf) {
|
|
24
22
|
case factory.account.transactionType.Deposit:
|
|
25
|
-
if (typeof ((_a = transaction.object.fromLocation) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') {
|
|
26
|
-
fromLocation = Object.assign({ typeOf: transaction.object.fromLocation.typeOf, name: transaction.agent.name }, (typeof transaction.object.fromLocation.id === 'string')
|
|
27
|
-
? { id: transaction.object.fromLocation.id }
|
|
28
|
-
: undefined);
|
|
29
|
-
}
|
|
30
23
|
toLocation = {
|
|
31
24
|
typeOf: transaction.object.toLocation.typeOf,
|
|
32
25
|
accountType: transaction.object.toLocation.accountType,
|
|
@@ -55,11 +48,6 @@ function createMoneyTransferActionAttributes(params) {
|
|
|
55
48
|
accountNumber: transaction.object.fromLocation.accountNumber,
|
|
56
49
|
name: transaction.agent.name
|
|
57
50
|
};
|
|
58
|
-
if (typeof ((_b = transaction.object.toLocation) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string') {
|
|
59
|
-
toLocation = Object.assign({ typeOf: transaction.object.toLocation.typeOf, name: transaction.recipient.name }, (typeof transaction.object.toLocation.id === 'string')
|
|
60
|
-
? { id: transaction.object.toLocation.id }
|
|
61
|
-
: undefined);
|
|
62
|
-
}
|
|
63
51
|
break;
|
|
64
52
|
default:
|
|
65
53
|
}
|
|
@@ -78,15 +66,20 @@ function createMoneyTransferActionAttributes(params) {
|
|
|
78
66
|
default:
|
|
79
67
|
throw new factory.errors.NotImplemented(`transaction type ${transactionType} not implemented`);
|
|
80
68
|
}
|
|
69
|
+
const purpose = {
|
|
70
|
+
typeOf: transaction.typeOf,
|
|
71
|
+
id: transaction.id,
|
|
72
|
+
transactionNumber: transaction.transactionNumber
|
|
73
|
+
// ...(typeof transaction.identifier === 'string')
|
|
74
|
+
// ? { identifier: transaction.identifier }
|
|
75
|
+
// : /* istanbul ignore next */ undefined
|
|
76
|
+
};
|
|
81
77
|
return {
|
|
82
78
|
project: transaction.project,
|
|
83
79
|
typeOf: factory.actionType.MoneyTransfer,
|
|
84
|
-
identifier: `${factory.actionType.MoneyTransfer}-${transaction.typeOf}-${transaction.id}`,
|
|
80
|
+
// identifier: `${factory.actionType.MoneyTransfer}-${transaction.typeOf}-${transaction.id}`,
|
|
85
81
|
description: transaction.object.description,
|
|
86
|
-
//
|
|
87
|
-
// amount: transaction.object.amount
|
|
88
|
-
// },
|
|
89
|
-
object: {},
|
|
82
|
+
// object: {},
|
|
90
83
|
agent: transaction.agent,
|
|
91
84
|
recipient: transaction.recipient,
|
|
92
85
|
amount: {
|
|
@@ -98,9 +91,7 @@ function createMoneyTransferActionAttributes(params) {
|
|
|
98
91
|
},
|
|
99
92
|
fromLocation: fromLocation,
|
|
100
93
|
toLocation: toLocation,
|
|
101
|
-
purpose
|
|
102
|
-
? { identifier: transaction.identifier }
|
|
103
|
-
: /* istanbul ignore next */ undefined)
|
|
94
|
+
purpose
|
|
104
95
|
};
|
|
105
96
|
}
|
|
106
97
|
exports.createMoneyTransferActionAttributes = createMoneyTransferActionAttributes;
|
|
@@ -95,10 +95,6 @@ function start(params) {
|
|
|
95
95
|
accountNumber: params.object.toLocation.accountNumber,
|
|
96
96
|
transaction: pendingTransaction
|
|
97
97
|
});
|
|
98
|
-
// 口座取引におけるAccountAction管理を廃止(2022-11-28~)
|
|
99
|
-
// アクション開始
|
|
100
|
-
// const moneyTransferActionAttributes = createMoneyTransferActionAttributes({ transaction });
|
|
101
|
-
// await repos.accountAction.startByIdentifier(moneyTransferActionAttributes);
|
|
102
98
|
// 結果返却
|
|
103
99
|
return transaction;
|
|
104
100
|
});
|
|
@@ -74,10 +74,6 @@ function start(params) {
|
|
|
74
74
|
transaction: pendingTransaction,
|
|
75
75
|
force: forcibly
|
|
76
76
|
});
|
|
77
|
-
// 口座取引におけるAccountAction管理を廃止(2022-11-28~)
|
|
78
|
-
// アクション開始
|
|
79
|
-
// const moneyTransferActionAttributes = createMoneyTransferActionAttributes({ transaction });
|
|
80
|
-
// await repos.accountAction.startByIdentifier(moneyTransferActionAttributes);
|
|
81
77
|
// 結果返却
|
|
82
78
|
return transaction;
|
|
83
79
|
});
|
|
@@ -513,7 +513,7 @@ function processDepositFromNow(params, permitServiceCredentials, transactionNumb
|
|
|
513
513
|
recipient, object: {
|
|
514
514
|
amount: { value: amount },
|
|
515
515
|
description: description,
|
|
516
|
-
fromLocation: params.fromLocation,
|
|
516
|
+
// fromLocation: params.fromLocation,
|
|
517
517
|
toLocation: { accountNumber: String((_a = permit.paymentAccount) === null || _a === void 0 ? void 0 : _a.accountNumber) }
|
|
518
518
|
} }, (typeof accountTransactionIdentifier === 'string') ? { identifier: accountTransactionIdentifier } : undefined));
|
|
519
519
|
try {
|
|
@@ -6,7 +6,7 @@ import { MongoRepository as ProductRepo } from '../../repo/product';
|
|
|
6
6
|
import { MongoRepository as ProjectRepo } from '../../repo/project';
|
|
7
7
|
import { MongoRepository as TaskRepo } from '../../repo/task';
|
|
8
8
|
import { RedisRepository as TransactionNumberRepo } from '../../repo/transactionNumber';
|
|
9
|
-
declare type IPendingTransaction = factory.account.transaction.withdraw.ITransaction
|
|
9
|
+
declare type IPendingTransaction = Pick<factory.account.transaction.withdraw.ITransaction, 'id' | 'object' | 'transactionNumber' | 'typeOf'>;
|
|
10
10
|
declare function authorize(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, paymentServiceId: string): (repos: {
|
|
11
11
|
product: ProductRepo;
|
|
12
12
|
project: ProjectRepo;
|
package/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.289.0-alpha.
|
|
13
|
-
"@cinerino/sdk": "3.140.0-alpha.
|
|
12
|
+
"@chevre/factory": "4.289.0-alpha.5",
|
|
13
|
+
"@cinerino/sdk": "3.140.0-alpha.6",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
16
16
|
"@sendgrid/mail": "6.4.0",
|
|
@@ -120,5 +120,5 @@
|
|
|
120
120
|
"postversion": "git push origin --tags",
|
|
121
121
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
122
122
|
},
|
|
123
|
-
"version": "20.4.0-alpha.
|
|
123
|
+
"version": "20.4.0-alpha.3"
|
|
124
124
|
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { Connection } from 'mongoose';
|
|
2
|
-
import * as factory from '../factory';
|
|
3
|
-
import { modelName } from './mongoose/model/accountAction';
|
|
4
|
-
export { modelName };
|
|
5
|
-
export declare type IAction<T extends factory.actionType> = T extends factory.actionType.MoneyTransfer ? factory.account.action.moneyTransfer.IAction : never;
|
|
6
|
-
/**
|
|
7
|
-
* 口座アクションリポジトリ
|
|
8
|
-
*/
|
|
9
|
-
export declare class MongoRepository {
|
|
10
|
-
private readonly actionModel;
|
|
11
|
-
constructor(connection: Connection);
|
|
12
|
-
/**
|
|
13
|
-
* アクション開始
|
|
14
|
-
*/
|
|
15
|
-
/**
|
|
16
|
-
* アクション完了
|
|
17
|
-
*/
|
|
18
|
-
/**
|
|
19
|
-
* アクション中止
|
|
20
|
-
*/
|
|
21
|
-
/**
|
|
22
|
-
* アクション失敗
|
|
23
|
-
*/
|
|
24
|
-
/**
|
|
25
|
-
* アクション検索
|
|
26
|
-
*/
|
|
27
|
-
/**
|
|
28
|
-
* 転送アクションを検索する
|
|
29
|
-
*/
|
|
30
|
-
/**
|
|
31
|
-
* アクションを検索する
|
|
32
|
-
* @param searchConditions 検索条件
|
|
33
|
-
*/
|
|
34
|
-
clean(params: {
|
|
35
|
-
project?: {
|
|
36
|
-
id?: string;
|
|
37
|
-
};
|
|
38
|
-
startDate: {
|
|
39
|
-
$lt: Date;
|
|
40
|
-
};
|
|
41
|
-
}): Promise<void>;
|
|
42
|
-
}
|
|
@@ -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,7 +0,0 @@
|
|
|
1
|
-
import * as mongoose from 'mongoose';
|
|
2
|
-
declare const modelName = "AccountAction";
|
|
3
|
-
/**
|
|
4
|
-
* アクションスキーマ
|
|
5
|
-
*/
|
|
6
|
-
declare const schema: mongoose.Schema<mongoose.Document<any, any, any>, mongoose.Model<mongoose.Document<any, any, any>, any, any>, undefined, {}>;
|
|
7
|
-
export { modelName, schema };
|
|
@@ -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
|
-
});
|