@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
@@ -1,15 +1,13 @@
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 factory = require("../../../factory");
6
6
  const writeConcern_1 = require("../writeConcern");
7
+ const settings_1 = require("../../../settings");
7
8
  const modelName = 'Transaction';
8
9
  exports.modelName = modelName;
9
- /**
10
- * 取引スキーマ
11
- */
12
- const schema = new mongoose_1.Schema({
10
+ const schemaDefinition = {
13
11
  project: mongoose_1.SchemaTypes.Mixed,
14
12
  status: String,
15
13
  typeOf: String,
@@ -26,14 +24,16 @@ const schema = new mongoose_1.Schema({
26
24
  tasksExportedAt: Date,
27
25
  tasksExportationStatus: String,
28
26
  potentialActions: mongoose_1.SchemaTypes.Mixed
29
- }, {
27
+ };
28
+ const schemaOptions = {
29
+ autoIndex: settings_1.MONGO_AUTO_INDEX,
30
+ autoCreate: false,
30
31
  collection: 'transactions',
31
32
  id: true,
32
33
  read: 'primary',
33
34
  writeConcern: writeConcern_1.writeConcern,
34
35
  strict: true,
35
36
  strictQuery: false,
36
- useNestedStrict: true,
37
37
  timestamps: {
38
38
  createdAt: 'createdAt',
39
39
  updatedAt: 'updatedAt'
@@ -50,173 +50,288 @@ const schema = new mongoose_1.Schema({
50
50
  minimize: false,
51
51
  versionKey: false
52
52
  }
53
- });
54
- exports.schema = schema;
55
- schema.index({ createdAt: 1 }, { name: 'searchByCreatedAt' });
56
- schema.index({ updatedAt: 1 }, { name: 'searchByUpdatedAt' });
57
- schema.index({ 'project.id': 1, startDate: -1 }, {
58
- name: 'searchByProjectId-v20220721'
59
- });
60
- schema.index({ typeOf: 1, startDate: -1 }, { name: 'searchByTypeOfAndStartDate' });
61
- schema.index({ status: 1, startDate: -1 }, { name: 'searchByStatusAndStartDate' });
62
- schema.index({ startDate: -1 }, { name: 'searchByStartDateDescending' });
63
- schema.index({ endDate: 1, startDate: -1 }, {
64
- name: 'searchByEndDateAndStartDate',
65
- partialFilterExpression: {
66
- endDate: { $exists: true }
67
- }
68
- });
69
- schema.index({ expires: 1, startDate: -1 }, { name: 'searchByExpiresAndStartDate' });
70
- schema.index({ tasksExportationStatus: 1, startDate: -1 }, { name: 'searchByTasksExportationStatusAndStartDate' });
71
- schema.index({ tasksExportedAt: 1, startDate: -1 }, {
72
- name: 'searchByTasksExportedAtAndStartDate',
73
- partialFilterExpression: {
74
- tasksExportedAt: { $exists: true }
75
- }
76
- });
77
- schema.index({ 'result.order.confirmationNumber': 1, startDate: -1 }, {
78
- name: 'searchByResultOrderConfirmationNumber',
79
- partialFilterExpression: {
80
- 'result.order.confirmationNumber': { $exists: true }
81
- }
82
- });
83
- schema.index({ 'result.order.orderNumber': 1, startDate: -1 }, {
84
- name: 'searchByResultOrderNumberAndStartDate',
85
- partialFilterExpression: {
86
- 'result.order.orderNumber': { $exists: true }
87
- }
88
- });
89
- schema.index({ 'object.confirmationNumber': 1, startDate: -1 }, {
90
- name: 'searchByObjectConfirmationNumber',
91
- partialFilterExpression: {
92
- 'object.confirmationNumber': { $exists: true }
93
- }
94
- });
95
- schema.index({ 'object.orderNumber': 1, startDate: -1 }, {
96
- name: 'searchByObjectOrderNumber',
97
- partialFilterExpression: {
98
- 'object.orderNumber': { $exists: true }
99
- }
100
- });
101
- schema.index({ 'object.identifier': 1, startDate: -1 }, {
102
- name: 'searchByObjectIdentifier',
103
- partialFilterExpression: {
104
- 'object.identifier': { $exists: true }
105
- }
106
- });
107
- schema.index({ 'object.order.orderNumber': 1, startDate: -1 }, {
108
- name: 'searchByObjectOrderNumberAndStartDate',
109
- partialFilterExpression: {
110
- 'object.order.orderNumber': { $exists: true }
111
- }
112
- });
113
- // 結果の注文番号はユニークなはず
114
- schema.index({
115
- typeOf: 1,
116
- 'result.order.orderNumber': 1
117
- }, {
118
- name: 'searchPlaceOrderByOrderNumber',
119
- unique: true,
120
- partialFilterExpression: {
121
- 'result.order.orderNumber': { $exists: true }
122
- }
123
- });
124
- schema.index({
125
- typeOf: 1,
126
- 'object.order.orderNumber': 1
127
- }, {
128
- name: 'searchReturnOrderByOrderNumber',
129
- partialFilterExpression: {
130
- 'object.order.orderNumber': { $exists: true }
131
- }
132
- });
133
- // ひとつの注文取引に対する確定返品取引はユニークなはず
134
- schema.index({ 'object.order.orderNumber': 1 }, {
135
- unique: true,
136
- partialFilterExpression: {
137
- typeOf: factory.transactionType.ReturnOrder,
138
- status: factory.transactionStatusType.Confirmed,
139
- 'object.order.orderNumber': { $exists: true }
140
- }
141
- });
142
- schema.index({ 'agent.typeOf': 1, startDate: -1 }, {
143
- name: 'searchByAgentTypeOfAndStartDate',
144
- partialFilterExpression: {
145
- 'agent.typeOf': { $exists: true }
146
- }
147
- });
148
- schema.index({ 'agent.id': 1, startDate: -1 }, {
149
- name: 'searchByAgentIdAndStartDate',
150
- partialFilterExpression: {
151
- 'agent.id': { $exists: true }
152
- }
153
- });
154
- schema.index({ 'agent.identifier': 1, startDate: -1 }, {
155
- name: 'searchByAgentIdentifierAndStartDate',
156
- partialFilterExpression: {
157
- 'agent.identifier': { $exists: true }
158
- }
159
- });
160
- schema.index({ 'agent.familyName': 1, startDate: -1 }, {
161
- name: 'searchByAgentFamilyName',
162
- partialFilterExpression: {
163
- 'agent.familyName': { $exists: true }
164
- }
165
- });
166
- schema.index({ 'agent.givenName': 1, startDate: -1 }, {
167
- name: 'searchByAgentGivenName',
168
- partialFilterExpression: {
169
- 'agent.givenName': { $exists: true }
170
- }
171
- });
172
- schema.index({ 'agent.email': 1, startDate: -1 }, {
173
- name: 'searchByAgentEmail',
174
- partialFilterExpression: {
175
- 'agent.email': { $exists: true }
176
- }
177
- });
178
- schema.index({ 'agent.telephone': 1, startDate: -1 }, {
179
- name: 'searchByAgentTelephone',
180
- partialFilterExpression: {
181
- 'agent.telephone': { $exists: true }
182
- }
183
- });
184
- schema.index({ 'seller.typeOf': 1, startDate: -1 }, {
185
- name: 'searchBySellerTypeOfAndStartDate',
186
- partialFilterExpression: {
187
- 'seller.typeOf': { $exists: true }
188
- }
189
- });
190
- schema.index({ 'seller.id': 1, startDate: -1 }, {
191
- name: 'searchBySellerIdAndStartDate',
192
- partialFilterExpression: {
193
- 'seller.id': { $exists: true }
194
- }
195
- });
196
- schema.index({ typeOf: 1, status: 1, tasksExportationStatus: 1 }, {
197
- name: 'startExportTasks'
198
- });
199
- schema.index({ 'project.id': 1, typeOf: 1, status: 1, tasksExportationStatus: 1 }, {
200
- name: 'startExportTasks-v2',
201
- partialFilterExpression: {
202
- 'project.id': { $exists: true }
203
- }
204
- });
205
- schema.index({ tasksExportationStatus: 1, updatedAt: 1 }, {
206
- name: 'reexportTasks'
207
- });
208
- schema.index({ 'project.id': 1, tasksExportationStatus: 1, updatedAt: 1 }, {
209
- name: 'reexportTasks-v2',
210
- partialFilterExpression: {
211
- 'project.id': { $exists: true }
212
- }
213
- });
214
- schema.index({ status: 1, expires: 1 }, {
215
- name: 'makeExpired'
216
- });
217
- schema.index({ 'project.id': 1, status: 1, expires: 1 }, {
218
- name: 'makeExpired-v2',
219
- partialFilterExpression: {
220
- 'project.id': { $exists: true }
53
+ };
54
+ /**
55
+ * 取引スキーマ
56
+ */
57
+ let schema;
58
+ function createSchema() {
59
+ if (schema === undefined) {
60
+ schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
221
61
  }
222
- });
62
+ return schema;
63
+ }
64
+ exports.createSchema = createSchema;
65
+ const indexes = [
66
+ [
67
+ { createdAt: 1 },
68
+ { name: 'searchByCreatedAt' }
69
+ ],
70
+ [
71
+ { updatedAt: 1 },
72
+ { name: 'searchByUpdatedAt' }
73
+ ],
74
+ [
75
+ { 'project.id': 1, startDate: -1 },
76
+ {
77
+ name: 'searchByProjectId-v20220721'
78
+ }
79
+ ],
80
+ [
81
+ { typeOf: 1, startDate: -1 },
82
+ { name: 'searchByTypeOfAndStartDate' }
83
+ ],
84
+ [
85
+ { status: 1, startDate: -1 },
86
+ { name: 'searchByStatusAndStartDate' }
87
+ ],
88
+ [
89
+ { startDate: -1 },
90
+ { name: 'searchByStartDateDescending' }
91
+ ],
92
+ [
93
+ { endDate: 1, startDate: -1 },
94
+ {
95
+ name: 'searchByEndDateAndStartDate',
96
+ partialFilterExpression: {
97
+ endDate: { $exists: true }
98
+ }
99
+ }
100
+ ],
101
+ [
102
+ { expires: 1, startDate: -1 },
103
+ { name: 'searchByExpiresAndStartDate' }
104
+ ],
105
+ [
106
+ { tasksExportationStatus: 1, startDate: -1 },
107
+ { name: 'searchByTasksExportationStatusAndStartDate' }
108
+ ],
109
+ [
110
+ { tasksExportedAt: 1, startDate: -1 },
111
+ {
112
+ name: 'searchByTasksExportedAtAndStartDate',
113
+ partialFilterExpression: {
114
+ tasksExportedAt: { $exists: true }
115
+ }
116
+ }
117
+ ],
118
+ [
119
+ { 'result.order.confirmationNumber': 1, startDate: -1 },
120
+ {
121
+ name: 'searchByResultOrderConfirmationNumber',
122
+ partialFilterExpression: {
123
+ 'result.order.confirmationNumber': { $exists: true }
124
+ }
125
+ }
126
+ ],
127
+ [
128
+ { 'result.order.orderNumber': 1, startDate: -1 },
129
+ {
130
+ name: 'searchByResultOrderNumberAndStartDate',
131
+ partialFilterExpression: {
132
+ 'result.order.orderNumber': { $exists: true }
133
+ }
134
+ }
135
+ ],
136
+ [
137
+ { 'object.confirmationNumber': 1, startDate: -1 },
138
+ {
139
+ name: 'searchByObjectConfirmationNumber',
140
+ partialFilterExpression: {
141
+ 'object.confirmationNumber': { $exists: true }
142
+ }
143
+ }
144
+ ],
145
+ [
146
+ { 'object.orderNumber': 1, startDate: -1 },
147
+ {
148
+ name: 'searchByObjectOrderNumber',
149
+ partialFilterExpression: {
150
+ 'object.orderNumber': { $exists: true }
151
+ }
152
+ }
153
+ ],
154
+ [
155
+ { 'object.identifier': 1, startDate: -1 },
156
+ {
157
+ name: 'searchByObjectIdentifier',
158
+ partialFilterExpression: {
159
+ 'object.identifier': { $exists: true }
160
+ }
161
+ }
162
+ ],
163
+ [
164
+ { 'object.order.orderNumber': 1, startDate: -1 },
165
+ {
166
+ name: 'searchByObjectOrderNumberAndStartDate',
167
+ partialFilterExpression: {
168
+ 'object.order.orderNumber': { $exists: true }
169
+ }
170
+ }
171
+ ],
172
+ [
173
+ // 結果の注文番号はユニークなはず
174
+ {
175
+ typeOf: 1,
176
+ 'result.order.orderNumber': 1
177
+ },
178
+ {
179
+ name: 'searchPlaceOrderByOrderNumber',
180
+ unique: true,
181
+ partialFilterExpression: {
182
+ 'result.order.orderNumber': { $exists: true }
183
+ }
184
+ }
185
+ ],
186
+ [
187
+ {
188
+ typeOf: 1,
189
+ 'object.order.orderNumber': 1
190
+ },
191
+ {
192
+ name: 'searchReturnOrderByOrderNumber',
193
+ partialFilterExpression: {
194
+ 'object.order.orderNumber': { $exists: true }
195
+ }
196
+ }
197
+ ],
198
+ [
199
+ // ひとつの注文取引に対する確定返品取引はユニークなはず
200
+ { 'object.order.orderNumber': 1 },
201
+ {
202
+ unique: true,
203
+ partialFilterExpression: {
204
+ typeOf: factory.transactionType.ReturnOrder,
205
+ status: factory.transactionStatusType.Confirmed,
206
+ 'object.order.orderNumber': { $exists: true }
207
+ }
208
+ }
209
+ ],
210
+ [
211
+ { 'agent.typeOf': 1, startDate: -1 },
212
+ {
213
+ name: 'searchByAgentTypeOfAndStartDate',
214
+ partialFilterExpression: {
215
+ 'agent.typeOf': { $exists: true }
216
+ }
217
+ }
218
+ ],
219
+ [
220
+ { 'agent.id': 1, startDate: -1 },
221
+ {
222
+ name: 'searchByAgentIdAndStartDate',
223
+ partialFilterExpression: {
224
+ 'agent.id': { $exists: true }
225
+ }
226
+ }
227
+ ],
228
+ [
229
+ { 'agent.identifier': 1, startDate: -1 },
230
+ {
231
+ name: 'searchByAgentIdentifierAndStartDate',
232
+ partialFilterExpression: {
233
+ 'agent.identifier': { $exists: true }
234
+ }
235
+ }
236
+ ],
237
+ [
238
+ { 'agent.familyName': 1, startDate: -1 },
239
+ {
240
+ name: 'searchByAgentFamilyName',
241
+ partialFilterExpression: {
242
+ 'agent.familyName': { $exists: true }
243
+ }
244
+ }
245
+ ],
246
+ [
247
+ { 'agent.givenName': 1, startDate: -1 },
248
+ {
249
+ name: 'searchByAgentGivenName',
250
+ partialFilterExpression: {
251
+ 'agent.givenName': { $exists: true }
252
+ }
253
+ }
254
+ ],
255
+ [
256
+ { 'agent.email': 1, startDate: -1 },
257
+ {
258
+ name: 'searchByAgentEmail',
259
+ partialFilterExpression: {
260
+ 'agent.email': { $exists: true }
261
+ }
262
+ }
263
+ ],
264
+ [
265
+ { 'agent.telephone': 1, startDate: -1 },
266
+ {
267
+ name: 'searchByAgentTelephone',
268
+ partialFilterExpression: {
269
+ 'agent.telephone': { $exists: true }
270
+ }
271
+ }
272
+ ],
273
+ [
274
+ { 'seller.typeOf': 1, startDate: -1 },
275
+ {
276
+ name: 'searchBySellerTypeOfAndStartDate',
277
+ partialFilterExpression: {
278
+ 'seller.typeOf': { $exists: true }
279
+ }
280
+ }
281
+ ],
282
+ [
283
+ { 'seller.id': 1, startDate: -1 },
284
+ {
285
+ name: 'searchBySellerIdAndStartDate',
286
+ partialFilterExpression: {
287
+ 'seller.id': { $exists: true }
288
+ }
289
+ }
290
+ ],
291
+ [
292
+ { typeOf: 1, status: 1, tasksExportationStatus: 1 },
293
+ {
294
+ name: 'startExportTasks'
295
+ }
296
+ ],
297
+ [
298
+ { 'project.id': 1, typeOf: 1, status: 1, tasksExportationStatus: 1 },
299
+ {
300
+ name: 'startExportTasks-v2',
301
+ partialFilterExpression: {
302
+ 'project.id': { $exists: true }
303
+ }
304
+ }
305
+ ],
306
+ [
307
+ { tasksExportationStatus: 1, updatedAt: 1 },
308
+ {
309
+ name: 'reexportTasks'
310
+ }
311
+ ],
312
+ [
313
+ { 'project.id': 1, tasksExportationStatus: 1, updatedAt: 1 },
314
+ {
315
+ name: 'reexportTasks-v2',
316
+ partialFilterExpression: {
317
+ 'project.id': { $exists: true }
318
+ }
319
+ }
320
+ ],
321
+ [
322
+ { status: 1, expires: 1 },
323
+ {
324
+ name: 'makeExpired'
325
+ }
326
+ ],
327
+ [
328
+ { 'project.id': 1, status: 1, expires: 1 },
329
+ {
330
+ name: 'makeExpired-v2',
331
+ partialFilterExpression: {
332
+ 'project.id': { $exists: true }
333
+ }
334
+ }
335
+ ]
336
+ ];
337
+ exports.indexes = indexes;
@@ -1,66 +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 = "Trip";
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
- }, {
55
- typeOf: string;
56
- project?: any;
57
- }, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
58
- typeOf: string;
59
- project?: any;
60
- }>> & Omit<import("mongoose").FlatRecord<{
61
- typeOf: string;
62
- project?: any;
63
- }> & {
64
- _id: import("mongoose").Types.ObjectId;
65
- }, never>>;
66
- export { modelName, schema };
3
+ declare function createSchema(): Schema;
4
+ declare const indexes: [d: IndexDefinition, o: IndexOptions][];
5
+ export { modelName, indexes, createSchema };
@@ -1,28 +1,27 @@
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 = 'Trip';
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,
16
13
  required: true
17
14
  }
18
- }, {
15
+ };
16
+ const schemaOptions = {
17
+ autoIndex: settings_1.MONGO_AUTO_INDEX,
18
+ autoCreate: false,
19
19
  collection: 'trips',
20
20
  id: true,
21
21
  read: settings_1.MONGO_READ_PREFERENCE,
22
22
  writeConcern: writeConcern_1.writeConcern,
23
23
  strict: false,
24
24
  strictQuery: false,
25
- useNestedStrict: true,
26
25
  timestamps: {
27
26
  createdAt: 'createdAt',
28
27
  updatedAt: 'updatedAt'
@@ -39,5 +38,17 @@ const schema = new mongoose_1.Schema({
39
38
  minimize: false,
40
39
  versionKey: false
41
40
  }
42
- });
43
- exports.schema = schema;
41
+ };
42
+ /**
43
+ * トリップスキーマ
44
+ */
45
+ let schema;
46
+ function createSchema() {
47
+ if (schema === undefined) {
48
+ schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
49
+ }
50
+ return schema;
51
+ }
52
+ exports.createSchema = createSchema;
53
+ const indexes = [];
54
+ exports.indexes = indexes;
@@ -35,9 +35,9 @@ const OFFERS_ARRAY_INDEX_NAME = 'offerIndex';
35
35
  */
36
36
  class MongoRepository {
37
37
  constructor(connection) {
38
- this.aggregateOfferModel = connection.model(aggregateOffer_1.modelName, aggregateOffer_1.schema);
39
- this.offerCatalogModel = connection.model(offerCatalog_1.modelName, offerCatalog_1.schema);
40
- this.offerCatalogItemModel = connection.model(offerCatalogItem_1.modelName, offerCatalogItem_1.schema);
38
+ this.aggregateOfferModel = connection.model(aggregateOffer_1.modelName, (0, aggregateOffer_1.createSchema)());
39
+ this.offerCatalogModel = connection.model(offerCatalog_1.modelName, (0, offerCatalog_1.createSchema)());
40
+ this.offerCatalogItemModel = connection.model(offerCatalogItem_1.modelName, (0, offerCatalogItem_1.createSchema)());
41
41
  }
42
42
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
43
43
  static CREATE_AGGREGATE_OFFERS_MATCH_CONDITIONS(params) {
@@ -29,7 +29,7 @@ const offerCatalog_1 = require("./mongoose/schemas/offerCatalog");
29
29
  */
30
30
  class MongoRepository {
31
31
  constructor(connection) {
32
- this.offerCatalogModel = connection.model(offerCatalog_1.modelName, offerCatalog_1.schema);
32
+ this.offerCatalogModel = connection.model(offerCatalog_1.modelName, (0, offerCatalog_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 offerCatalogItem_1 = require("./mongoose/schemas/offerCatalogItem");
29
29
  */
30
30
  class MongoRepository {
31
31
  constructor(connection) {
32
- this.offerCatalogItemModel = connection.model(offerCatalogItem_1.modelName, offerCatalogItem_1.schema);
32
+ this.offerCatalogItemModel = connection.model(offerCatalogItem_1.modelName, (0, offerCatalogItem_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.offerItemConditionModel = connection.model(offerItemCondition_1.modelName, offerItemCondition_1.schema);
32
+ this.offerItemConditionModel = connection.model(offerItemCondition_1.modelName, (0, offerItemCondition_1.createSchema)());
33
33
  }
34
34
  static CREATE_MONGO_CONDITIONS(params) {
35
35
  var _a, _b, _c, _d, _e, _f;
@@ -20,7 +20,7 @@ const settings_1 = require("../settings");
20
20
  */
21
21
  class MongoRepository {
22
22
  constructor(connection) {
23
- this.orderModel = connection.model(order_1.modelName, order_1.schema);
23
+ this.orderModel = connection.model(order_1.modelName, (0, order_1.createSchema)());
24
24
  }
25
25
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
26
26
  static CREATE_MONGO_CONDITIONS(params) {
@@ -20,7 +20,7 @@ const settings_1 = require("../settings");
20
20
  */
21
21
  class MongoRepository {
22
22
  constructor(connection) {
23
- this.ownershipInfoModel = connection.model(ownershipInfo_1.modelName, ownershipInfo_1.schema);
23
+ this.ownershipInfoModel = connection.model(ownershipInfo_1.modelName, (0, ownershipInfo_1.createSchema)());
24
24
  }
25
25
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
26
26
  static CREATE_MONGO_CONDITIONS(params) {
@@ -19,7 +19,7 @@ const settings_1 = require("../settings");
19
19
  */
20
20
  class MongoRepository {
21
21
  constructor(connection) {
22
- this.productModel = connection.model(product_1.modelName, product_1.schema);
22
+ this.productModel = connection.model(product_1.modelName, (0, product_1.createSchema)());
23
23
  }
24
24
  /**
25
25
  * 決済サービスプロバイダー検索