@chevre/domain 24.0.0-alpha.83 → 24.0.0-alpha.84
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/product.js +0 -3
- package/lib/chevre/repo/transaction.d.ts +4 -4
- package/lib/chevre/repository.d.ts +0 -25
- package/lib/chevre/repository.js +2 -57
- package/lib/chevre/service/assetTransaction/reserve/start/createSubReservations.js +1 -19
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.js +1 -31
- package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.js +1 -5
- package/lib/chevre/service/task/deletePerson.js +0 -2
- package/lib/chevre/service/task/onResourceDeleted.js +0 -3
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +4 -4
- package/lib/chevre/service.d.ts +0 -12
- package/lib/chevre/service.js +1 -35
- package/package.json +2 -2
- package/lib/chevre/factory/availableProductTypes.d.ts +0 -1
- package/lib/chevre/factory/availableProductTypes.js +0 -8
- package/lib/chevre/repo/account.d.ts +0 -129
- package/lib/chevre/repo/account.js +0 -391
- package/lib/chevre/repo/accountTransaction.d.ts +0 -65
- package/lib/chevre/repo/accountTransaction.js +0 -277
- package/lib/chevre/repo/mongoose/schemas/account.d.ts +0 -11
- package/lib/chevre/repo/mongoose/schemas/account.js +0 -118
- package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +0 -11
- package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +0 -149
- package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +0 -11
- package/lib/chevre/repo/mongoose/schemas/serviceOutput.js +0 -144
- package/lib/chevre/repo/permit.d.ts +0 -42
- package/lib/chevre/repo/permit.js +0 -77
- package/lib/chevre/repo/serviceOutput.d.ts +0 -36
- package/lib/chevre/repo/serviceOutput.js +0 -167
- package/lib/chevre/repo/serviceOutputIdentifier.d.ts +0 -18
- package/lib/chevre/repo/serviceOutputIdentifier.js +0 -74
- package/lib/chevre/service/account.d.ts +0 -59
- package/lib/chevre/service/account.js +0 -108
- package/lib/chevre/service/accountTransaction/deposit.d.ts +0 -14
- package/lib/chevre/service/accountTransaction/deposit.js +0 -57
- package/lib/chevre/service/accountTransaction/factory.d.ts +0 -10
- package/lib/chevre/service/accountTransaction/factory.js +0 -101
- package/lib/chevre/service/accountTransaction/transfer.d.ts +0 -14
- package/lib/chevre/service/accountTransaction/transfer.js +0 -87
- package/lib/chevre/service/accountTransaction/withdraw.d.ts +0 -14
- package/lib/chevre/service/accountTransaction/withdraw.js +0 -68
- package/lib/chevre/service/accountTransaction.d.ts +0 -20
- package/lib/chevre/service/accountTransaction.js +0 -81
- package/lib/chevre/service/permit.d.ts +0 -45
- package/lib/chevre/service/permit.js +0 -158
- package/lib/chevre/service/product.d.ts +0 -9
- package/lib/chevre/service/product.js +0 -77
- package/lib/chevre/service/task/registerService.d.ts +0 -6
- package/lib/chevre/service/task/registerService.js +0 -22
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.AccountTransactionRepo = void 0;
|
|
7
|
-
const moment_1 = __importDefault(require("moment"));
|
|
8
|
-
const accountTransaction_1 = require("./mongoose/schemas/accountTransaction");
|
|
9
|
-
const factory_1 = require("../factory");
|
|
10
|
-
const settings_1 = require("../settings");
|
|
11
|
-
/**
|
|
12
|
-
* 口座取引リポジトリ
|
|
13
|
-
*/
|
|
14
|
-
class AccountTransactionRepo {
|
|
15
|
-
transactionModel;
|
|
16
|
-
constructor(connection) {
|
|
17
|
-
this.transactionModel = connection.model(accountTransaction_1.modelName, (0, accountTransaction_1.createSchema)());
|
|
18
|
-
}
|
|
19
|
-
static CREATE_MONGO_CONDITIONS(params) {
|
|
20
|
-
const andConditions = [];
|
|
21
|
-
const projectIdEq = params.project?.id?.$eq;
|
|
22
|
-
if (typeof projectIdEq === 'string') {
|
|
23
|
-
andConditions.push({ 'project.id': { $eq: projectIdEq } });
|
|
24
|
-
}
|
|
25
|
-
const typeOfEq = params.typeOf?.$eq;
|
|
26
|
-
if (typeof typeOfEq === 'string') {
|
|
27
|
-
andConditions.push({ typeOf: { $eq: typeOfEq } });
|
|
28
|
-
}
|
|
29
|
-
const startDateGte = params.startDate?.$gte;
|
|
30
|
-
if (startDateGte instanceof Date) {
|
|
31
|
-
andConditions.push({ startDate: { $gte: startDateGte } });
|
|
32
|
-
}
|
|
33
|
-
const startDateLte = params.startDate?.$lte;
|
|
34
|
-
if (startDateLte instanceof Date) {
|
|
35
|
-
andConditions.push({ startDate: { $lte: startDateLte } });
|
|
36
|
-
}
|
|
37
|
-
const statusIn = params.status?.$in;
|
|
38
|
-
if (Array.isArray(statusIn)) {
|
|
39
|
-
andConditions.push({ status: { $in: statusIn } });
|
|
40
|
-
}
|
|
41
|
-
const identifierEq = params.identifier?.$eq;
|
|
42
|
-
if (typeof identifierEq === 'string') {
|
|
43
|
-
andConditions.push({ identifier: { $exists: true, $eq: identifierEq } });
|
|
44
|
-
}
|
|
45
|
-
const transactionNumberEq = params.transactionNumber?.$eq;
|
|
46
|
-
if (typeof transactionNumberEq === 'string') {
|
|
47
|
-
andConditions.push({ transactionNumber: { $eq: transactionNumberEq } });
|
|
48
|
-
}
|
|
49
|
-
const fromLocationAccountNumberEq = params.object?.fromLocation?.accountNumber?.$eq;
|
|
50
|
-
if (typeof fromLocationAccountNumberEq === 'string') {
|
|
51
|
-
andConditions.push({ 'object.fromLocation.accountNumber': { $exists: true, $eq: fromLocationAccountNumberEq } });
|
|
52
|
-
}
|
|
53
|
-
const toLocationAccountNumberEq = params.object?.toLocation?.accountNumber?.$eq;
|
|
54
|
-
if (typeof toLocationAccountNumberEq === 'string') {
|
|
55
|
-
andConditions.push({ 'object.toLocation.accountNumber': { $exists: true, $eq: toLocationAccountNumberEq } });
|
|
56
|
-
}
|
|
57
|
-
const locationAccountNumberEq = params.object?.location?.accountNumber?.$eq;
|
|
58
|
-
if (typeof locationAccountNumberEq === 'string') {
|
|
59
|
-
andConditions.push({
|
|
60
|
-
$or: [
|
|
61
|
-
{ 'object.fromLocation.accountNumber': { $exists: true, $eq: locationAccountNumberEq } },
|
|
62
|
-
{ 'object.toLocation.accountNumber': { $exists: true, $eq: locationAccountNumberEq } }
|
|
63
|
-
]
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
return andConditions;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* 取引を開始する
|
|
70
|
-
*/
|
|
71
|
-
async start(params) {
|
|
72
|
-
return this.transactionModel.create({
|
|
73
|
-
...params,
|
|
74
|
-
status: factory_1.factory.transactionStatusType.InProgress,
|
|
75
|
-
startDate: new Date(),
|
|
76
|
-
endDate: undefined
|
|
77
|
-
// tasksExportationStatus: factory.transactionTasksExportationStatus.Unexported
|
|
78
|
-
})
|
|
79
|
-
.then((doc) => doc.toObject());
|
|
80
|
-
}
|
|
81
|
-
async startByIdentifier(params) {
|
|
82
|
-
const startDate = new Date();
|
|
83
|
-
if (typeof params.identifier === 'string' && params.identifier.length > 0) {
|
|
84
|
-
return this.transactionModel.findOneAndUpdate({
|
|
85
|
-
identifier: {
|
|
86
|
-
$exists: true,
|
|
87
|
-
$eq: params.identifier
|
|
88
|
-
},
|
|
89
|
-
status: {
|
|
90
|
-
// InProgress,Confirmedについては、identifierで取引のユニークネスが保証されるように
|
|
91
|
-
$in: [factory_1.factory.transactionStatusType.InProgress, factory_1.factory.transactionStatusType.Confirmed]
|
|
92
|
-
}
|
|
93
|
-
}, {
|
|
94
|
-
$setOnInsert: {
|
|
95
|
-
...params,
|
|
96
|
-
status: factory_1.factory.transactionStatusType.InProgress,
|
|
97
|
-
startDate: startDate,
|
|
98
|
-
endDate: undefined
|
|
99
|
-
// tasksExportationStatus: factory.transactionTasksExportationStatus.Unexported
|
|
100
|
-
}
|
|
101
|
-
}, {
|
|
102
|
-
new: true,
|
|
103
|
-
upsert: true
|
|
104
|
-
})
|
|
105
|
-
.exec()
|
|
106
|
-
.then((doc) => {
|
|
107
|
-
if (doc === null) {
|
|
108
|
-
throw new factory_1.factory.errors.NotFound(this.transactionModel.modelName);
|
|
109
|
-
}
|
|
110
|
-
// 以前に開始した取引であればエラー
|
|
111
|
-
const transaction = doc.toObject();
|
|
112
|
-
if (transaction.status === factory_1.factory.transactionStatusType.Confirmed) {
|
|
113
|
-
throw new factory_1.factory.errors.Argument('identifier', 'already confirmed');
|
|
114
|
-
}
|
|
115
|
-
if (!(0, moment_1.default)(transaction.startDate)
|
|
116
|
-
.isSame(startDate)) {
|
|
117
|
-
throw new factory_1.factory.errors.Argument('identifier', 'another transaction in progress');
|
|
118
|
-
}
|
|
119
|
-
return doc.toObject();
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
return this.start(params);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* 取引検索
|
|
128
|
-
*/
|
|
129
|
-
async findById(params) {
|
|
130
|
-
const doc = await this.transactionModel.findOne({
|
|
131
|
-
_id: params.id,
|
|
132
|
-
...(typeof params.typeOf === 'string') ? { typeOf: params.typeOf } : undefined
|
|
133
|
-
})
|
|
134
|
-
.exec();
|
|
135
|
-
if (doc === null) {
|
|
136
|
-
throw new factory_1.factory.errors.NotFound('Transaction');
|
|
137
|
-
}
|
|
138
|
-
return doc.toObject();
|
|
139
|
-
}
|
|
140
|
-
/* istanbul ignore next */
|
|
141
|
-
async findByTransactionNumber(params) {
|
|
142
|
-
const doc = await this.transactionModel.findOne({
|
|
143
|
-
transactionNumber: { $exists: true, $eq: params.transactionNumber },
|
|
144
|
-
...(typeof params.typeOf === 'string') ? { typeOf: params.typeOf } : undefined
|
|
145
|
-
})
|
|
146
|
-
.exec();
|
|
147
|
-
if (doc === null) {
|
|
148
|
-
throw new factory_1.factory.errors.NotFound('Transaction');
|
|
149
|
-
}
|
|
150
|
-
return doc.toObject();
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* 取引を確定する
|
|
154
|
-
*/
|
|
155
|
-
async confirm(params) {
|
|
156
|
-
const doc = await this.transactionModel.findOneAndUpdate({
|
|
157
|
-
_id: params.id,
|
|
158
|
-
status: factory_1.factory.transactionStatusType.InProgress,
|
|
159
|
-
...(typeof params.typeOf === 'string') ? { typeOf: params.typeOf } : undefined
|
|
160
|
-
}, {
|
|
161
|
-
status: factory_1.factory.transactionStatusType.Confirmed,
|
|
162
|
-
endDate: new Date(),
|
|
163
|
-
// result: params.result, // resultを更新
|
|
164
|
-
potentialActions: params.potentialActions
|
|
165
|
-
}, { new: true })
|
|
166
|
-
.exec();
|
|
167
|
-
// NotFoundであれば取引状態確認
|
|
168
|
-
if (doc === null) {
|
|
169
|
-
const transaction = await this.findById({ typeOf: params.typeOf, id: params.id });
|
|
170
|
-
if (transaction.status === factory_1.factory.transactionStatusType.Confirmed) {
|
|
171
|
-
return transaction;
|
|
172
|
-
}
|
|
173
|
-
else {
|
|
174
|
-
throw new factory_1.factory.errors.Argument('transactionId', `Transaction ${transaction.status}`);
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
return doc.toObject();
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* 取引を中止する
|
|
181
|
-
*/
|
|
182
|
-
async cancel(params) {
|
|
183
|
-
if (typeof params.id !== 'string' && typeof params.transactionNumber !== 'string') {
|
|
184
|
-
/* istanbul ignore next */
|
|
185
|
-
throw new factory_1.factory.errors.ArgumentNull('Transaction ID or Transaction Number');
|
|
186
|
-
}
|
|
187
|
-
// 進行中ステータスの取引を中止する
|
|
188
|
-
const doc = await this.transactionModel.findOneAndUpdate({
|
|
189
|
-
status: factory_1.factory.transactionStatusType.InProgress,
|
|
190
|
-
...(typeof params.id === 'string') ? { _id: params.id } : /* istanbul ignore next */ undefined,
|
|
191
|
-
...(typeof params.transactionNumber === 'string')
|
|
192
|
-
/* istanbul ignore next */
|
|
193
|
-
? { transactionNumber: { $exists: true, $eq: params.transactionNumber } }
|
|
194
|
-
: undefined,
|
|
195
|
-
...(typeof params.typeOf === 'string') ? { typeOf: params.typeOf } : undefined
|
|
196
|
-
}, {
|
|
197
|
-
status: factory_1.factory.transactionStatusType.Canceled,
|
|
198
|
-
endDate: new Date()
|
|
199
|
-
}, { new: true })
|
|
200
|
-
.exec();
|
|
201
|
-
// NotFoundであれば取引状態確認
|
|
202
|
-
if (doc === null) {
|
|
203
|
-
let transaction;
|
|
204
|
-
/* istanbul ignore else */
|
|
205
|
-
if (typeof params.id === 'string') {
|
|
206
|
-
transaction = await this.findById({ typeOf: params.typeOf, id: params.id });
|
|
207
|
-
}
|
|
208
|
-
else if (typeof params.transactionNumber === 'string') {
|
|
209
|
-
/* istanbul ignore next */
|
|
210
|
-
transaction = await this.findByTransactionNumber({
|
|
211
|
-
typeOf: params.typeOf,
|
|
212
|
-
transactionNumber: params.transactionNumber
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
else {
|
|
216
|
-
/* istanbul ignore next */
|
|
217
|
-
throw new factory_1.factory.errors.ArgumentNull('Transaction ID or Transaction Number');
|
|
218
|
-
}
|
|
219
|
-
if (transaction.status === factory_1.factory.transactionStatusType.Canceled) {
|
|
220
|
-
return transaction;
|
|
221
|
-
}
|
|
222
|
-
else {
|
|
223
|
-
throw new factory_1.factory.errors.Argument('transactionId', `Transaction ${transaction.status}`);
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
return doc.toObject();
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* 取引を期限切れにする
|
|
230
|
-
*/
|
|
231
|
-
async makeExpired(params) {
|
|
232
|
-
// ステータスと期限を見て更新
|
|
233
|
-
await this.transactionModel.updateMany({
|
|
234
|
-
status: factory_1.factory.transactionStatusType.InProgress,
|
|
235
|
-
expires: { $lt: params.expires.$lt }
|
|
236
|
-
}, {
|
|
237
|
-
status: factory_1.factory.transactionStatusType.Expired,
|
|
238
|
-
endDate: new Date()
|
|
239
|
-
})
|
|
240
|
-
.exec();
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* 取引を検索する
|
|
244
|
-
*/
|
|
245
|
-
async search(params) {
|
|
246
|
-
const conditions = AccountTransactionRepo.CREATE_MONGO_CONDITIONS(params);
|
|
247
|
-
const query = this.transactionModel.find((conditions.length > 0) ? { $and: conditions } : {}, {
|
|
248
|
-
__v: 0,
|
|
249
|
-
createdAt: 0,
|
|
250
|
-
updatedAt: 0
|
|
251
|
-
});
|
|
252
|
-
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
253
|
-
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
254
|
-
query.limit(params.limit)
|
|
255
|
-
.skip(params.limit * (page - 1));
|
|
256
|
-
}
|
|
257
|
-
/* istanbul ignore else */
|
|
258
|
-
if (params.sort?.startDate !== undefined) {
|
|
259
|
-
query.sort({ startDate: params.sort.startDate });
|
|
260
|
-
}
|
|
261
|
-
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
262
|
-
.exec()
|
|
263
|
-
.then((docs) => docs.map((doc) => doc.toObject()));
|
|
264
|
-
}
|
|
265
|
-
async clean(params) {
|
|
266
|
-
await this.transactionModel.deleteMany({
|
|
267
|
-
// 終了日時を一定期間過ぎたもの
|
|
268
|
-
endDate: {
|
|
269
|
-
$exists: true,
|
|
270
|
-
$lt: params.endDate.$lt
|
|
271
|
-
},
|
|
272
|
-
...(typeof params.project?.id === 'string') ? { 'project.id': { $eq: params.project.id } } : undefined
|
|
273
|
-
})
|
|
274
|
-
.exec();
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
exports.AccountTransactionRepo = AccountTransactionRepo;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
|
|
2
|
-
import { IVirtuals } from '../virtuals';
|
|
3
|
-
import { factory } from '../../../factory';
|
|
4
|
-
type IDocType = factory.account.IAccount;
|
|
5
|
-
type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
|
|
6
|
-
type ISchemaDefinition = SchemaDefinition<IDocType>;
|
|
7
|
-
type ISchema = Schema<IDocType, IModel, Record<string, never>, Record<string, never>, IVirtuals, Record<string, never>, ISchemaDefinition, IDocType>;
|
|
8
|
-
declare const modelName = "Account";
|
|
9
|
-
declare const indexes: [d: IndexDefinition, o: IndexOptions][];
|
|
10
|
-
declare function createSchema(): ISchema;
|
|
11
|
-
export { createSchema, IDocType, IModel, indexes, modelName };
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.modelName = exports.indexes = void 0;
|
|
4
|
-
exports.createSchema = createSchema;
|
|
5
|
-
const mongoose_1 = require("mongoose");
|
|
6
|
-
const writeConcern_1 = require("../writeConcern");
|
|
7
|
-
const settings_1 = require("../../../settings");
|
|
8
|
-
const modelName = 'Account';
|
|
9
|
-
exports.modelName = modelName;
|
|
10
|
-
const schemaDefinition = {
|
|
11
|
-
project: mongoose_1.SchemaTypes.Mixed,
|
|
12
|
-
typeOf: String,
|
|
13
|
-
accountType: String,
|
|
14
|
-
accountNumber: String,
|
|
15
|
-
name: String,
|
|
16
|
-
balance: Number,
|
|
17
|
-
availableBalance: Number,
|
|
18
|
-
pendingTransactions: [mongoose_1.SchemaTypes.Mixed],
|
|
19
|
-
openDate: Date,
|
|
20
|
-
closeDate: Date
|
|
21
|
-
// createdAt: Date,
|
|
22
|
-
// updatedAt: Date
|
|
23
|
-
};
|
|
24
|
-
const schemaOptions = {
|
|
25
|
-
autoIndex: settings_1.MONGO_AUTO_INDEX,
|
|
26
|
-
autoCreate: false,
|
|
27
|
-
collection: 'accounts',
|
|
28
|
-
id: true,
|
|
29
|
-
read: settings_1.MONGO_READ_PREFERENCE,
|
|
30
|
-
writeConcern: writeConcern_1.writeConcern,
|
|
31
|
-
strict: true,
|
|
32
|
-
strictQuery: false,
|
|
33
|
-
timestamps: false,
|
|
34
|
-
versionKey: false,
|
|
35
|
-
toJSON: {
|
|
36
|
-
getters: false,
|
|
37
|
-
virtuals: false,
|
|
38
|
-
minimize: false,
|
|
39
|
-
versionKey: false
|
|
40
|
-
},
|
|
41
|
-
toObject: {
|
|
42
|
-
getters: false,
|
|
43
|
-
virtuals: true,
|
|
44
|
-
minimize: false,
|
|
45
|
-
versionKey: false
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
const indexes = [
|
|
49
|
-
// 口座タイプと口座番号でユニーク
|
|
50
|
-
[
|
|
51
|
-
{
|
|
52
|
-
accountType: 1,
|
|
53
|
-
accountNumber: 1
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
unique: true,
|
|
57
|
-
partialFilterExpression: {
|
|
58
|
-
accountType: { $exists: true },
|
|
59
|
-
accountNumber: { $exists: true }
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
],
|
|
63
|
-
// 口座番号はグローバルユニーク
|
|
64
|
-
[
|
|
65
|
-
{ accountNumber: 1 },
|
|
66
|
-
{ name: 'uniqueAccountNumber', unique: true }
|
|
67
|
-
],
|
|
68
|
-
[
|
|
69
|
-
{ 'project.id': 1, openDate: -1 },
|
|
70
|
-
{
|
|
71
|
-
name: 'searchByProjectId-v20220721'
|
|
72
|
-
}
|
|
73
|
-
],
|
|
74
|
-
[
|
|
75
|
-
{ typeOf: 1, openDate: -1 },
|
|
76
|
-
{ name: 'searchByTypeOf-v2' }
|
|
77
|
-
],
|
|
78
|
-
[
|
|
79
|
-
{ accountNumber: 1, openDate: -1 },
|
|
80
|
-
{ name: 'searchByAccountNumber-v2' }
|
|
81
|
-
],
|
|
82
|
-
[
|
|
83
|
-
{ accountType: 1, openDate: -1 },
|
|
84
|
-
{ name: 'searchByAccountType-v2' }
|
|
85
|
-
],
|
|
86
|
-
[
|
|
87
|
-
{ name: 1, openDate: -1 },
|
|
88
|
-
{ name: 'searchByName-v2' }
|
|
89
|
-
],
|
|
90
|
-
[
|
|
91
|
-
{ openDate: -1 },
|
|
92
|
-
{ name: 'searchByOpenDate-v2' }
|
|
93
|
-
],
|
|
94
|
-
[
|
|
95
|
-
{ status: 1, openDate: -1 },
|
|
96
|
-
{ name: 'searchByStatus-v2' }
|
|
97
|
-
],
|
|
98
|
-
[
|
|
99
|
-
{ accountType: 1, accountNumber: 1, status: 1 },
|
|
100
|
-
{ name: 'authorizeAmount' }
|
|
101
|
-
]
|
|
102
|
-
];
|
|
103
|
-
exports.indexes = indexes;
|
|
104
|
-
/**
|
|
105
|
-
* 口座スキーマ
|
|
106
|
-
*/
|
|
107
|
-
let schema;
|
|
108
|
-
function createSchema() {
|
|
109
|
-
if (schema === undefined) {
|
|
110
|
-
schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
|
|
111
|
-
if (settings_1.MONGO_AUTO_INDEX) {
|
|
112
|
-
indexes.forEach((indexParams) => {
|
|
113
|
-
schema?.index(...indexParams);
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
return schema;
|
|
118
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
|
|
2
|
-
import { IVirtuals } from '../virtuals';
|
|
3
|
-
import { factory } from '../../../factory';
|
|
4
|
-
type IDocType = Omit<factory.account.transaction.ITransaction<factory.account.transactionType>, 'id'>;
|
|
5
|
-
type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
|
|
6
|
-
type ISchemaDefinition = SchemaDefinition<IDocType>;
|
|
7
|
-
type ISchema = Schema<IDocType, IModel, Record<string, never>, Record<string, never>, IVirtuals, Record<string, never>, ISchemaDefinition>;
|
|
8
|
-
declare const modelName = "AccountTransaction";
|
|
9
|
-
declare const indexes: [d: IndexDefinition, o: IndexOptions][];
|
|
10
|
-
declare function createSchema(): ISchema;
|
|
11
|
-
export { createSchema, IDocType, IModel, indexes, modelName };
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.modelName = exports.indexes = void 0;
|
|
4
|
-
exports.createSchema = createSchema;
|
|
5
|
-
const mongoose_1 = require("mongoose");
|
|
6
|
-
const writeConcern_1 = require("../writeConcern");
|
|
7
|
-
const settings_1 = require("../../../settings");
|
|
8
|
-
const modelName = 'AccountTransaction';
|
|
9
|
-
exports.modelName = modelName;
|
|
10
|
-
const schemaDefinition = {
|
|
11
|
-
project: mongoose_1.SchemaTypes.Mixed,
|
|
12
|
-
status: {
|
|
13
|
-
type: String,
|
|
14
|
-
required: true
|
|
15
|
-
},
|
|
16
|
-
typeOf: {
|
|
17
|
-
type: String,
|
|
18
|
-
required: true
|
|
19
|
-
},
|
|
20
|
-
identifier: String,
|
|
21
|
-
transactionNumber: {
|
|
22
|
-
type: String,
|
|
23
|
-
required: true
|
|
24
|
-
},
|
|
25
|
-
agent: mongoose_1.SchemaTypes.Mixed,
|
|
26
|
-
recipient: mongoose_1.SchemaTypes.Mixed,
|
|
27
|
-
object: mongoose_1.SchemaTypes.Mixed,
|
|
28
|
-
expires: Date,
|
|
29
|
-
startDate: Date,
|
|
30
|
-
endDate: Date,
|
|
31
|
-
potentialActions: mongoose_1.SchemaTypes.Mixed
|
|
32
|
-
};
|
|
33
|
-
const schemaOptions = {
|
|
34
|
-
autoIndex: settings_1.MONGO_AUTO_INDEX,
|
|
35
|
-
autoCreate: false,
|
|
36
|
-
collection: 'accountTransactions',
|
|
37
|
-
id: true,
|
|
38
|
-
read: 'primary',
|
|
39
|
-
writeConcern: writeConcern_1.writeConcern,
|
|
40
|
-
strict: true,
|
|
41
|
-
strictQuery: false,
|
|
42
|
-
timestamps: false,
|
|
43
|
-
versionKey: false,
|
|
44
|
-
toJSON: {
|
|
45
|
-
getters: false,
|
|
46
|
-
virtuals: false,
|
|
47
|
-
minimize: false,
|
|
48
|
-
versionKey: false
|
|
49
|
-
},
|
|
50
|
-
toObject: {
|
|
51
|
-
getters: false,
|
|
52
|
-
virtuals: true,
|
|
53
|
-
minimize: false,
|
|
54
|
-
versionKey: false
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
const indexes = [
|
|
58
|
-
[
|
|
59
|
-
{ transactionNumber: 1 },
|
|
60
|
-
{
|
|
61
|
-
unique: true,
|
|
62
|
-
partialFilterExpression: {
|
|
63
|
-
transactionNumber: { $exists: true }
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
],
|
|
67
|
-
[
|
|
68
|
-
{ transactionNumber: 1, startDate: -1 },
|
|
69
|
-
{ name: 'searchByTransactionNumber' }
|
|
70
|
-
],
|
|
71
|
-
[
|
|
72
|
-
{ identifier: 1, startDate: -1 },
|
|
73
|
-
{
|
|
74
|
-
name: 'searchByIdentifier',
|
|
75
|
-
partialFilterExpression: {
|
|
76
|
-
identifier: { $exists: true }
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
],
|
|
80
|
-
[
|
|
81
|
-
{ 'project.id': 1, startDate: -1 },
|
|
82
|
-
{ name: 'searchByProjectId-v20220721' }
|
|
83
|
-
],
|
|
84
|
-
[
|
|
85
|
-
{ typeOf: 1, startDate: -1 },
|
|
86
|
-
{ name: 'searchByTypeOfAndStartDate' }
|
|
87
|
-
],
|
|
88
|
-
[
|
|
89
|
-
{ status: 1, startDate: -1 },
|
|
90
|
-
{ name: 'searchByStatusAndStartDate' }
|
|
91
|
-
],
|
|
92
|
-
[
|
|
93
|
-
{ startDate: -1 },
|
|
94
|
-
{ name: 'searchByStartDateDescending' }
|
|
95
|
-
],
|
|
96
|
-
[
|
|
97
|
-
{ endDate: 1, startDate: -1 },
|
|
98
|
-
{
|
|
99
|
-
name: 'searchByEndDateAndStartDate',
|
|
100
|
-
partialFilterExpression: {
|
|
101
|
-
endDate: { $exists: true }
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
],
|
|
105
|
-
[
|
|
106
|
-
{ expires: 1, startDate: -1 },
|
|
107
|
-
{ name: 'searchByExpiresAndStartDate' }
|
|
108
|
-
],
|
|
109
|
-
[
|
|
110
|
-
{ 'object.fromLocation.accountNumber': 1, startDate: -1 },
|
|
111
|
-
{
|
|
112
|
-
name: 'searchByObjectFromLocationAccountNumber',
|
|
113
|
-
partialFilterExpression: {
|
|
114
|
-
'object.fromLocation.accountNumber': { $exists: true }
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
],
|
|
118
|
-
[
|
|
119
|
-
{ 'object.toLocation.accountNumber': 1, startDate: -1 },
|
|
120
|
-
{
|
|
121
|
-
name: 'searchByObjectToLocationAccountNumber',
|
|
122
|
-
partialFilterExpression: {
|
|
123
|
-
'object.toLocation.accountNumber': { $exists: true }
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
],
|
|
127
|
-
[
|
|
128
|
-
{ status: 1, expires: 1 },
|
|
129
|
-
{
|
|
130
|
-
name: 'makeExpired'
|
|
131
|
-
}
|
|
132
|
-
]
|
|
133
|
-
];
|
|
134
|
-
exports.indexes = indexes;
|
|
135
|
-
/**
|
|
136
|
-
* 口座取引スキーマ
|
|
137
|
-
*/
|
|
138
|
-
let schema;
|
|
139
|
-
function createSchema() {
|
|
140
|
-
if (schema === undefined) {
|
|
141
|
-
schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
|
|
142
|
-
if (settings_1.MONGO_AUTO_INDEX) {
|
|
143
|
-
indexes.forEach((indexParams) => {
|
|
144
|
-
schema?.index(...indexParams);
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
return schema;
|
|
149
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
|
|
2
|
-
import { IVirtuals } from '../virtuals';
|
|
3
|
-
import { factory } from '../../../factory';
|
|
4
|
-
type IDocType = Omit<factory.permit.IPermit, 'id'>;
|
|
5
|
-
type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
|
|
6
|
-
type ISchemaDefinition = SchemaDefinition<IDocType>;
|
|
7
|
-
type ISchema = Schema<IDocType, IModel, Record<string, never>, Record<string, never>, IVirtuals, Record<string, never>, ISchemaDefinition, IDocType>;
|
|
8
|
-
declare const modelName = "ServiceOutput";
|
|
9
|
-
declare function createSchema(): ISchema;
|
|
10
|
-
declare const indexes: [d: IndexDefinition, o: IndexOptions][];
|
|
11
|
-
export { createSchema, IDocType, IModel, indexes, modelName };
|