@chevre/domain 24.0.0-alpha.82 → 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.
Files changed (53) hide show
  1. package/lib/chevre/repo/product.js +0 -3
  2. package/lib/chevre/repo/transaction.d.ts +4 -4
  3. package/lib/chevre/repository.d.ts +0 -30
  4. package/lib/chevre/repository.js +2 -68
  5. package/lib/chevre/service/assetTransaction/reserve/start/createSubReservations.js +1 -19
  6. package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre/requestedProgramMembershipUsed2permit.js +1 -31
  7. package/lib/chevre/service/payment/any/verifyTicketTokenAsNeeded.js +1 -5
  8. package/lib/chevre/service/task/deletePerson.js +0 -2
  9. package/lib/chevre/service/task/onResourceDeleted.js +0 -3
  10. package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +4 -4
  11. package/lib/chevre/service.d.ts +0 -12
  12. package/lib/chevre/service.js +1 -35
  13. package/package.json +2 -2
  14. package/lib/chevre/factory/availableProductTypes.d.ts +0 -1
  15. package/lib/chevre/factory/availableProductTypes.js +0 -8
  16. package/lib/chevre/repo/account.d.ts +0 -129
  17. package/lib/chevre/repo/account.js +0 -391
  18. package/lib/chevre/repo/accountTransaction.d.ts +0 -65
  19. package/lib/chevre/repo/accountTransaction.js +0 -277
  20. package/lib/chevre/repo/comment.d.ts +0 -42
  21. package/lib/chevre/repo/comment.js +0 -121
  22. package/lib/chevre/repo/mongoose/schemas/account.d.ts +0 -11
  23. package/lib/chevre/repo/mongoose/schemas/account.js +0 -118
  24. package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +0 -11
  25. package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +0 -149
  26. package/lib/chevre/repo/mongoose/schemas/comments.d.ts +0 -11
  27. package/lib/chevre/repo/mongoose/schemas/comments.js +0 -103
  28. package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +0 -11
  29. package/lib/chevre/repo/mongoose/schemas/serviceOutput.js +0 -144
  30. package/lib/chevre/repo/permit.d.ts +0 -42
  31. package/lib/chevre/repo/permit.js +0 -77
  32. package/lib/chevre/repo/serviceOutput.d.ts +0 -36
  33. package/lib/chevre/repo/serviceOutput.js +0 -167
  34. package/lib/chevre/repo/serviceOutputIdentifier.d.ts +0 -18
  35. package/lib/chevre/repo/serviceOutputIdentifier.js +0 -74
  36. package/lib/chevre/service/account.d.ts +0 -59
  37. package/lib/chevre/service/account.js +0 -108
  38. package/lib/chevre/service/accountTransaction/deposit.d.ts +0 -14
  39. package/lib/chevre/service/accountTransaction/deposit.js +0 -57
  40. package/lib/chevre/service/accountTransaction/factory.d.ts +0 -10
  41. package/lib/chevre/service/accountTransaction/factory.js +0 -101
  42. package/lib/chevre/service/accountTransaction/transfer.d.ts +0 -14
  43. package/lib/chevre/service/accountTransaction/transfer.js +0 -87
  44. package/lib/chevre/service/accountTransaction/withdraw.d.ts +0 -14
  45. package/lib/chevre/service/accountTransaction/withdraw.js +0 -68
  46. package/lib/chevre/service/accountTransaction.d.ts +0 -20
  47. package/lib/chevre/service/accountTransaction.js +0 -81
  48. package/lib/chevre/service/permit.d.ts +0 -45
  49. package/lib/chevre/service/permit.js +0 -158
  50. package/lib/chevre/service/product.d.ts +0 -9
  51. package/lib/chevre/service/product.js +0 -77
  52. package/lib/chevre/service/task/registerService.d.ts +0 -6
  53. 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,42 +0,0 @@
1
- import type { Connection } from 'mongoose';
2
- import { factory } from '../factory';
3
- /**
4
- * コメントリポジトリ
5
- */
6
- export declare class CommentRepo {
7
- private readonly commentModel;
8
- constructor(connection: Connection);
9
- static CREATE_MONGO_CONDITIONS(params: factory.creativeWork.comment.ISearchConditions): any[];
10
- /**
11
- * 検索
12
- */
13
- search(params: factory.creativeWork.comment.ISearchConditions & {
14
- inclusion: string[];
15
- exclusion: string[];
16
- }): Promise<factory.creativeWork.comment.IComment[]>;
17
- findById(params: {
18
- id: string;
19
- }): Promise<factory.creativeWork.comment.IComment>;
20
- create(params: factory.creativeWork.comment.IComment): Promise<factory.creativeWork.comment.IComment>;
21
- updateById(params: {
22
- id?: string;
23
- attributes: {
24
- text: string;
25
- };
26
- }): Promise<void>;
27
- /**
28
- * 削除する
29
- */
30
- deleteById(params: {
31
- id: string;
32
- }): Promise<void>;
33
- getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, import("@chevre/factory/lib/chevre/creativeWork/comment").IComment, import("./mongoose/virtuals").IVirtuals, {}> & import("@chevre/factory/lib/chevre/creativeWork/comment").IComment & {
34
- _id: import("mongoose").Types.ObjectId;
35
- } & {
36
- __v: number;
37
- }, import("mongoose").QueryOptions<import("@chevre/factory/lib/chevre/creativeWork/comment").IComment>, (import("mongoose").Document<unknown, Record<string, never>, import("@chevre/factory/lib/chevre/creativeWork/comment").IComment, import("./mongoose/virtuals").IVirtuals, {}> & import("@chevre/factory/lib/chevre/creativeWork/comment").IComment & {
38
- _id: import("mongoose").Types.ObjectId;
39
- } & {
40
- __v: number;
41
- }) | null>;
42
- }
@@ -1,121 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CommentRepo = void 0;
4
- const comments_1 = require("./mongoose/schemas/comments");
5
- const factory_1 = require("../factory");
6
- const settings_1 = require("../settings");
7
- /**
8
- * コメントリポジトリ
9
- */
10
- class CommentRepo {
11
- commentModel;
12
- constructor(connection) {
13
- this.commentModel = connection.model(comments_1.modelName, (0, comments_1.createSchema)());
14
- }
15
- static CREATE_MONGO_CONDITIONS(params) {
16
- const andConditions = [];
17
- const projectIdEq = params.project?.id?.$eq;
18
- if (typeof projectIdEq === 'string') {
19
- andConditions.push({ 'project.id': { $eq: projectIdEq } });
20
- }
21
- const aboutIdEq = params.about?.id?.$eq;
22
- if (typeof aboutIdEq === 'string') {
23
- andConditions.push({ 'about.id': { $exists: true, $eq: aboutIdEq } });
24
- }
25
- const aboutIdIn = params.about?.id?.$in;
26
- if (Array.isArray(aboutIdIn)) {
27
- andConditions.push({ 'about.id': { $exists: true, $in: aboutIdIn } });
28
- }
29
- return andConditions;
30
- }
31
- /**
32
- * 検索
33
- */
34
- async search(params) {
35
- let projection = {};
36
- if (Array.isArray(params.inclusion) && params.inclusion.length > 0) {
37
- params.inclusion.forEach((field) => {
38
- projection[field] = 1;
39
- });
40
- }
41
- else {
42
- projection = {
43
- __v: 0,
44
- createdAt: 0,
45
- updatedAt: 0
46
- };
47
- if (Array.isArray(params.exclusion) && params.exclusion.length > 0) {
48
- params.exclusion.forEach((field) => {
49
- projection[field] = 0;
50
- });
51
- }
52
- }
53
- const conditions = CommentRepo.CREATE_MONGO_CONDITIONS(params);
54
- const query = this.commentModel.find((conditions.length > 0) ? { $and: conditions } : {})
55
- .select(projection);
56
- if (typeof params.limit === 'number' && params.limit > 0) {
57
- const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
58
- query.limit(params.limit)
59
- .skip(params.limit * (page - 1));
60
- }
61
- /* istanbul ignore else */
62
- if (params.sort?.dateCreated !== undefined) {
63
- query.sort({ dateCreated: params.sort.dateCreated });
64
- }
65
- return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
66
- .exec()
67
- .then((docs) => docs.map((doc) => doc.toObject()));
68
- }
69
- async findById(params) {
70
- const doc = await this.commentModel.findOne({ _id: params.id }, {
71
- __v: 0,
72
- createdAt: 0,
73
- updatedAt: 0
74
- })
75
- .exec();
76
- if (doc === null) {
77
- throw new factory_1.factory.errors.NotFound(this.commentModel.modelName);
78
- }
79
- return doc.toObject();
80
- }
81
- async create(params) {
82
- const creatingDoc = {
83
- about: params.about,
84
- author: params.author,
85
- dateCreated: new Date(),
86
- project: params.project,
87
- text: params.text,
88
- typeOf: factory_1.factory.creativeWorkType.Comment,
89
- ...(Array.isArray(params.additionalProperty)) ? { additionalProperty: params.additionalProperty } : undefined,
90
- ...(Array.isArray(params.mentions)) ? { mentions: params.mentions } : undefined
91
- };
92
- const doc = await this.commentModel.create(creatingDoc);
93
- return doc.toObject();
94
- }
95
- async updateById(params) {
96
- const updateFields = {
97
- $set: {
98
- dateModified: new Date(),
99
- ...(typeof params.attributes.text === 'string') ? { text: params.attributes.text } : undefined
100
- }
101
- };
102
- const doc = await this.commentModel.findOneAndUpdate({ _id: params.id }, updateFields, { upsert: false, new: true })
103
- .exec();
104
- if (doc === null) {
105
- throw new factory_1.factory.errors.NotFound(this.commentModel.modelName);
106
- }
107
- }
108
- /**
109
- * 削除する
110
- */
111
- async deleteById(params) {
112
- await this.commentModel.findOneAndDelete({ _id: { $eq: params.id } }, { projection: { _id: 1 } })
113
- .exec();
114
- }
115
- getCursor(conditions, projection) {
116
- return this.commentModel.find(conditions, projection)
117
- .sort({ codeValue: factory_1.factory.sortType.Ascending })
118
- .cursor();
119
- }
120
- }
121
- exports.CommentRepo = CommentRepo;
@@ -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 };