@chevre/domain 20.4.0-alpha.25 → 20.4.0-alpha.26

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.
File without changes
@@ -10,29 +10,24 @@ const writeConcern = { j: true, w: 'majority', wtimeout: 10000 };
10
10
  */
11
11
  const schema = new mongoose.Schema({
12
12
  project: mongoose.SchemaTypes.Mixed,
13
- typeOf: {
14
- type: String,
15
- required: true
16
- },
17
- eligibleQuantity: mongoose.SchemaTypes.Mixed,
18
- eligibleTransactionVolume: [mongoose.SchemaTypes.Mixed],
19
- maxPrice: Number,
20
- minPrice: Number,
21
- price: Number,
13
+ typeOf: { type: String, required: true },
14
+ name: mongoose.SchemaTypes.Mixed,
15
+ price: { type: Number, required: true },
22
16
  priceCurrency: String,
23
17
  validFrom: Date,
24
18
  validThrough: Date,
25
19
  valueAddedTaxIncluded: Boolean,
26
- referenceQuantity: mongoose.SchemaTypes.Mixed,
27
- appliesToSoundFormat: String,
28
- appliesToVideoFormat: String,
29
- priceComponent: [mongoose.SchemaTypes.Mixed]
20
+ // referenceQuantity: mongoose.SchemaTypes.Mixed,
21
+ // appliesToSoundFormat: String,
22
+ appliesToCategoryCode: mongoose.SchemaTypes.Mixed,
23
+ appliesToMovieTicket: mongoose.SchemaTypes.Mixed,
24
+ appliesToVideoFormat: String
30
25
  }, {
31
26
  collection: 'priceSpecifications',
32
27
  id: true,
33
28
  read: 'primaryPreferred',
34
29
  writeConcern: writeConcern,
35
- strict: false,
30
+ strict: true,
36
31
  useNestedStrict: true,
37
32
  timestamps: {
38
33
  createdAt: 'createdAt',
@@ -54,53 +49,25 @@ const schema = new mongoose.Schema({
54
49
  exports.schema = schema;
55
50
  schema.index({ createdAt: 1 }, { name: 'searchByCreatedAt' });
56
51
  schema.index({ updatedAt: 1 }, { name: 'searchByUpdatedAt' });
57
- schema.index({ price: 1 }, {
58
- name: 'searchByPrice',
59
- partialFilterExpression: {
60
- price: { $exists: true }
61
- }
62
- });
63
- schema.index({ 'priceComponent.typeOf': 1 }, {
64
- name: 'searchByPriceComponentTypeOf',
65
- partialFilterExpression: {
66
- 'priceComponent.typeOf': { $exists: true }
67
- }
68
- });
69
- schema.index({ 'project.id': 1, price: 1 }, {
70
- name: 'searchByProjectId-v20220721'
71
- });
72
- schema.index({ typeOf: 1, price: 1 }, {
73
- name: 'searchByTypeOf-v2',
74
- partialFilterExpression: {
75
- price: { $exists: true }
76
- }
77
- });
78
- schema.index({ appliesToSoundFormat: 1, price: 1 }, {
79
- name: 'searchByAppliesToSoundFormat',
80
- partialFilterExpression: {
81
- appliesToSoundFormat: { $exists: true },
82
- price: { $exists: true }
83
- }
84
- });
52
+ schema.index({ price: 1 }, { name: 'searchByPrice' });
53
+ schema.index({ 'project.id': 1, price: 1 }, { name: 'searchByProjectId' });
54
+ schema.index({ typeOf: 1, price: 1 }, { name: 'searchByTypeOf' });
85
55
  schema.index({ appliesToVideoFormat: 1, price: 1 }, {
86
56
  name: 'searchByAppliesToVideoFormat',
87
57
  partialFilterExpression: {
88
- appliesToVideoFormat: { $exists: true },
89
- price: { $exists: true }
58
+ appliesToVideoFormat: { $exists: true }
90
59
  }
91
60
  });
92
- schema.index({ appliesToMovieTicketType: 1, price: 1 }, {
93
- name: 'searchByAppliesToMovieTicketType',
61
+ schema.index({ 'appliesToMovieTicket.serviceType': 1, price: 1 }, {
62
+ name: 'searchByAppliesToMovieTicketServiceType',
94
63
  partialFilterExpression: {
95
- appliesToMovieTicketType: { $exists: true },
96
- price: { $exists: true }
64
+ 'appliesToMovieTicket.serviceType': { $exists: true }
97
65
  }
98
66
  });
99
- schema.index({ 'appliesToMovieTicket.serviceType': 1, price: 1 }, {
100
- name: 'searchByAppliesToMovieTicketServiceType',
67
+ schema.index({ 'appliesToMovieTicket.serviceOutput.typeOf': 1, price: 1 }, {
68
+ name: 'searchByAppliesToMovieTicketServiceOutputTypeOf',
101
69
  partialFilterExpression: {
102
- 'appliesToMovieTicket.serviceType': { $exists: true },
103
- price: { $exists: true }
70
+ 'appliesToMovieTicket.serviceOutput.typeOf': { $exists: true }
104
71
  }
105
72
  });
106
73
  schema.index({ appliesToCategoryCode: 1, price: 1 }, {
@@ -32,37 +32,23 @@ class MongoRepository {
32
32
  }
33
33
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
34
34
  static CREATE_MONGO_CONDITIONS(params) {
35
+ var _a, _b, _c, _d, _e, _f;
35
36
  const andConditions = [];
36
- // tslint:disable-next-line:no-single-line-block-comment
37
- /* istanbul ignore else */
38
- if (params.project !== undefined && params.project !== null) {
39
- if (params.project.id !== undefined && params.project.id !== null) {
40
- if (typeof params.project.id.$eq === 'string') {
41
- andConditions.push({
42
- 'project.id': {
43
- $eq: params.project.id.$eq
44
- }
45
- });
46
- }
47
- }
37
+ const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
38
+ if (typeof projectIdEq === 'string') {
39
+ andConditions.push({ 'project.id': { $eq: projectIdEq } });
48
40
  }
49
41
  // tslint:disable-next-line:no-single-line-block-comment
50
42
  /* istanbul ignore else */
51
43
  if (params.id !== undefined && params.id !== null) {
52
44
  if (typeof params.id.$eq === 'string') {
53
- andConditions.push({
54
- _id: {
55
- $eq: params.id.$eq
56
- }
57
- });
45
+ andConditions.push({ _id: { $eq: params.id.$eq } });
58
46
  }
59
47
  }
60
48
  // tslint:disable-next-line:no-single-line-block-comment
61
49
  /* istanbul ignore else */
62
50
  if (params.typeOf !== undefined) {
63
- andConditions.push({
64
- typeOf: params.typeOf
65
- });
51
+ andConditions.push({ typeOf: params.typeOf });
66
52
  }
67
53
  if (params.appliesToCategoryCode !== undefined && params.appliesToCategoryCode !== null) {
68
54
  if (params.appliesToCategoryCode.$elemMatch !== undefined && params.appliesToCategoryCode.$elemMatch !== null) {
@@ -122,15 +108,23 @@ class MongoRepository {
122
108
  }
123
109
  });
124
110
  }
125
- if (params.appliesToMovieTicket !== undefined) {
126
- if (Array.isArray(params.appliesToMovieTicket.serviceTypes)) {
127
- andConditions.push({
128
- 'appliesToMovieTicket.serviceType': {
129
- $exists: true,
130
- $in: params.appliesToMovieTicket.serviceTypes
131
- }
132
- });
133
- }
111
+ const appliesToMovieTicketServiceTypeIn = (_c = params.appliesToMovieTicket) === null || _c === void 0 ? void 0 : _c.serviceTypes;
112
+ if (Array.isArray(appliesToMovieTicketServiceTypeIn)) {
113
+ andConditions.push({
114
+ 'appliesToMovieTicket.serviceType': {
115
+ $exists: true,
116
+ $in: appliesToMovieTicketServiceTypeIn
117
+ }
118
+ });
119
+ }
120
+ const appliesToMovieTicketServiceOutputTypeOfEq = (_f = (_e = (_d = params.appliesToMovieTicket) === null || _d === void 0 ? void 0 : _d.serviceOutput) === null || _e === void 0 ? void 0 : _e.typeOf) === null || _f === void 0 ? void 0 : _f.$eq;
121
+ if (typeof appliesToMovieTicketServiceOutputTypeOfEq === 'string') {
122
+ andConditions.push({
123
+ 'appliesToMovieTicket.serviceOutput.typeOf': {
124
+ $exists: true,
125
+ $eq: appliesToMovieTicketServiceOutputTypeOfEq
126
+ }
127
+ });
134
128
  }
135
129
  // tslint:disable-next-line:no-single-line-block-comment
136
130
  /* istanbul ignore else */
@@ -154,43 +148,6 @@ class MongoRepository {
154
148
  }
155
149
  return andConditions;
156
150
  }
157
- // public async countCompoundPriceSpecifications<T extends factory.priceSpecificationType>(
158
- // params: factory.compoundPriceSpecification.ISearchConditions<T>
159
- // ): Promise<number> {
160
- // const conditions = MongoRepository.CREATE_COMPOUND_PRICE_SPECIFICATION_MONGO_CONDITIONS(params);
161
- // return this.priceSpecificationModel.countDocuments(
162
- // { $and: conditions }
163
- // )
164
- // .setOptions({ maxTimeMS: 10000 })
165
- // .exec();
166
- // }
167
- // public async searchCompoundPriceSpecifications<T extends factory.priceSpecificationType>(
168
- // params: factory.compoundPriceSpecification.ISearchConditions<T>
169
- // ): Promise<factory.compoundPriceSpecification.IPriceSpecification<T>[]> {
170
- // const conditions = MongoRepository.CREATE_COMPOUND_PRICE_SPECIFICATION_MONGO_CONDITIONS(params);
171
- // const query = this.priceSpecificationModel.find(
172
- // { $and: conditions },
173
- // {
174
- // __v: 0,
175
- // createdAt: 0,
176
- // updatedAt: 0
177
- // }
178
- // );
179
- // // tslint:disable-next-line:no-single-line-block-comment
180
- // /* istanbul ignore else */
181
- // if (params.limit !== undefined && params.page !== undefined) {
182
- // query.limit(params.limit)
183
- // .skip(params.limit * (params.page - 1));
184
- // }
185
- // // tslint:disable-next-line:no-single-line-block-comment
186
- // /* istanbul ignore else */
187
- // if (params.sort !== undefined) {
188
- // query.sort(params.sort);
189
- // }
190
- // return query.setOptions({ maxTimeMS: 10000 })
191
- // .exec()
192
- // .then((docs) => docs.map((doc) => doc.toObject()));
193
- // }
194
151
  count(params) {
195
152
  return __awaiter(this, void 0, void 0, function* () {
196
153
  const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.290.1",
12
+ "@chevre/factory": "4.291.0",
13
13
  "@cinerino/sdk": "3.140.0-alpha.19",
14
14
  "@motionpicture/coa-service": "9.2.0",
15
15
  "@motionpicture/gmo-service": "5.2.0",
@@ -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": "20.4.0-alpha.25"
123
+ "version": "20.4.0-alpha.26"
124
124
  }