@chevre/domain 22.3.0-alpha.3 → 22.3.0-alpha.4

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.
@@ -5,6 +5,6 @@ type IModel = Model<IDocType>;
5
5
  type ISchemaDefinition = SchemaDefinition<IDocType>;
6
6
  type ISchema = Schema<IDocType, IModel, {}, {}, {}, {}, ISchemaDefinition, IDocType>;
7
7
  declare const modelName = "Account";
8
- declare function createSchema(): ISchema;
9
8
  declare const indexes: [d: IndexDefinition, o: IndexOptions][];
9
+ declare function createSchema(): ISchema;
10
10
  export { createSchema, IModel, indexes, modelName };
@@ -6,7 +6,18 @@ const writeConcern_1 = require("../writeConcern");
6
6
  const settings_1 = require("../../../settings");
7
7
  const modelName = 'Account';
8
8
  exports.modelName = modelName;
9
- const schemaDefinition = {};
9
+ const schemaDefinition = {
10
+ project: mongoose_1.SchemaTypes.Mixed,
11
+ typeOf: String,
12
+ accountType: String,
13
+ accountNumber: String,
14
+ name: String,
15
+ balance: Number,
16
+ availableBalance: Number,
17
+ pendingTransactions: [mongoose_1.SchemaTypes.Mixed],
18
+ openDate: Date,
19
+ closeDate: Date
20
+ };
10
21
  const schemaOptions = {
11
22
  autoIndex: settings_1.MONGO_AUTO_INDEX,
12
23
  autoCreate: false,
@@ -14,7 +25,7 @@ const schemaOptions = {
14
25
  id: true,
15
26
  read: settings_1.MONGO_READ_PREFERENCE,
16
27
  writeConcern: writeConcern_1.writeConcern,
17
- strict: false,
28
+ strict: true,
18
29
  strictQuery: false,
19
30
  timestamps: {
20
31
  createdAt: 'createdAt',
@@ -33,17 +44,6 @@ const schemaOptions = {
33
44
  versionKey: false
34
45
  }
35
46
  };
36
- /**
37
- * 口座スキーマ
38
- */
39
- let schema;
40
- function createSchema() {
41
- if (schema === undefined) {
42
- schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
43
- }
44
- return schema;
45
- }
46
- exports.createSchema = createSchema;
47
47
  const indexes = [
48
48
  // 口座タイプと口座番号でユニーク
49
49
  [
@@ -108,3 +108,19 @@ const indexes = [
108
108
  ]
109
109
  ];
110
110
  exports.indexes = indexes;
111
+ /**
112
+ * 口座スキーマ
113
+ */
114
+ let schema;
115
+ function createSchema() {
116
+ if (schema === undefined) {
117
+ schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
118
+ if (settings_1.MONGO_AUTO_INDEX) {
119
+ indexes.forEach((indexParams) => {
120
+ schema === null || schema === void 0 ? void 0 : schema.index(...indexParams);
121
+ });
122
+ }
123
+ }
124
+ return schema;
125
+ }
126
+ exports.createSchema = createSchema;
@@ -19,6 +19,6 @@ type IModel = Model<IDocType>;
19
19
  type ISchemaDefinition = SchemaDefinition<IDocType>;
20
20
  type ISchema = Schema<IDocType, IModel, {}, {}, {}, {}, ISchemaDefinition, IDocType>;
21
21
  declare const modelName = "AccountingReport";
22
- declare function createSchema(): ISchema;
23
22
  declare const indexes: [d: IndexDefinition, o: IndexOptions][];
23
+ declare function createSchema(): ISchema;
24
24
  export { createSchema, IModel, indexes, modelName };
@@ -19,7 +19,7 @@ const schemaOptions = {
19
19
  id: true,
20
20
  read: settings_1.MONGO_READ_PREFERENCE,
21
21
  writeConcern: writeConcern_1.writeConcern,
22
- strict: false,
22
+ strict: true,
23
23
  strictQuery: false,
24
24
  timestamps: false,
25
25
  versionKey: false,
@@ -36,17 +36,6 @@ const schemaOptions = {
36
36
  versionKey: false
37
37
  }
38
38
  };
39
- /**
40
- * 経理レポートスキーマ
41
- */
42
- let schema;
43
- function createSchema() {
44
- if (schema === undefined) {
45
- schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
46
- }
47
- return schema;
48
- }
49
- exports.createSchema = createSchema;
50
39
  const indexes = [
51
40
  [
52
41
  { 'mainEntity.orderDate': -1 },
@@ -138,3 +127,19 @@ const indexes = [
138
127
  ]
139
128
  ];
140
129
  exports.indexes = indexes;
130
+ /**
131
+ * 経理レポートスキーマ
132
+ */
133
+ let schema;
134
+ function createSchema() {
135
+ if (schema === undefined) {
136
+ schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
137
+ if (settings_1.MONGO_AUTO_INDEX) {
138
+ indexes.forEach((indexParams) => {
139
+ schema === null || schema === void 0 ? void 0 : schema.index(...indexParams);
140
+ });
141
+ }
142
+ }
143
+ return schema;
144
+ }
145
+ exports.createSchema = createSchema;
package/package.json CHANGED
@@ -110,5 +110,5 @@
110
110
  "postversion": "git push origin --tags",
111
111
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
112
112
  },
113
- "version": "22.3.0-alpha.3"
113
+ "version": "22.3.0-alpha.4"
114
114
  }