@chevre/domain 21.0.0-alpha.6 → 21.0.0-alpha.8

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 (64) hide show
  1. package/lib/chevre/repo/account.js +3 -2
  2. package/lib/chevre/repo/accountTransaction.js +2 -2
  3. package/lib/chevre/repo/action.js +2 -2
  4. package/lib/chevre/repo/additionalProperty.js +2 -2
  5. package/lib/chevre/repo/assetTransaction.js +2 -2
  6. package/lib/chevre/repo/categoryCode.js +2 -2
  7. package/lib/chevre/repo/code.js +2 -2
  8. package/lib/chevre/repo/comment.js +2 -2
  9. package/lib/chevre/repo/creativeWork.js +2 -2
  10. package/lib/chevre/repo/customer.js +2 -2
  11. package/lib/chevre/repo/emailMessage.js +2 -2
  12. package/lib/chevre/repo/event.js +2 -2
  13. package/lib/chevre/repo/member.js +10 -7
  14. package/lib/chevre/repo/merchantReturnPolicy.js +2 -2
  15. package/lib/chevre/repo/mongoose/model/account.js +0 -10
  16. package/lib/chevre/repo/mongoose/model/accountTitle.js +0 -25
  17. package/lib/chevre/repo/mongoose/model/accountTransaction.js +0 -10
  18. package/lib/chevre/repo/mongoose/model/accountingReport.js +0 -10
  19. package/lib/chevre/repo/mongoose/model/action.js +0 -10
  20. package/lib/chevre/repo/mongoose/model/additionalProperty.js +0 -10
  21. package/lib/chevre/repo/mongoose/model/aggregation.js +0 -10
  22. package/lib/chevre/repo/mongoose/model/assetTransaction.d.ts +1 -1
  23. package/lib/chevre/repo/mongoose/model/assetTransaction.js +0 -10
  24. package/lib/chevre/repo/mongoose/model/authorization.js +0 -10
  25. package/lib/chevre/repo/mongoose/model/categoryCode.js +0 -10
  26. package/lib/chevre/repo/mongoose/model/comments.js +0 -10
  27. package/lib/chevre/repo/mongoose/model/creativeWork.js +0 -10
  28. package/lib/chevre/repo/mongoose/model/customer.js +0 -10
  29. package/lib/chevre/repo/mongoose/model/emailMessages.js +0 -10
  30. package/lib/chevre/repo/mongoose/model/event.js +0 -10
  31. package/lib/chevre/repo/mongoose/model/member.js +0 -10
  32. package/lib/chevre/repo/mongoose/model/merchantReturnPolicy.js +0 -10
  33. package/lib/chevre/repo/mongoose/model/offer.js +0 -10
  34. package/lib/chevre/repo/mongoose/model/offerCatalog.js +0 -10
  35. package/lib/chevre/repo/mongoose/model/order.js +0 -10
  36. package/lib/chevre/repo/mongoose/model/ownershipInfo.js +0 -10
  37. package/lib/chevre/repo/mongoose/model/place.js +0 -10
  38. package/lib/chevre/repo/mongoose/model/priceSpecification.js +0 -10
  39. package/lib/chevre/repo/mongoose/model/product.js +0 -10
  40. package/lib/chevre/repo/mongoose/model/project.js +0 -10
  41. package/lib/chevre/repo/mongoose/model/reservation.js +0 -10
  42. package/lib/chevre/repo/mongoose/model/role.js +0 -10
  43. package/lib/chevre/repo/mongoose/model/seller.js +0 -10
  44. package/lib/chevre/repo/mongoose/model/serviceOutput.js +0 -10
  45. package/lib/chevre/repo/mongoose/model/task.js +0 -10
  46. package/lib/chevre/repo/mongoose/model/telemetry.js +0 -10
  47. package/lib/chevre/repo/mongoose/model/transaction.d.ts +1 -1
  48. package/lib/chevre/repo/mongoose/model/trip.js +0 -10
  49. package/lib/chevre/repo/offer.js +2 -2
  50. package/lib/chevre/repo/offerCatalog.js +2 -2
  51. package/lib/chevre/repo/order.js +4 -4
  52. package/lib/chevre/repo/ownershipInfo.js +2 -2
  53. package/lib/chevre/repo/place.js +10 -10
  54. package/lib/chevre/repo/priceSpecification.js +2 -2
  55. package/lib/chevre/repo/product.js +2 -2
  56. package/lib/chevre/repo/project.js +2 -2
  57. package/lib/chevre/repo/reservation.js +2 -19
  58. package/lib/chevre/repo/role.js +2 -2
  59. package/lib/chevre/repo/seller.js +2 -2
  60. package/lib/chevre/repo/serviceOutput.js +2 -2
  61. package/lib/chevre/repo/task.js +2 -2
  62. package/lib/chevre/repo/transaction.js +2 -2
  63. package/lib/chevre/repo/trip.js +2 -2
  64. package/package.json +1 -1
@@ -410,9 +410,10 @@ class MongoRepository {
410
410
  });
411
411
  // tslint:disable-next-line:no-single-line-block-comment
412
412
  /* istanbul ignore else */
413
- if (params.limit !== undefined && params.page !== undefined) {
413
+ if (typeof params.limit === 'number' && params.limit > 0) {
414
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
414
415
  query.limit(params.limit)
415
- .skip(params.limit * (params.page - 1));
416
+ .skip(params.limit * (page - 1));
416
417
  }
417
418
  // tslint:disable-next-line:no-single-line-block-comment
418
419
  /* istanbul ignore else */
@@ -304,8 +304,8 @@ class MongoRepository {
304
304
  createdAt: 0,
305
305
  updatedAt: 0
306
306
  });
307
- if (typeof params.limit === 'number') {
308
- const page = (typeof params.page === 'number') ? params.page : 1;
307
+ if (typeof params.limit === 'number' && params.limit > 0) {
308
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
309
309
  query.limit(params.limit)
310
310
  .skip(params.limit * (page - 1));
311
311
  }
@@ -409,8 +409,8 @@ class MongoRepository {
409
409
  }
410
410
  }
411
411
  const query = this.actionModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
412
- if (typeof params.limit === 'number') {
413
- const page = (typeof params.page === 'number') ? params.page : 1;
412
+ if (typeof params.limit === 'number' && params.limit > 0) {
413
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
414
414
  query.limit(params.limit)
415
415
  .skip(params.limit * (page - 1));
416
416
  }
@@ -135,8 +135,8 @@ class MongoRepository {
135
135
  createdAt: 0,
136
136
  updatedAt: 0
137
137
  });
138
- if (typeof params.limit === 'number') {
139
- const page = (typeof params.page === 'number') ? params.page : 1;
138
+ if (typeof params.limit === 'number' && params.limit > 0) {
139
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
140
140
  query.limit(params.limit)
141
141
  .skip(params.limit * (page - 1));
142
142
  }
@@ -477,8 +477,8 @@ class MongoRepository {
477
477
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
478
478
  const query = this.transactionModel.find((conditions.length > 0) ? { $and: conditions } : {})
479
479
  .select(Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection));
480
- if (typeof params.limit === 'number') {
481
- const page = (typeof params.page === 'number') ? params.page : 1;
480
+ if (typeof params.limit === 'number' && params.limit > 0) {
481
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
482
482
  query.limit(params.limit)
483
483
  .skip(params.limit * (page - 1));
484
484
  }
@@ -170,8 +170,8 @@ class MongoRepository {
170
170
  createdAt: 0,
171
171
  updatedAt: 0
172
172
  });
173
- if (typeof params.limit === 'number') {
174
- const page = (typeof params.page === 'number') ? params.page : 1;
173
+ if (typeof params.limit === 'number' && params.limit > 0) {
174
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
175
175
  query.limit(params.limit)
176
176
  .skip(params.limit * (page - 1));
177
177
  }
@@ -190,8 +190,8 @@ class MongoRepository {
190
190
  createdAt: 0,
191
191
  updatedAt: 0
192
192
  });
193
- if (typeof params.limit === 'number') {
194
- const page = (typeof params.page === 'number') ? params.page : 1;
193
+ if (typeof params.limit === 'number' && params.limit > 0) {
194
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
195
195
  query.limit(params.limit)
196
196
  .skip(params.limit * (page - 1));
197
197
  }
@@ -48,8 +48,8 @@ class MongoRepository {
48
48
  createdAt: 0,
49
49
  updatedAt: 0
50
50
  });
51
- if (typeof params.limit === 'number') {
52
- const page = (typeof params.page === 'number') ? params.page : 1;
51
+ if (typeof params.limit === 'number' && params.limit > 0) {
52
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
53
53
  query.limit(params.limit)
54
54
  .skip(params.limit * (page - 1));
55
55
  }
@@ -222,8 +222,8 @@ class MongoRepository {
222
222
  createdAt: 0,
223
223
  updatedAt: 0
224
224
  });
225
- if (typeof params.limit === 'number') {
226
- const page = (typeof params.page === 'number') ? params.page : 1;
225
+ if (typeof params.limit === 'number' && params.limit > 0) {
226
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
227
227
  query.limit(params.limit)
228
228
  .skip(params.limit * (page - 1));
229
229
  }
@@ -110,8 +110,8 @@ class MongoRepository {
110
110
  return __awaiter(this, void 0, void 0, function* () {
111
111
  const andConditions = MongoRepository.CREATE_MONGO_CONDITIONS(conditions);
112
112
  const query = this.customerModel.find((andConditions.length > 0) ? { $and: andConditions } : {}, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection));
113
- if (typeof conditions.limit === 'number') {
114
- const page = (typeof conditions.page === 'number') ? conditions.page : 1;
113
+ if (typeof conditions.limit === 'number' && conditions.limit > 0) {
114
+ const page = (typeof conditions.page === 'number' && conditions.page > 0) ? conditions.page : 1;
115
115
  query.limit(conditions.limit)
116
116
  .skip(conditions.limit * (page - 1));
117
117
  }
@@ -97,8 +97,8 @@ class MongoRepository {
97
97
  createdAt: 0,
98
98
  updatedAt: 0
99
99
  });
100
- if (typeof params.limit === 'number') {
101
- const page = (typeof params.page === 'number') ? params.page : 1;
100
+ if (typeof params.limit === 'number' && params.limit > 0) {
101
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
102
102
  query.limit(params.limit)
103
103
  .skip(params.limit * (page - 1));
104
104
  }
@@ -647,8 +647,8 @@ class MongoRepository {
647
647
  (positiveProjectionExists)
648
648
  ? projection
649
649
  : Object.assign(Object.assign({}, projection), { __v: 0, createdAt: 0, updatedAt: 0 }));
650
- if (typeof params.limit === 'number') {
651
- const page = (typeof params.page === 'number') ? params.page : 1;
650
+ if (typeof params.limit === 'number' && params.limit > 0) {
651
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
652
652
  query.limit(params.limit)
653
653
  .skip(params.limit * (page - 1));
654
654
  }
@@ -114,8 +114,8 @@ class MongoRepository {
114
114
  createdAt: 0,
115
115
  updatedAt: 0
116
116
  });
117
- if (typeof params.limit === 'number') {
118
- const page = (typeof params.page === 'number') ? params.page : 1;
117
+ if (typeof params.limit === 'number' && params.limit > 0) {
118
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
119
119
  query.limit(params.limit)
120
120
  .skip(params.limit * (page - 1));
121
121
  }
@@ -219,12 +219,15 @@ class MongoRepository {
219
219
  const searchConditions = Object.assign({ 'member.id': { $eq: params.member.id } }, (typeof ((_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$regex) === 'string' && params.project.id.$regex.length > 0)
220
220
  ? { 'project.id': { $regex: new RegExp(params.project.id.$regex) } }
221
221
  : undefined);
222
- const projectMembers = yield this.memberModel.find(searchConditions, { project: 1 })
222
+ const query = this.memberModel.find(searchConditions, { project: 1 })
223
223
  // sortを保証する
224
- .sort({ 'project.id': factory.sortType.Ascending })
225
- .limit(params.limit)
226
- .skip(params.limit * (params.page - 1))
227
- .setOptions({ maxTimeMS: 10000 })
224
+ .sort({ 'project.id': factory.sortType.Ascending });
225
+ if (typeof params.limit === 'number' && params.limit > 0) {
226
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
227
+ query.limit(params.limit)
228
+ .skip(params.limit * (page - 1));
229
+ }
230
+ const projectMembers = yield query.setOptions({ maxTimeMS: 10000 })
228
231
  .exec()
229
232
  .then((docs) => docs.map((doc) => doc.toObject()));
230
233
  return projectMembers.map((m) => m.project.id);
@@ -135,8 +135,8 @@ class MongoRepository {
135
135
  createdAt: 0,
136
136
  updatedAt: 0
137
137
  });
138
- if (typeof params.limit === 'number') {
139
- const page = (typeof params.page === 'number') ? params.page : 1;
138
+ if (typeof params.limit === 'number' && params.limit > 0) {
139
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
140
140
  query.limit(params.limit)
141
141
  .skip(params.limit * (page - 1));
142
142
  }
@@ -58,13 +58,3 @@ schema.index({ name: 1, openDate: -1 }, { name: 'searchByName-v2' });
58
58
  schema.index({ openDate: -1 }, { name: 'searchByOpenDate-v2' });
59
59
  schema.index({ status: 1, openDate: -1 }, { name: 'searchByStatus-v2' });
60
60
  schema.index({ accountType: 1, accountNumber: 1, status: 1 }, { name: 'authorizeAmount' });
61
- (0, mongoose_1.model)(modelName, schema)
62
- .on('index',
63
- // tslint:disable-next-line:no-single-line-block-comment
64
- /* istanbul ignore next */
65
- (error) => {
66
- if (error !== undefined) {
67
- // tslint:disable-next-line:no-console
68
- console.error(error);
69
- }
70
- });
@@ -83,28 +83,3 @@ schema.index({ 'project.id': 1, 'hasCategoryCode.codeValue': 1 }, {
83
83
  'hasCategoryCode.codeValue': { $exists: true }
84
84
  }
85
85
  });
86
- // 'hasCategoryCode.hasCategoryCode.codeValue': null のインデックスは作成されてうまくいかないので保留
87
- // schema.index(
88
- // {
89
- // 'project.id': 1,
90
- // 'hasCategoryCode.hasCategoryCode.codeValue': 1
91
- // },
92
- // {
93
- // name: 'uniqueHasCategoryCodeHasCategoryCodeCodeValue',
94
- // unique: true,
95
- // partialFilterExpression: {
96
- // 'project.id': { $exists: true },
97
- // 'hasCategoryCode.hasCategoryCode.codeValue': { $exists: true }
98
- // }
99
- // }
100
- // );
101
- (0, mongoose_1.model)(modelName, schema)
102
- .on('index',
103
- // tslint:disable-next-line:no-single-line-block-comment
104
- /* istanbul ignore next */
105
- (error) => {
106
- if (error !== undefined) {
107
- // tslint:disable-next-line:no-console
108
- console.error(error);
109
- }
110
- });
@@ -109,13 +109,3 @@ schema.index({ tasksExportationStatus: 1, updatedAt: 1 }, {
109
109
  schema.index({ status: 1, expires: 1 }, {
110
110
  name: 'makeExpired'
111
111
  });
112
- (0, mongoose_1.model)(modelName, schema)
113
- .on('index',
114
- // tslint:disable-next-line:no-single-line-block-comment
115
- /* istanbul ignore next */
116
- (error) => {
117
- if (error !== undefined) {
118
- // tslint:disable-next-line:no-console
119
- console.error(error);
120
- }
121
- });
@@ -92,13 +92,3 @@ schema.index({ 'mainEntity.acceptedOffers.itemOffered.reservationFor.startDate':
92
92
  'mainEntity.acceptedOffers.itemOffered.reservationFor.startDate': { $exists: true }
93
93
  }
94
94
  });
95
- (0, mongoose_1.model)(modelName, schema)
96
- .on('index',
97
- // tslint:disable-next-line:no-single-line-block-comment
98
- /* istanbul ignore next */
99
- (error) => {
100
- if (error !== undefined) {
101
- // tslint:disable-next-line:no-console
102
- console.error(error);
103
- }
104
- });
@@ -242,13 +242,3 @@ schema.index({ 'toLocation.accountType': 1, startDate: -1 }, {
242
242
  'toLocation.accountType': { $exists: true }
243
243
  }
244
244
  });
245
- (0, mongoose_1.model)(modelName, schema)
246
- .on('index',
247
- // tslint:disable-next-line:no-single-line-block-comment
248
- /* istanbul ignore next */
249
- (error) => {
250
- if (error !== undefined) {
251
- // tslint:disable-next-line:no-console
252
- console.error(error);
253
- }
254
- });
@@ -69,13 +69,3 @@ schema.index({ 'name.en': 1, codeValue: 1 }, {
69
69
  'name.en': { $exists: true }
70
70
  }
71
71
  });
72
- (0, mongoose_1.model)(modelName, schema)
73
- .on('index',
74
- // tslint:disable-next-line:no-single-line-block-comment
75
- /* istanbul ignore next */
76
- (error) => {
77
- if (error !== undefined) {
78
- // tslint:disable-next-line:no-console
79
- console.error(error);
80
- }
81
- });
@@ -35,13 +35,3 @@ const schema = new mongoose_1.Schema({}, {
35
35
  exports.schema = schema;
36
36
  schema.index({ createdAt: 1 }, { name: 'searchByCreatedAt' });
37
37
  schema.index({ updatedAt: 1 }, { name: 'searchByUpdatedAt' });
38
- (0, mongoose_1.model)(modelName, schema)
39
- .on('index',
40
- // tslint:disable-next-line:no-single-line-block-comment
41
- /* istanbul ignore next */
42
- (error) => {
43
- if (error !== undefined) {
44
- // tslint:disable-next-line:no-console
45
- console.error(error);
46
- }
47
- });
@@ -54,8 +54,8 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
54
54
  object?: any;
55
55
  typeOf?: string | undefined;
56
56
  status?: string | undefined;
57
- expires?: Date | undefined;
58
57
  error?: any;
58
+ expires?: Date | undefined;
59
59
  project?: any;
60
60
  agent?: any;
61
61
  recipient?: any;
@@ -172,13 +172,3 @@ schema.index({ 'object.itemOffered.serviceOutput.identifier': 1, startDate: -1 }
172
172
  schema.index({ typeOf: 1, status: 1, tasksExportationStatus: 1 }, { name: 'startExportTasks' });
173
173
  schema.index({ tasksExportationStatus: 1, updatedAt: 1 }, { name: 'reexportTasks' });
174
174
  schema.index({ status: 1, expires: 1 }, { name: 'makeExpired' });
175
- (0, mongoose_1.model)(modelName, schema)
176
- .on('index',
177
- // tslint:disable-next-line:no-single-line-block-comment
178
- /* istanbul ignore next */
179
- (error) => {
180
- if (error !== undefined) {
181
- // tslint:disable-next-line:no-console
182
- console.error(error);
183
- }
184
- });
@@ -93,13 +93,3 @@ schema.index({ 'object.typeOfGood.id': 1, validFrom: 1 }, {
93
93
  'object.typeOfGood.id': { $exists: true }
94
94
  }
95
95
  });
96
- (0, mongoose_1.model)(modelName, schema)
97
- .on('index',
98
- // tslint:disable-next-line:no-single-line-block-comment
99
- /* istanbul ignore next */
100
- (error) => {
101
- if (error !== undefined) {
102
- // tslint:disable-next-line:no-console
103
- console.error(error);
104
- }
105
- });
@@ -87,13 +87,3 @@ schema.index({ additionalProperty: 1, codeValue: 1 }, {
87
87
  additionalProperty: { $exists: true }
88
88
  }
89
89
  });
90
- (0, mongoose_1.model)(modelName, schema)
91
- .on('index',
92
- // tslint:disable-next-line:no-single-line-block-comment
93
- /* istanbul ignore next */
94
- (error) => {
95
- if (error !== undefined) {
96
- // tslint:disable-next-line:no-console
97
- console.error(error);
98
- }
99
- });
@@ -71,13 +71,3 @@ schema.index({ additionalProperty: 1, dateCreated: 1 }, {
71
71
  additionalProperty: { $exists: true }
72
72
  }
73
73
  });
74
- (0, mongoose_1.model)(modelName, schema)
75
- .on('index',
76
- // tslint:disable-next-line:no-single-line-block-comment
77
- /* istanbul ignore next */
78
- (error) => {
79
- if (error !== undefined) {
80
- // tslint:disable-next-line:no-console
81
- console.error(error);
82
- }
83
- });
@@ -117,13 +117,3 @@ schema.index({ additionalProperty: 1, identifier: 1 }, {
117
117
  additionalProperty: { $exists: true }
118
118
  }
119
119
  });
120
- (0, mongoose_1.model)(modelName, schema)
121
- .on('index',
122
- // tslint:disable-next-line:no-single-line-block-comment
123
- /* istanbul ignore next */
124
- (error) => {
125
- if (error !== undefined) {
126
- // tslint:disable-next-line:no-console
127
- console.error(error);
128
- }
129
- });
@@ -64,13 +64,3 @@ schema.index({ 'name.en': 1, branchCode: 1 }, {
64
64
  'name.en': { $exists: true }
65
65
  }
66
66
  });
67
- (0, mongoose_1.model)(modelName, schema)
68
- .on('index',
69
- // tslint:disable-next-line:no-single-line-block-comment
70
- /* istanbul ignore next */
71
- (error) => {
72
- if (error !== undefined) {
73
- // tslint:disable-next-line:no-console
74
- console.error(error);
75
- }
76
- });
@@ -52,13 +52,3 @@ schema.index({ identifier: 1 }, {
52
52
  schema.index({ 'project.id': 1, identifier: 1 }, {
53
53
  name: 'searchByProjectId'
54
54
  });
55
- (0, mongoose_1.model)(modelName, schema)
56
- .on('index',
57
- // tslint:disable-next-line:no-single-line-block-comment
58
- /* istanbul ignore next */
59
- (error) => {
60
- if (error !== undefined) {
61
- // tslint:disable-next-line:no-console
62
- console.error(error);
63
- }
64
- });
@@ -228,13 +228,3 @@ schema.index({ additionalProperty: 1, startDate: 1 }, {
228
228
  additionalProperty: { $exists: true }
229
229
  }
230
230
  });
231
- (0, mongoose_1.model)(modelName, schema)
232
- .on('index',
233
- // tslint:disable-next-line:no-single-line-block-comment
234
- /* istanbul ignore next */
235
- (error) => {
236
- if (error !== undefined) {
237
- // tslint:disable-next-line:no-console
238
- console.error(error);
239
- }
240
- });
@@ -61,13 +61,3 @@ schema.index({ 'member.hasRole.roleName': 1, 'member.id': 1 }, {
61
61
  'member.hasRole.roleName': { $exists: true }
62
62
  }
63
63
  });
64
- (0, mongoose_1.model)(modelName, schema)
65
- .on('index',
66
- // tslint:disable-next-line:no-single-line-block-comment
67
- /* istanbul ignore next */
68
- (error) => {
69
- if (error !== undefined) {
70
- // tslint:disable-next-line:no-console
71
- console.error(error);
72
- }
73
- });
@@ -46,13 +46,3 @@ const schema = new mongoose_1.Schema({
46
46
  exports.schema = schema;
47
47
  schema.index({ createdAt: 1 }, { name: 'searchByCreatedAt' });
48
48
  schema.index({ updatedAt: 1 }, { name: 'searchByUpdatedAt' });
49
- (0, mongoose_1.model)(modelName, schema)
50
- .on('index',
51
- // tslint:disable-next-line:no-single-line-block-comment
52
- /* istanbul ignore next */
53
- (error) => {
54
- if (error !== undefined) {
55
- // tslint:disable-next-line:no-console
56
- console.error(error);
57
- }
58
- });
@@ -206,13 +206,3 @@ schema.index({ validThrough: 1, 'priceSpecification.price': 1 }, {
206
206
  validThrough: { $exists: true }
207
207
  }
208
208
  });
209
- (0, mongoose_1.model)(modelName, schema)
210
- .on('index',
211
- // tslint:disable-next-line:no-single-line-block-comment
212
- /* istanbul ignore next */
213
- (error) => {
214
- if (error !== undefined) {
215
- // tslint:disable-next-line:no-console
216
- console.error(error);
217
- }
218
- });
@@ -81,13 +81,3 @@ schema.index({ additionalProperty: 1, identifier: 1 }, {
81
81
  additionalProperty: { $exists: true }
82
82
  }
83
83
  });
84
- (0, mongoose_1.model)(modelName, schema)
85
- .on('index',
86
- // tslint:disable-next-line:no-single-line-block-comment
87
- /* istanbul ignore next */
88
- (error) => {
89
- if (error !== undefined) {
90
- // tslint:disable-next-line:no-console
91
- console.error(error);
92
- }
93
- });
@@ -303,13 +303,3 @@ schema.index({ additionalProperty: 1, orderDate: -1 }, {
303
303
  additionalProperty: { $exists: true }
304
304
  }
305
305
  });
306
- (0, mongoose_1.model)(modelName, schema)
307
- .on('index',
308
- // tslint:disable-next-line:no-single-line-block-comment
309
- /* istanbul ignore next */
310
- (error) => {
311
- if (error !== undefined) {
312
- // tslint:disable-next-line:no-console
313
- console.error(error);
314
- }
315
- });
@@ -148,13 +148,3 @@ schema.index({ 'typeOfGood.reservationNumber': 1, ownedFrom: -1 }, {
148
148
  'typeOfGood.reservationNumber': { $exists: true }
149
149
  }
150
150
  });
151
- (0, mongoose_1.model)(modelName, schema)
152
- .on('index',
153
- // tslint:disable-next-line:no-single-line-block-comment
154
- /* istanbul ignore next */
155
- (error) => {
156
- if (error !== undefined) {
157
- // tslint:disable-next-line:no-console
158
- console.error(error);
159
- }
160
- });
@@ -131,13 +131,3 @@ schema.index({ 'containsPlace.containsPlace.containsPlace.additionalProperty': 1
131
131
  'containsPlace.containsPlace.containsPlace.additionalProperty': { $exists: true }
132
132
  }
133
133
  });
134
- (0, mongoose_1.model)(modelName, schema)
135
- .on('index',
136
- // tslint:disable-next-line:no-single-line-block-comment
137
- /* istanbul ignore next */
138
- (error) => {
139
- if (error !== undefined) {
140
- // tslint:disable-next-line:no-console
141
- console.error(error);
142
- }
143
- });
@@ -88,13 +88,3 @@ schema.index({ 'appliesToCategoryCode.inCodeSet.identifier': 1, price: 1 }, {
88
88
  'appliesToCategoryCode.inCodeSet.identifier': { $exists: true }
89
89
  }
90
90
  });
91
- (0, mongoose_1.model)(modelName, schema)
92
- .on('index',
93
- // tslint:disable-next-line:no-single-line-block-comment
94
- /* istanbul ignore next */
95
- (error) => {
96
- if (error !== undefined) {
97
- // tslint:disable-next-line:no-console
98
- console.error(error);
99
- }
100
- });
@@ -99,13 +99,3 @@ schema.index({ 'name.en': 1, productID: 1 }, {
99
99
  'name.en': { $exists: true }
100
100
  }
101
101
  });
102
- (0, mongoose_1.model)(modelName, schema)
103
- .on('index',
104
- // tslint:disable-next-line:no-single-line-block-comment
105
- /* istanbul ignore next */
106
- (error) => {
107
- if (error !== undefined) {
108
- // tslint:disable-next-line:no-console
109
- console.error(error);
110
- }
111
- });
@@ -45,13 +45,3 @@ const schema = new mongoose_1.Schema({
45
45
  }
46
46
  });
47
47
  exports.schema = schema;
48
- (0, mongoose_1.model)(modelName, schema)
49
- .on('index',
50
- // tslint:disable-next-line:no-single-line-block-comment
51
- /* istanbul ignore next */
52
- (error) => {
53
- if (error !== undefined) {
54
- // tslint:disable-next-line:no-console
55
- console.error(error);
56
- }
57
- });
@@ -291,13 +291,3 @@ schema.index({ 'underName.identifier': 1, bookingTime: -1 }, {
291
291
  'underName.identifier': { $exists: true }
292
292
  }
293
293
  });
294
- (0, mongoose_1.model)(modelName, schema)
295
- .on('index',
296
- // tslint:disable-next-line:no-single-line-block-comment
297
- /* istanbul ignore next */
298
- (error) => {
299
- if (error !== undefined) {
300
- // tslint:disable-next-line:no-console
301
- console.error(error);
302
- }
303
- });
@@ -47,13 +47,3 @@ schema.index({ permissions: 1, roleName: 1 }, {
47
47
  permissions: { $exists: true }
48
48
  }
49
49
  });
50
- (0, mongoose_1.model)(modelName, schema)
51
- .on('index',
52
- // tslint:disable-next-line:no-single-line-block-comment
53
- /* istanbul ignore next */
54
- (error) => {
55
- if (error !== undefined) {
56
- // tslint:disable-next-line:no-console
57
- console.error(error);
58
- }
59
- });
@@ -74,13 +74,3 @@ schema.index({ additionalProperty: 1, branchCode: 1 }, {
74
74
  additionalProperty: { $exists: true }
75
75
  }
76
76
  });
77
- (0, mongoose_1.model)(modelName, schema)
78
- .on('index',
79
- // tslint:disable-next-line:no-single-line-block-comment
80
- /* istanbul ignore next */
81
- (error) => {
82
- if (error !== undefined) {
83
- // tslint:disable-next-line:no-console
84
- console.error(error);
85
- }
86
- });
@@ -94,13 +94,3 @@ schema.index({ 'issuedThrough.serviceType.codeValue': 1, productID: 1 }, {
94
94
  'issuedThrough.serviceType.codeValue': { $exists: true }
95
95
  }
96
96
  });
97
- (0, mongoose_1.model)(modelName, schema)
98
- .on('index',
99
- // tslint:disable-next-line:no-single-line-block-comment
100
- /* istanbul ignore next */
101
- (error) => {
102
- if (error !== undefined) {
103
- // tslint:disable-next-line:no-console
104
- console.error(error);
105
- }
106
- });
@@ -148,13 +148,3 @@ schema.index({ 'data.transactionId': 1, runsAt: -1 }, {
148
148
  'data.transactionId': { $exists: true }
149
149
  }
150
150
  });
151
- (0, mongoose_1.model)(modelName, schema)
152
- .on('index',
153
- // tslint:disable-next-line:no-single-line-block-comment
154
- /* istanbul ignore next */
155
- (error) => {
156
- if (error !== undefined) {
157
- // tslint:disable-next-line:no-console
158
- console.error(error);
159
- }
160
- });
@@ -57,13 +57,3 @@ schema.index({ 'purpose.typeOf': 1, 'object.scope': 1, 'object.measuredAt': 1 },
57
57
  'object.measuredAt': { $exists: true }
58
58
  }
59
59
  });
60
- (0, mongoose_1.model)(modelName, schema)
61
- .on('index',
62
- // tslint:disable-next-line:no-single-line-block-comment
63
- /* istanbul ignore next */
64
- (error) => {
65
- if (error !== undefined) {
66
- // tslint:disable-next-line:no-console
67
- console.error(error);
68
- }
69
- });
@@ -54,8 +54,8 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
54
54
  object?: any;
55
55
  typeOf?: string | undefined;
56
56
  status?: string | undefined;
57
- expires?: Date | undefined;
58
57
  error?: any;
58
+ expires?: Date | undefined;
59
59
  project?: any;
60
60
  agent?: any;
61
61
  recipient?: any;
@@ -39,13 +39,3 @@ const schema = new mongoose_1.Schema({
39
39
  }
40
40
  });
41
41
  exports.schema = schema;
42
- (0, mongoose_1.model)(modelName, schema)
43
- .on('index',
44
- // tslint:disable-next-line:no-single-line-block-comment
45
- /* istanbul ignore next */
46
- (error) => {
47
- if (error !== undefined) {
48
- // tslint:disable-next-line:no-console
49
- console.error(error);
50
- }
51
- });
@@ -424,8 +424,8 @@ class MongoRepository {
424
424
  const query = this.offerModel.find((conditions.length > 0) ? { $and: conditions } : {}, (positiveProjectionExists)
425
425
  ? projection
426
426
  : Object.assign(Object.assign({}, projection), { __v: 0, createdAt: 0, updatedAt: 0 }));
427
- if (typeof params.limit === 'number') {
428
- const page = (typeof params.page === 'number') ? params.page : 1;
427
+ if (typeof params.limit === 'number' && params.limit > 0) {
428
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
429
429
  query.limit(params.limit)
430
430
  .skip(params.limit * (page - 1));
431
431
  }
@@ -238,8 +238,8 @@ class MongoRepository {
238
238
  }
239
239
  }
240
240
  ]);
241
- if (typeof params.limit === 'number') {
242
- const page = (typeof params.page === 'number') ? params.page : 1;
241
+ if (typeof params.limit === 'number' && params.limit > 0) {
242
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
243
243
  aggregate.limit(params.limit * page)
244
244
  .skip(params.limit * (page - 1));
245
245
  }
@@ -899,8 +899,8 @@ class MongoRepository {
899
899
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
900
900
  const query = this.orderModel.find((conditions.length > 0) ? { $and: conditions } : {})
901
901
  .select(Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection));
902
- if (typeof params.limit === 'number') {
903
- const page = (typeof params.page === 'number') ? params.page : 1;
902
+ if (typeof params.limit === 'number' && params.limit > 0) {
903
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
904
904
  query.limit(params.limit)
905
905
  .skip(params.limit * (page - 1));
906
906
  }
@@ -970,8 +970,8 @@ class MongoRepository {
970
970
  createdAt: 0,
971
971
  updatedAt: 0
972
972
  });
973
- if (typeof params.limit === 'number') {
974
- const page = (typeof params.page === 'number') ? params.page : 1;
973
+ if (typeof params.limit === 'number' && params.limit > 0) {
974
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
975
975
  aggregate.limit(params.limit * page)
976
976
  .skip(params.limit * (page - 1));
977
977
  }
@@ -291,8 +291,8 @@ class MongoRepository {
291
291
  return __awaiter(this, void 0, void 0, function* () {
292
292
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
293
293
  const query = this.ownershipInfoModel.find((conditions.length > 0) ? { $and: conditions } : {}, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection));
294
- if (typeof params.limit === 'number') {
295
- const page = (typeof params.page === 'number') ? params.page : 1;
294
+ if (typeof params.limit === 'number' && params.limit > 0) {
295
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
296
296
  query.limit(params.limit)
297
297
  .skip(params.limit * (page - 1));
298
298
  }
@@ -278,8 +278,8 @@ class MongoRepository {
278
278
  updatedAt: 0,
279
279
  containsPlace: 0
280
280
  });
281
- if (typeof params.limit === 'number') {
282
- const page = (typeof params.page === 'number') ? params.page : 1;
281
+ if (typeof params.limit === 'number' && params.limit > 0) {
282
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
283
283
  query.limit(params.limit)
284
284
  .skip(params.limit * (page - 1));
285
285
  }
@@ -629,8 +629,8 @@ class MongoRepository {
629
629
  ]);
630
630
  // tslint:disable-next-line:no-single-line-block-comment
631
631
  /* istanbul ignore else */
632
- if (typeof searchConditions.limit === 'number') {
633
- const page = (typeof searchConditions.page === 'number') ? searchConditions.page : 1;
632
+ if (typeof searchConditions.limit === 'number' && searchConditions.limit > 0) {
633
+ const page = (typeof searchConditions.page === 'number' && searchConditions.page > 0) ? searchConditions.page : 1;
634
634
  aggregate.limit(searchConditions.limit * page)
635
635
  .skip(searchConditions.limit * (page - 1));
636
636
  }
@@ -805,8 +805,8 @@ class MongoRepository {
805
805
  ]);
806
806
  // tslint:disable-next-line:no-single-line-block-comment
807
807
  /* istanbul ignore else */
808
- if (typeof searchConditions.limit === 'number') {
809
- const page = (typeof searchConditions.page === 'number') ? searchConditions.page : 1;
808
+ if (typeof searchConditions.limit === 'number' && searchConditions.limit > 0) {
809
+ const page = (typeof searchConditions.page === 'number' && searchConditions.page > 0) ? searchConditions.page : 1;
810
810
  aggregate.limit(searchConditions.limit * page)
811
811
  .skip(searchConditions.limit * (page - 1));
812
812
  }
@@ -1142,8 +1142,8 @@ class MongoRepository {
1142
1142
  }
1143
1143
  }
1144
1144
  ]);
1145
- if (typeof params.limit === 'number') {
1146
- const page = (typeof params.page === 'number') ? params.page : 1;
1145
+ if (typeof params.limit === 'number' && params.limit > 0) {
1146
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
1147
1147
  aggregate.limit(params.limit * page)
1148
1148
  .skip(params.limit * (page - 1));
1149
1149
  }
@@ -1230,8 +1230,8 @@ class MongoRepository {
1230
1230
  updatedAt: 0,
1231
1231
  containsPlace: 0
1232
1232
  });
1233
- if (typeof params.limit === 'number') {
1234
- const page = (typeof params.page === 'number') ? params.page : 1;
1233
+ if (typeof params.limit === 'number' && params.limit > 0) {
1234
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
1235
1235
  query.limit(params.limit)
1236
1236
  .skip(params.limit * (page - 1));
1237
1237
  }
@@ -169,8 +169,8 @@ class MongoRepository {
169
169
  createdAt: 0,
170
170
  updatedAt: 0
171
171
  });
172
- if (typeof params.limit === 'number') {
173
- const page = (typeof params.page === 'number') ? params.page : 1;
172
+ if (typeof params.limit === 'number' && params.limit > 0) {
173
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
174
174
  query.limit(params.limit)
175
175
  .skip(params.limit * (page - 1));
176
176
  }
@@ -160,8 +160,8 @@ class MongoRepository {
160
160
  return __awaiter(this, void 0, void 0, function* () {
161
161
  const andConditions = MongoRepository.CREATE_MONGO_CONDITIONS(conditions);
162
162
  const query = this.productModel.find((andConditions.length > 0) ? { $and: andConditions } : {}, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection));
163
- if (typeof conditions.limit === 'number') {
164
- const page = (typeof conditions.page === 'number') ? conditions.page : 1;
163
+ if (typeof conditions.limit === 'number' && conditions.limit > 0) {
164
+ const page = (typeof conditions.page === 'number' && conditions.page > 0) ? conditions.page : 1;
165
165
  query.limit(conditions.limit)
166
166
  .skip(conditions.limit * (page - 1));
167
167
  }
@@ -79,8 +79,8 @@ class MongoRepository {
79
79
  return __awaiter(this, void 0, void 0, function* () {
80
80
  const andConditions = MongoRepository.CREATE_MONGO_CONDITIONS(conditions);
81
81
  const query = this.projectModel.find((andConditions.length > 0) ? { $and: andConditions } : {}, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection));
82
- if (typeof conditions.limit === 'number') {
83
- const page = (typeof conditions.page === 'number') ? conditions.page : 1;
82
+ if (typeof conditions.limit === 'number' && conditions.limit > 0) {
83
+ const page = (typeof conditions.page === 'number' && conditions.page > 0) ? conditions.page : 1;
84
84
  query.limit(conditions.limit)
85
85
  .skip(conditions.limit * (page - 1));
86
86
  }
@@ -867,8 +867,8 @@ class MongoRepository {
867
867
  createdAt: 0,
868
868
  updatedAt: 0
869
869
  });
870
- if (typeof params.limit === 'number') {
871
- const page = (typeof params.page === 'number') ? params.page : 1;
870
+ if (typeof params.limit === 'number' && params.limit > 0) {
871
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
872
872
  query.limit(params.limit)
873
873
  .skip(params.limit * (page - 1));
874
874
  }
@@ -882,23 +882,6 @@ class MongoRepository {
882
882
  .then((docs) => docs.map((doc) => doc.toObject()));
883
883
  });
884
884
  }
885
- // public stream<T extends factory.reservationType>(params: factory.reservation.ISearchConditions<T>): QueryCursor<Document> {
886
- // const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
887
- // const query = this.reservationModel.find((conditions.length > 0) ? { $and: conditions } : {})
888
- // .select({ __v: 0, createdAt: 0, updatedAt: 0 });
889
- // // tslint:disable-next-line:no-single-line-block-comment
890
- // /* istanbul ignore else */
891
- // if (params.limit !== undefined && params.page !== undefined) {
892
- // query.limit(params.limit)
893
- // .skip(params.limit * (params.page - 1));
894
- // }
895
- // // tslint:disable-next-line:no-single-line-block-comment
896
- // /* istanbul ignore else */
897
- // if (params.sort !== undefined) {
898
- // query.sort(params.sort);
899
- // }
900
- // return query.cursor();
901
- // }
902
885
  findById(params) {
903
886
  return __awaiter(this, void 0, void 0, function* () {
904
887
  let projection = {};
@@ -79,8 +79,8 @@ class MongoRepository {
79
79
  createdAt: 0,
80
80
  updatedAt: 0
81
81
  });
82
- if (typeof params.limit === 'number') {
83
- const page = (typeof params.page === 'number') ? params.page : 1;
82
+ if (typeof params.limit === 'number' && params.limit > 0) {
83
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
84
84
  query.limit(params.limit)
85
85
  .skip(params.limit * (page - 1));
86
86
  }
@@ -172,8 +172,8 @@ class MongoRepository {
172
172
  return __awaiter(this, void 0, void 0, function* () {
173
173
  const andConditions = MongoRepository.CREATE_MONGO_CONDITIONS(conditions);
174
174
  const query = this.organizationModel.find((andConditions.length > 0) ? { $and: andConditions } : {}, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection));
175
- if (typeof conditions.limit === 'number') {
176
- const page = (typeof conditions.page === 'number') ? conditions.page : 1;
175
+ if (typeof conditions.limit === 'number' && conditions.limit > 0) {
176
+ const page = (typeof conditions.page === 'number' && conditions.page > 0) ? conditions.page : 1;
177
177
  query.limit(conditions.limit)
178
178
  .skip(conditions.limit * (page - 1));
179
179
  }
@@ -118,8 +118,8 @@ class MongoRepository {
118
118
  return __awaiter(this, void 0, void 0, function* () {
119
119
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
120
120
  const query = this.serviceOutputModel.find((conditions.length > 0) ? { $and: conditions } : {}, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection));
121
- if (typeof params.limit === 'number') {
122
- const page = (typeof params.page === 'number') ? params.page : 1;
121
+ if (typeof params.limit === 'number' && params.limit > 0) {
122
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
123
123
  query.limit(params.limit)
124
124
  .skip(params.limit * (page - 1));
125
125
  }
@@ -309,8 +309,8 @@ class MongoRepository {
309
309
  return __awaiter(this, void 0, void 0, function* () {
310
310
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
311
311
  const query = this.taskModel.find((conditions.length > 0) ? { $and: conditions } : {}, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection));
312
- if (typeof params.limit === 'number') {
313
- const page = (typeof params.page === 'number') ? params.page : 1;
312
+ if (typeof params.limit === 'number' && params.limit > 0) {
313
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
314
314
  query.limit(params.limit)
315
315
  .skip(params.limit * (page - 1));
316
316
  }
@@ -592,8 +592,8 @@ class MongoRepository {
592
592
  }
593
593
  const query = this.transactionModel.find((conditions.length > 0) ? { $and: conditions } : {})
594
594
  .select(projection);
595
- if (typeof params.limit === 'number') {
596
- const page = (typeof params.page === 'number') ? params.page : 1;
595
+ if (typeof params.limit === 'number' && params.limit > 0) {
596
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
597
597
  query.limit(params.limit)
598
598
  .skip(params.limit * (page - 1));
599
599
  }
@@ -175,8 +175,8 @@ class MongoRepository {
175
175
  return __awaiter(this, void 0, void 0, function* () {
176
176
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
177
177
  const query = this.tripModel.find({ $and: conditions }, Object.assign({ __v: 0, createdAt: 0, updatedAt: 0 }, projection));
178
- if (typeof params.limit === 'number') {
179
- const page = (typeof params.page === 'number') ? params.page : 1;
178
+ if (typeof params.limit === 'number' && params.limit > 0) {
179
+ const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
180
180
  query.limit(params.limit)
181
181
  .skip(params.limit * (page - 1));
182
182
  }
package/package.json CHANGED
@@ -120,5 +120,5 @@
120
120
  "postversion": "git push origin --tags",
121
121
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
122
122
  },
123
- "version": "21.0.0-alpha.6"
123
+ "version": "21.0.0-alpha.8"
124
124
  }