@chevre/domain 21.12.0 → 21.13.0-alpha.0

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 (113) hide show
  1. package/lib/chevre/repo/account.js +1 -1
  2. package/lib/chevre/repo/accountTitle.js +1 -1
  3. package/lib/chevre/repo/accountTransaction.js +1 -1
  4. package/lib/chevre/repo/accountingReport.js +1 -1
  5. package/lib/chevre/repo/action.js +1 -1
  6. package/lib/chevre/repo/additionalProperty.js +1 -1
  7. package/lib/chevre/repo/aggregateOffer.js +1 -1
  8. package/lib/chevre/repo/aggregation.js +1 -1
  9. package/lib/chevre/repo/assetTransaction.js +1 -1
  10. package/lib/chevre/repo/categoryCode.js +1 -1
  11. package/lib/chevre/repo/code.js +1 -1
  12. package/lib/chevre/repo/comment.js +1 -1
  13. package/lib/chevre/repo/creativeWork.js +1 -1
  14. package/lib/chevre/repo/customer.js +1 -1
  15. package/lib/chevre/repo/emailMessage.js +1 -1
  16. package/lib/chevre/repo/event.js +1 -1
  17. package/lib/chevre/repo/member.js +1 -1
  18. package/lib/chevre/repo/merchantReturnPolicy.js +1 -1
  19. package/lib/chevre/repo/mongoose/schemas/account.d.ts +4 -56
  20. package/lib/chevre/repo/mongoose/schemas/account.js +80 -32
  21. package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +4 -90
  22. package/lib/chevre/repo/mongoose/schemas/accountTitle.js +81 -44
  23. package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +4 -95
  24. package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +129 -62
  25. package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +4 -68
  26. package/lib/chevre/repo/mongoose/schemas/accountingReport.js +108 -63
  27. package/lib/chevre/repo/mongoose/schemas/action.d.ts +4 -113
  28. package/lib/chevre/repo/mongoose/schemas/action.js +345 -215
  29. package/lib/chevre/repo/mongoose/schemas/additionalProperty.d.ts +4 -74
  30. package/lib/chevre/repo/mongoose/schemas/additionalProperty.js +65 -32
  31. package/lib/chevre/repo/mongoose/schemas/aggregateOffer.d.ts +4 -73
  32. package/lib/chevre/repo/mongoose/schemas/aggregateOffer.js +258 -155
  33. package/lib/chevre/repo/mongoose/schemas/aggregation.d.ts +4 -56
  34. package/lib/chevre/repo/mongoose/schemas/aggregation.js +28 -10
  35. package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +4 -113
  36. package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +258 -146
  37. package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +4 -77
  38. package/lib/chevre/repo/mongoose/schemas/authorization.js +110 -61
  39. package/lib/chevre/repo/mongoose/schemas/categoryCode.d.ts +4 -86
  40. package/lib/chevre/repo/mongoose/schemas/categoryCode.js +85 -46
  41. package/lib/chevre/repo/mongoose/schemas/comments.d.ts +4 -89
  42. package/lib/chevre/repo/mongoose/schemas/comments.js +59 -28
  43. package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +4 -104
  44. package/lib/chevre/repo/mongoose/schemas/creativeWork.js +121 -70
  45. package/lib/chevre/repo/mongoose/schemas/customer.d.ts +4 -86
  46. package/lib/chevre/repo/mongoose/schemas/customer.js +56 -26
  47. package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +4 -80
  48. package/lib/chevre/repo/mongoose/schemas/emailMessages.js +41 -17
  49. package/lib/chevre/repo/mongoose/schemas/event.d.ts +4 -158
  50. package/lib/chevre/repo/mongoose/schemas/event.js +307 -193
  51. package/lib/chevre/repo/mongoose/schemas/member.d.ts +4 -68
  52. package/lib/chevre/repo/mongoose/schemas/member.js +65 -37
  53. package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.d.ts +4 -80
  54. package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.js +29 -11
  55. package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +4 -91
  56. package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +85 -45
  57. package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.d.ts +4 -91
  58. package/lib/chevre/repo/mongoose/schemas/offerCatalogItem.js +29 -10
  59. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.d.ts +4 -73
  60. package/lib/chevre/repo/mongoose/schemas/offerItemCondition.js +37 -12
  61. package/lib/chevre/repo/mongoose/schemas/order.d.ts +4 -128
  62. package/lib/chevre/repo/mongoose/schemas/order.js +407 -259
  63. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +4 -86
  64. package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +187 -111
  65. package/lib/chevre/repo/mongoose/schemas/place.d.ts +4 -128
  66. package/lib/chevre/repo/mongoose/schemas/place.js +159 -93
  67. package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +4 -92
  68. package/lib/chevre/repo/mongoose/schemas/priceSpecification.js +94 -49
  69. package/lib/chevre/repo/mongoose/schemas/product.d.ts +4 -95
  70. package/lib/chevre/repo/mongoose/schemas/product.js +109 -61
  71. package/lib/chevre/repo/mongoose/schemas/project.d.ts +4 -83
  72. package/lib/chevre/repo/mongoose/schemas/project.js +20 -9
  73. package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +4 -143
  74. package/lib/chevre/repo/mongoose/schemas/reservation.js +377 -229
  75. package/lib/chevre/repo/mongoose/schemas/role.d.ts +4 -65
  76. package/lib/chevre/repo/mongoose/schemas/role.js +43 -19
  77. package/lib/chevre/repo/mongoose/schemas/seller.d.ts +4 -95
  78. package/lib/chevre/repo/mongoose/schemas/seller.js +96 -51
  79. package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +4 -65
  80. package/lib/chevre/repo/mongoose/schemas/serviceOutput.js +112 -63
  81. package/lib/chevre/repo/mongoose/schemas/task.d.ts +4 -95
  82. package/lib/chevre/repo/mongoose/schemas/task.js +214 -126
  83. package/lib/chevre/repo/mongoose/schemas/telemetry.d.ts +4 -80
  84. package/lib/chevre/repo/mongoose/schemas/telemetry.js +44 -24
  85. package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +4 -107
  86. package/lib/chevre/repo/mongoose/schemas/transaction.js +291 -176
  87. package/lib/chevre/repo/mongoose/schemas/trip.d.ts +4 -65
  88. package/lib/chevre/repo/mongoose/schemas/trip.js +20 -9
  89. package/lib/chevre/repo/offer.js +3 -3
  90. package/lib/chevre/repo/offerCatalog.js +1 -1
  91. package/lib/chevre/repo/offerCatalogItem.js +1 -1
  92. package/lib/chevre/repo/offerItemCondition.js +1 -1
  93. package/lib/chevre/repo/order.js +1 -1
  94. package/lib/chevre/repo/ownershipInfo.js +1 -1
  95. package/lib/chevre/repo/paymentServiceProvider.js +1 -1
  96. package/lib/chevre/repo/permit.js +1 -1
  97. package/lib/chevre/repo/place/hasPOS.js +1 -1
  98. package/lib/chevre/repo/place.js +1 -1
  99. package/lib/chevre/repo/priceSpecification.js +1 -1
  100. package/lib/chevre/repo/product.js +1 -1
  101. package/lib/chevre/repo/productOffer.js +1 -1
  102. package/lib/chevre/repo/project.js +1 -1
  103. package/lib/chevre/repo/reservation.js +1 -1
  104. package/lib/chevre/repo/role.js +1 -1
  105. package/lib/chevre/repo/seller.js +1 -1
  106. package/lib/chevre/repo/serviceOutput.js +1 -1
  107. package/lib/chevre/repo/task.js +1 -1
  108. package/lib/chevre/repo/telemetry.js +1 -1
  109. package/lib/chevre/repo/transaction.js +1 -1
  110. package/lib/chevre/repo/trip.js +1 -1
  111. package/lib/chevre/settings.d.ts +1 -0
  112. package/lib/chevre/settings.js +2 -1
  113. package/package.json +1 -1
@@ -18,7 +18,7 @@ const settings_1 = require("../settings");
18
18
  */
19
19
  class MongoRepository {
20
20
  constructor(connection) {
21
- this.accountModel = connection.model(account_1.modelName, account_1.schema);
21
+ this.accountModel = connection.model(account_1.modelName, (0, account_1.createSchema)());
22
22
  }
23
23
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
24
24
  static CREATE_MONGO_CONDITIONS(params) {
@@ -17,7 +17,7 @@ const accountTitle_1 = require("./mongoose/schemas/accountTitle");
17
17
  */
18
18
  class MongoRepository {
19
19
  constructor(connection) {
20
- this.accountTitleModel = connection.model(accountTitle_1.modelName, accountTitle_1.schema);
20
+ this.accountTitleModel = connection.model(accountTitle_1.modelName, (0, accountTitle_1.createSchema)());
21
21
  }
22
22
  deleteByProject(params) {
23
23
  return __awaiter(this, void 0, void 0, function* () {
@@ -19,7 +19,7 @@ const settings_1 = require("../settings");
19
19
  */
20
20
  class MongoRepository {
21
21
  constructor(connection) {
22
- this.transactionModel = connection.model(accountTransaction_1.modelName, accountTransaction_1.schema);
22
+ this.transactionModel = connection.model(accountTransaction_1.modelName, (0, accountTransaction_1.createSchema)());
23
23
  }
24
24
  static CREATE_MONGO_CONDITIONS(params) {
25
25
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
@@ -17,7 +17,7 @@ const errorHandler_1 = require("../errorHandler");
17
17
  */
18
18
  class MongoRepository {
19
19
  constructor(connection) {
20
- this.accountingReportModel = connection.model(accountingReport_1.modelName, accountingReport_1.schema);
20
+ this.accountingReportModel = connection.model(accountingReport_1.modelName, (0, accountingReport_1.createSchema)());
21
21
  }
22
22
  /**
23
23
  * なければ作成する
@@ -18,7 +18,7 @@ const settings_1 = require("../settings");
18
18
  */
19
19
  class MongoRepository {
20
20
  constructor(connection) {
21
- this.actionModel = connection.model(action_1.modelName, action_1.schema);
21
+ this.actionModel = connection.model(action_1.modelName, (0, action_1.createSchema)());
22
22
  }
23
23
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
24
24
  static CREATE_MONGO_CONDITIONS(params) {
@@ -29,7 +29,7 @@ const settings_1 = require("../settings");
29
29
  */
30
30
  class MongoRepository {
31
31
  constructor(connection) {
32
- this.additionalPropertyModel = connection.model(additionalProperty_1.modelName, additionalProperty_1.schema);
32
+ this.additionalPropertyModel = connection.model(additionalProperty_1.modelName, (0, additionalProperty_1.createSchema)());
33
33
  }
34
34
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
35
35
  static CREATE_MONGO_CONDITIONS(params) {
@@ -18,7 +18,7 @@ const debug = createDebug('chevre-domain:repo:aggregateOffer');
18
18
  */
19
19
  class MongoRepository {
20
20
  constructor(connection) {
21
- this.aggregateOfferModel = connection.model(aggregateOffer_1.modelName, aggregateOffer_1.schema);
21
+ this.aggregateOfferModel = connection.model(aggregateOffer_1.modelName, (0, aggregateOffer_1.createSchema)());
22
22
  }
23
23
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
24
24
  static CREATE_AGGREGATE_OFFERS_MATCH_CONDITIONS(params) {
@@ -44,7 +44,7 @@ var AggregationType;
44
44
  */
45
45
  class MongoRepository {
46
46
  constructor(connection) {
47
- this.aggregationModel = connection.model(aggregation_1.modelName, aggregation_1.schema);
47
+ this.aggregationModel = connection.model(aggregation_1.modelName, (0, aggregation_1.createSchema)());
48
48
  }
49
49
  saveAggregation(params) {
50
50
  return __awaiter(this, void 0, void 0, function* () {
@@ -20,7 +20,7 @@ const settings_1 = require("../settings");
20
20
  */
21
21
  class MongoRepository {
22
22
  constructor(connection) {
23
- this.transactionModel = connection.model(assetTransaction_1.modelName, assetTransaction_1.schema);
23
+ this.transactionModel = connection.model(assetTransaction_1.modelName, (0, assetTransaction_1.createSchema)());
24
24
  }
25
25
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
26
26
  static CREATE_MONGO_CONDITIONS(params) {
@@ -29,7 +29,7 @@ const settings_1 = require("../settings");
29
29
  */
30
30
  class MongoRepository {
31
31
  constructor(connection) {
32
- this.categoryCodeModel = connection.model(categoryCode_1.modelName, categoryCode_1.schema);
32
+ this.categoryCodeModel = connection.model(categoryCode_1.modelName, (0, categoryCode_1.createSchema)());
33
33
  }
34
34
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
35
35
  static CREATE_MONGO_CONDITIONS(params) {
@@ -21,7 +21,7 @@ const settings_1 = require("../settings");
21
21
  */
22
22
  class MongoRepository {
23
23
  constructor(connection) {
24
- this.authorizationModel = connection.model(authorization_1.modelName, authorization_1.schema);
24
+ this.authorizationModel = connection.model(authorization_1.modelName, (0, authorization_1.createSchema)());
25
25
  }
26
26
  // tslint:disable-next-line:max-func-body-length
27
27
  static CREATE_MONGO_CONDITIONS(params) {
@@ -18,7 +18,7 @@ const settings_1 = require("../settings");
18
18
  */
19
19
  class MongoRepository {
20
20
  constructor(connection) {
21
- this.commentModel = connection.model(comments_1.modelName, comments_1.schema);
21
+ this.commentModel = connection.model(comments_1.modelName, (0, comments_1.createSchema)());
22
22
  }
23
23
  static CREATE_MONGO_CONDITIONS(params) {
24
24
  var _a, _b, _c, _d, _e, _f;
@@ -29,7 +29,7 @@ const settings_1 = require("../settings");
29
29
  */
30
30
  class MongoRepository {
31
31
  constructor(connection) {
32
- this.creativeWorkModel = connection.model(creativeWork_1.modelName, creativeWork_1.schema);
32
+ this.creativeWorkModel = connection.model(creativeWork_1.modelName, (0, creativeWork_1.createSchema)());
33
33
  }
34
34
  // tslint:disable-next-line:max-func-body-length
35
35
  static CREATE_MONGO_CONDITIONS(params) {
@@ -29,7 +29,7 @@ const settings_1 = require("../settings");
29
29
  */
30
30
  class MongoRepository {
31
31
  constructor(connection) {
32
- this.customerModel = connection.model(customer_1.modelName, customer_1.schema);
32
+ this.customerModel = connection.model(customer_1.modelName, (0, customer_1.createSchema)());
33
33
  }
34
34
  // tslint:disable-next-line:max-func-body-length
35
35
  static CREATE_MONGO_CONDITIONS(params) {
@@ -29,7 +29,7 @@ const settings_1 = require("../settings");
29
29
  */
30
30
  class MongoRepository {
31
31
  constructor(connection) {
32
- this.emailMessageModel = connection.model(emailMessages_1.modelName, emailMessages_1.schema);
32
+ this.emailMessageModel = connection.model(emailMessages_1.modelName, (0, emailMessages_1.createSchema)());
33
33
  }
34
34
  static CREATE_MONGO_CONDITIONS(params) {
35
35
  var _a, _b, _c, _d, _e;
@@ -49,7 +49,7 @@ exports.PROJECTION_MINIMIZED_EVENT = {
49
49
  */
50
50
  class MongoRepository {
51
51
  constructor(connection) {
52
- this.eventModel = connection.model(event_1.modelName, event_1.schema);
52
+ this.eventModel = connection.model(event_1.modelName, (0, event_1.createSchema)());
53
53
  }
54
54
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
55
55
  static CREATE_MONGO_CONDITIONS(conditions) {
@@ -18,7 +18,7 @@ const settings_1 = require("../settings");
18
18
  */
19
19
  class MongoRepository {
20
20
  constructor(connection) {
21
- this.memberModel = connection.model(member_1.modelName, member_1.schema);
21
+ this.memberModel = connection.model(member_1.modelName, (0, member_1.createSchema)());
22
22
  }
23
23
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
24
24
  static CREATE_MONGO_CONDITIONS(params) {
@@ -29,7 +29,7 @@ const settings_1 = require("../settings");
29
29
  */
30
30
  class MongoRepository {
31
31
  constructor(connection) {
32
- this.merchantReturnPolicyModel = connection.model(merchantReturnPolicy_1.modelName, merchantReturnPolicy_1.schema);
32
+ this.merchantReturnPolicyModel = connection.model(merchantReturnPolicy_1.modelName, (0, merchantReturnPolicy_1.createSchema)());
33
33
  }
34
34
  // tslint:disable-next-line:max-func-body-length
35
35
  static CREATE_MONGO_CONDITIONS(params) {
@@ -1,57 +1,5 @@
1
- /// <reference types="mongoose/types/aggregate" />
2
- /// <reference types="mongoose/types/callback" />
3
- /// <reference types="mongoose/types/collection" />
4
- /// <reference types="mongoose/types/connection" />
5
- /// <reference types="mongoose/types/cursor" />
6
- /// <reference types="mongoose/types/document" />
7
- /// <reference types="mongoose/types/error" />
8
- /// <reference types="mongoose/types/expressions" />
9
- /// <reference types="mongoose/types/helpers" />
10
- /// <reference types="mongoose/types/middlewares" />
11
- /// <reference types="mongoose/types/indexes" />
12
- /// <reference types="mongoose/types/models" />
13
- /// <reference types="mongoose/types/mongooseoptions" />
14
- /// <reference types="mongoose/types/pipelinestage" />
15
- /// <reference types="mongoose/types/populate" />
16
- /// <reference types="mongoose/types/query" />
17
- /// <reference types="mongoose/types/schemaoptions" />
18
- /// <reference types="mongoose/types/schematypes" />
19
- /// <reference types="mongoose/types/session" />
20
- /// <reference types="mongoose/types/types" />
21
- /// <reference types="mongoose/types/utility" />
22
- /// <reference types="mongoose/types/validation" />
23
- /// <reference types="mongoose/types/virtuals" />
24
- /// <reference types="mongoose/types/inferschematype" />
25
- import { Schema } from 'mongoose';
1
+ import { IndexDefinition, IndexOptions, Schema } from 'mongoose';
26
2
  declare const modelName = "Account";
27
- /**
28
- * 口座スキーマ
29
- */
30
- declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
31
- collection: string;
32
- id: true;
33
- read: string;
34
- writeConcern: import("mongodb").WriteConcern;
35
- strict: false;
36
- strictQuery: false;
37
- useNestedStrict: boolean;
38
- timestamps: {
39
- createdAt: string;
40
- updatedAt: string;
41
- };
42
- toJSON: {
43
- getters: false;
44
- virtuals: false;
45
- minimize: false;
46
- versionKey: false;
47
- };
48
- toObject: {
49
- getters: false;
50
- virtuals: true;
51
- minimize: false;
52
- versionKey: false;
53
- };
54
- }, {}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{}>> & Omit<import("mongoose").FlatRecord<{}> & Required<{
55
- _id: unknown;
56
- }>, never>>;
57
- export { modelName, schema };
3
+ declare function createSchema(): Schema;
4
+ declare const indexes: [d: IndexDefinition, o: IndexOptions][];
5
+ export { modelName, indexes, createSchema };
@@ -1,22 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.schema = exports.modelName = void 0;
3
+ exports.createSchema = exports.indexes = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
6
  const settings_1 = require("../../../settings");
7
7
  const modelName = 'Account';
8
8
  exports.modelName = modelName;
9
- /**
10
- * 口座スキーマ
11
- */
12
- const schema = new mongoose_1.Schema({}, {
9
+ const schemaDefinition = {};
10
+ const schemaOptions = {
11
+ autoIndex: settings_1.MONGO_AUTO_INDEX,
12
+ autoCreate: false,
13
13
  collection: 'accounts',
14
14
  id: true,
15
15
  read: settings_1.MONGO_READ_PREFERENCE,
16
16
  writeConcern: writeConcern_1.writeConcern,
17
17
  strict: false,
18
18
  strictQuery: false,
19
- useNestedStrict: true,
20
19
  timestamps: {
21
20
  createdAt: 'createdAt',
22
21
  updatedAt: 'updatedAt'
@@ -33,30 +32,79 @@ const schema = new mongoose_1.Schema({}, {
33
32
  minimize: false,
34
33
  versionKey: false
35
34
  }
36
- });
37
- exports.schema = schema;
38
- // 口座タイプと口座番号でユニーク
39
- schema.index({
40
- accountType: 1,
41
- accountNumber: 1
42
- }, {
43
- unique: true,
44
- partialFilterExpression: {
45
- accountType: { $exists: true },
46
- accountNumber: { $exists: true }
35
+ };
36
+ /**
37
+ * 口座スキーマ
38
+ */
39
+ let schema;
40
+ function createSchema() {
41
+ if (schema === undefined) {
42
+ schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
47
43
  }
48
- });
49
- // 口座番号はグローバルユニーク
50
- schema.index({ accountNumber: 1 }, { name: 'uniqueAccountNumber', unique: true });
51
- schema.index({ createdAt: 1 }, { name: 'searchByCreatedAt' });
52
- schema.index({ updatedAt: 1 }, { name: 'searchByUpdatedAt' });
53
- schema.index({ 'project.id': 1, openDate: -1 }, {
54
- name: 'searchByProjectId-v20220721'
55
- });
56
- schema.index({ typeOf: 1, openDate: -1 }, { name: 'searchByTypeOf-v2' });
57
- schema.index({ accountNumber: 1, openDate: -1 }, { name: 'searchByAccountNumber-v2' });
58
- schema.index({ accountType: 1, openDate: -1 }, { name: 'searchByAccountType-v2' });
59
- schema.index({ name: 1, openDate: -1 }, { name: 'searchByName-v2' });
60
- schema.index({ openDate: -1 }, { name: 'searchByOpenDate-v2' });
61
- schema.index({ status: 1, openDate: -1 }, { name: 'searchByStatus-v2' });
62
- schema.index({ accountType: 1, accountNumber: 1, status: 1 }, { name: 'authorizeAmount' });
44
+ return schema;
45
+ }
46
+ exports.createSchema = createSchema;
47
+ const indexes = [
48
+ // 口座タイプと口座番号でユニーク
49
+ [
50
+ {
51
+ accountType: 1,
52
+ accountNumber: 1
53
+ },
54
+ {
55
+ unique: true,
56
+ partialFilterExpression: {
57
+ accountType: { $exists: true },
58
+ accountNumber: { $exists: true }
59
+ }
60
+ }
61
+ ],
62
+ // 口座番号はグローバルユニーク
63
+ [
64
+ { accountNumber: 1 },
65
+ { name: 'uniqueAccountNumber', unique: true }
66
+ ],
67
+ [
68
+ { createdAt: 1 },
69
+ { name: 'searchByCreatedAt' }
70
+ ],
71
+ [
72
+ { updatedAt: 1 },
73
+ { name: 'searchByUpdatedAt' }
74
+ ],
75
+ [
76
+ { 'project.id': 1, openDate: -1 },
77
+ {
78
+ name: 'searchByProjectId-v20220721'
79
+ }
80
+ ],
81
+ [
82
+ { typeOf: 1, openDate: -1 },
83
+ { name: 'searchByTypeOf-v2' }
84
+ ],
85
+ [
86
+ { accountNumber: 1, openDate: -1 },
87
+ { name: 'searchByAccountNumber-v2' }
88
+ ],
89
+ [
90
+ { accountType: 1, openDate: -1 },
91
+ { name: 'searchByAccountType-v2' }
92
+ ],
93
+ [
94
+ { name: 1, openDate: -1 },
95
+ { name: 'searchByName-v2' }
96
+ ],
97
+ [
98
+ { openDate: -1 },
99
+ { name: 'searchByOpenDate-v2' }
100
+ ],
101
+ [
102
+ { status: 1, openDate: -1 },
103
+ { name: 'searchByStatus-v2' }
104
+ ],
105
+ [
106
+ { accountType: 1, accountNumber: 1, status: 1 },
107
+ { name: 'authorizeAmount' }
108
+ ]
109
+ ];
110
+ exports.indexes = indexes;
@@ -1,91 +1,5 @@
1
- /// <reference types="mongoose/types/aggregate" />
2
- /// <reference types="mongoose/types/callback" />
3
- /// <reference types="mongoose/types/collection" />
4
- /// <reference types="mongoose/types/connection" />
5
- /// <reference types="mongoose/types/cursor" />
6
- /// <reference types="mongoose/types/document" />
7
- /// <reference types="mongoose/types/error" />
8
- /// <reference types="mongoose/types/expressions" />
9
- /// <reference types="mongoose/types/helpers" />
10
- /// <reference types="mongoose/types/middlewares" />
11
- /// <reference types="mongoose/types/indexes" />
12
- /// <reference types="mongoose/types/models" />
13
- /// <reference types="mongoose/types/mongooseoptions" />
14
- /// <reference types="mongoose/types/pipelinestage" />
15
- /// <reference types="mongoose/types/populate" />
16
- /// <reference types="mongoose/types/query" />
17
- /// <reference types="mongoose/types/schemaoptions" />
18
- /// <reference types="mongoose/types/schematypes" />
19
- /// <reference types="mongoose/types/session" />
20
- /// <reference types="mongoose/types/types" />
21
- /// <reference types="mongoose/types/utility" />
22
- /// <reference types="mongoose/types/validation" />
23
- /// <reference types="mongoose/types/virtuals" />
24
- /// <reference types="mongoose/types/inferschematype" />
25
- import { Schema } from 'mongoose';
1
+ import { IndexDefinition, IndexOptions, Schema } from 'mongoose';
26
2
  declare const modelName = "AccountTitle";
27
- /**
28
- * 勘定科目スキーマ
29
- */
30
- declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
31
- collection: string;
32
- id: true;
33
- read: string;
34
- writeConcern: import("mongodb").WriteConcern;
35
- strictQuery: false;
36
- timestamps: {
37
- createdAt: string;
38
- updatedAt: string;
39
- };
40
- toJSON: {
41
- getters: false;
42
- virtuals: false;
43
- minimize: false;
44
- versionKey: false;
45
- };
46
- toObject: {
47
- getters: false;
48
- virtuals: true;
49
- minimize: false;
50
- versionKey: false;
51
- };
52
- }, {
53
- typeOf: string;
54
- name?: string | undefined;
55
- project?: any;
56
- codeValue?: string | undefined;
57
- alternateName?: string | undefined;
58
- description?: string | undefined;
59
- inCodeSet?: any;
60
- hasCategoryCode?: any;
61
- inDefinedTermSet?: any;
62
- hasDefinedTerm?: any;
63
- additionalProperty?: any;
64
- }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
65
- typeOf: string;
66
- name?: string | undefined;
67
- project?: any;
68
- codeValue?: string | undefined;
69
- alternateName?: string | undefined;
70
- description?: string | undefined;
71
- inCodeSet?: any;
72
- hasCategoryCode?: any;
73
- inDefinedTermSet?: any;
74
- hasDefinedTerm?: any;
75
- additionalProperty?: any;
76
- }>> & Omit<import("mongoose").FlatRecord<{
77
- typeOf: string;
78
- name?: string | undefined;
79
- project?: any;
80
- codeValue?: string | undefined;
81
- alternateName?: string | undefined;
82
- description?: string | undefined;
83
- inCodeSet?: any;
84
- hasCategoryCode?: any;
85
- inDefinedTermSet?: any;
86
- hasDefinedTerm?: any;
87
- additionalProperty?: any;
88
- }> & {
89
- _id: import("mongoose").Types.ObjectId;
90
- }, never>>;
91
- export { modelName, schema };
3
+ declare function createSchema(): Schema;
4
+ declare const indexes: [d: IndexDefinition, o: IndexOptions][];
5
+ export { modelName, indexes, createSchema };
@@ -1,15 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.schema = exports.modelName = void 0;
3
+ exports.createSchema = exports.indexes = exports.modelName = void 0;
4
4
  const mongoose_1 = require("mongoose");
5
5
  const writeConcern_1 = require("../writeConcern");
6
6
  const settings_1 = require("../../../settings");
7
7
  const modelName = 'AccountTitle';
8
8
  exports.modelName = modelName;
9
- /**
10
- * 勘定科目スキーマ
11
- */
12
- const schema = new mongoose_1.Schema({
9
+ const schemaDefinition = {
13
10
  project: mongoose_1.SchemaTypes.Mixed,
14
11
  typeOf: {
15
12
  type: String,
@@ -24,7 +21,10 @@ const schema = new mongoose_1.Schema({
24
21
  inDefinedTermSet: mongoose_1.SchemaTypes.Mixed,
25
22
  hasDefinedTerm: mongoose_1.SchemaTypes.Mixed,
26
23
  additionalProperty: mongoose_1.SchemaTypes.Mixed
27
- }, {
24
+ };
25
+ const schemaOptions = {
26
+ autoIndex: settings_1.MONGO_AUTO_INDEX,
27
+ autoCreate: false,
28
28
  collection: 'accountTitles',
29
29
  id: true,
30
30
  read: settings_1.MONGO_READ_PREFERENCE,
@@ -46,42 +46,79 @@ const schema = new mongoose_1.Schema({
46
46
  minimize: false,
47
47
  versionKey: false
48
48
  }
49
- });
50
- exports.schema = schema;
51
- schema.index({ createdAt: 1 }, { name: 'searchByCreatedAt' });
52
- schema.index({ updatedAt: 1 }, { name: 'searchByUpdatedAt' });
53
- schema.index({ codeValue: 1 }, { name: 'searchByCodeValue' });
54
- schema.index({ 'hasCategoryCode.codeValue': 1, codeValue: 1 }, {
55
- name: 'searchByHasCategoryCodeCodeValue',
56
- partialFilterExpression: {
57
- 'hasCategoryCode.codeValue': { $exists: true }
58
- }
59
- });
60
- schema.index({ 'hasCategoryCode.hasCategoryCode.codeValue': 1, codeValue: 1 }, {
61
- name: 'searchByHasCategoryCodeHasCategoryCodeCodeValue',
62
- partialFilterExpression: {
63
- 'hasCategoryCode.hasCategoryCode.codeValue': { $exists: true }
64
- }
65
- });
66
- schema.index({ 'hasCategoryCode.hasCategoryCode.name': 1, codeValue: 1 }, {
67
- name: 'searchByHasCategoryCodeHasCategoryCodeName',
68
- partialFilterExpression: {
69
- 'hasCategoryCode.hasCategoryCode.name': { $exists: true }
70
- }
71
- });
72
- schema.index({ 'project.id': 1, codeValue: 1 }, {
73
- name: 'uniqueCodeValue',
74
- unique: true,
75
- partialFilterExpression: {
76
- 'project.id': { $exists: true },
77
- codeValue: { $exists: true }
78
- }
79
- });
80
- schema.index({ 'project.id': 1, 'hasCategoryCode.codeValue': 1 }, {
81
- name: 'uniqueHasCategoryCodeCodeValue',
82
- unique: true,
83
- partialFilterExpression: {
84
- 'project.id': { $exists: true },
85
- 'hasCategoryCode.codeValue': { $exists: true }
49
+ };
50
+ /**
51
+ * 勘定科目スキーマ
52
+ */
53
+ let schema;
54
+ function createSchema() {
55
+ if (schema === undefined) {
56
+ schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
86
57
  }
87
- });
58
+ return schema;
59
+ }
60
+ exports.createSchema = createSchema;
61
+ const indexes = [
62
+ [
63
+ { createdAt: 1 },
64
+ { name: 'searchByCreatedAt' }
65
+ ],
66
+ [
67
+ { updatedAt: 1 },
68
+ { name: 'searchByUpdatedAt' }
69
+ ],
70
+ [
71
+ { codeValue: 1 },
72
+ { name: 'searchByCodeValue' }
73
+ ],
74
+ [
75
+ { 'hasCategoryCode.codeValue': 1, codeValue: 1 },
76
+ {
77
+ name: 'searchByHasCategoryCodeCodeValue',
78
+ partialFilterExpression: {
79
+ 'hasCategoryCode.codeValue': { $exists: true }
80
+ }
81
+ }
82
+ ],
83
+ [
84
+ { 'hasCategoryCode.hasCategoryCode.codeValue': 1, codeValue: 1 },
85
+ {
86
+ name: 'searchByHasCategoryCodeHasCategoryCodeCodeValue',
87
+ partialFilterExpression: {
88
+ 'hasCategoryCode.hasCategoryCode.codeValue': { $exists: true }
89
+ }
90
+ }
91
+ ],
92
+ [
93
+ { 'hasCategoryCode.hasCategoryCode.name': 1, codeValue: 1 },
94
+ {
95
+ name: 'searchByHasCategoryCodeHasCategoryCodeName',
96
+ partialFilterExpression: {
97
+ 'hasCategoryCode.hasCategoryCode.name': { $exists: true }
98
+ }
99
+ }
100
+ ],
101
+ [
102
+ { 'project.id': 1, codeValue: 1 },
103
+ {
104
+ name: 'uniqueCodeValue',
105
+ unique: true,
106
+ partialFilterExpression: {
107
+ 'project.id': { $exists: true },
108
+ codeValue: { $exists: true }
109
+ }
110
+ }
111
+ ],
112
+ [
113
+ { 'project.id': 1, 'hasCategoryCode.codeValue': 1 },
114
+ {
115
+ name: 'uniqueHasCategoryCodeCodeValue',
116
+ unique: true,
117
+ partialFilterExpression: {
118
+ 'project.id': { $exists: true },
119
+ 'hasCategoryCode.codeValue': { $exists: true }
120
+ }
121
+ }
122
+ ]
123
+ ];
124
+ exports.indexes = indexes;