@chevre/domain 21.7.0-alpha.0 → 21.7.0-alpha.2

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.
@@ -1,37 +1,37 @@
1
1
  // tslint:disable:no-console
2
- // import * as redis from 'redis';
3
2
  import * as mongoose from 'mongoose';
4
3
 
5
4
  import { chevre } from '../../../lib/index';
6
5
 
7
6
  async function main() {
8
- await mongoose.connect(<string>process.env.MONGOLAB_URI);
7
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
9
8
 
10
9
  const offerRepo = new chevre.repository.Offer(mongoose.connection);
11
10
 
12
11
  const offers = await offerRepo.search({
13
- // limit: 1,
12
+ limit: 1,
14
13
  // page: 1,
15
14
  project: { id: { $eq: String(process.env.PROJECT_ID) } },
16
- additionalProperty: {
17
- $all: [
18
- {
19
- $elemMatch: {
20
- name: { $eq: 'theaterCode' },
21
- value: { $in: ['120'] }
22
- }
23
- },
24
- {
25
- $elemMatch: {
26
- name: { $eq: 'ticketCode' },
27
- value: { $in: ['10', '1001'] }
28
- }
29
- }
30
- ]
31
- }
15
+ availability: { $eq: chevre.factory.itemAvailability.InStock }
16
+ // additionalProperty: {
17
+ // $all: [
18
+ // {
19
+ // $elemMatch: {
20
+ // name: { $eq: 'theaterCode' },
21
+ // value: { $in: ['120'] }
22
+ // }
23
+ // },
24
+ // {
25
+ // $elemMatch: {
26
+ // name: { $eq: 'ticketCode' },
27
+ // value: { $in: ['10', '1001'] }
28
+ // }
29
+ // }
30
+ // ]
31
+ // }
32
32
  });
33
33
  console.log(offers.map((offer) => {
34
- return `${offer.additionalProperty?.find((p) => p.name === 'theaterCode')?.value} ${offer.additionalProperty?.find((p) => p.name === 'ticketCode')?.value}`;
34
+ return `${offer.project.id} ${offer.id} ${offer.identifier} ${offer.name.ja}`;
35
35
  }));
36
36
  console.log(offers.length);
37
37
  }
@@ -208,3 +208,4 @@ schema.index({ validThrough: 1, 'priceSpecification.price': 1 }, {
208
208
  validThrough: { $exists: true }
209
209
  }
210
210
  });
211
+ schema.index({ availability: 1, 'priceSpecification.price': 1 }, { name: 'searchByAvailability' });
@@ -36,7 +36,7 @@ class MongoRepository {
36
36
  }
37
37
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
38
38
  static CREATE_OFFER_MONGO_CONDITIONS(params) {
39
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32;
39
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33;
40
40
  // MongoDB検索条件
41
41
  const andConditions = [];
42
42
  const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
@@ -266,7 +266,11 @@ class MongoRepository {
266
266
  });
267
267
  }
268
268
  }
269
- const availableAtOrFromIdEq = (_23 = (_22 = params.availableAtOrFrom) === null || _22 === void 0 ? void 0 : _22.id) === null || _23 === void 0 ? void 0 : _23.$eq;
269
+ const availabilityEq = (_22 = params.availability) === null || _22 === void 0 ? void 0 : _22.$eq;
270
+ if (typeof availabilityEq === 'string') {
271
+ andConditions.push({ availability: { $eq: availabilityEq } });
272
+ }
273
+ const availableAtOrFromIdEq = (_24 = (_23 = params.availableAtOrFrom) === null || _23 === void 0 ? void 0 : _23.id) === null || _24 === void 0 ? void 0 : _24.$eq;
270
274
  if (typeof availableAtOrFromIdEq === 'string') {
271
275
  andConditions.push({
272
276
  'availableAtOrFrom.id': {
@@ -275,7 +279,7 @@ class MongoRepository {
275
279
  }
276
280
  });
277
281
  }
278
- const availableAtOrFromIdIn = (_25 = (_24 = params.availableAtOrFrom) === null || _24 === void 0 ? void 0 : _24.id) === null || _25 === void 0 ? void 0 : _25.$in;
282
+ const availableAtOrFromIdIn = (_26 = (_25 = params.availableAtOrFrom) === null || _25 === void 0 ? void 0 : _25.id) === null || _26 === void 0 ? void 0 : _26.$in;
279
283
  if (Array.isArray(availableAtOrFromIdIn)) {
280
284
  andConditions.push({
281
285
  'availableAtOrFrom.id': {
@@ -284,7 +288,7 @@ class MongoRepository {
284
288
  }
285
289
  });
286
290
  }
287
- const addOnItemOfferedIdEq = (_28 = (_27 = (_26 = params.addOn) === null || _26 === void 0 ? void 0 : _26.itemOffered) === null || _27 === void 0 ? void 0 : _27.id) === null || _28 === void 0 ? void 0 : _28.$eq;
291
+ const addOnItemOfferedIdEq = (_29 = (_28 = (_27 = params.addOn) === null || _27 === void 0 ? void 0 : _27.itemOffered) === null || _28 === void 0 ? void 0 : _28.id) === null || _29 === void 0 ? void 0 : _29.$eq;
288
292
  if (typeof addOnItemOfferedIdEq === 'string') {
289
293
  andConditions.push({
290
294
  'addOn.itemOffered.id': {
@@ -293,7 +297,7 @@ class MongoRepository {
293
297
  }
294
298
  });
295
299
  }
296
- const hasMerchantReturnPolicyIdEq = (_30 = (_29 = params.hasMerchantReturnPolicy) === null || _29 === void 0 ? void 0 : _29.id) === null || _30 === void 0 ? void 0 : _30.$eq;
300
+ const hasMerchantReturnPolicyIdEq = (_31 = (_30 = params.hasMerchantReturnPolicy) === null || _30 === void 0 ? void 0 : _30.id) === null || _31 === void 0 ? void 0 : _31.$eq;
297
301
  if (typeof hasMerchantReturnPolicyIdEq === 'string') {
298
302
  andConditions.push({
299
303
  'hasMerchantReturnPolicy.id': {
@@ -302,7 +306,7 @@ class MongoRepository {
302
306
  }
303
307
  });
304
308
  }
305
- const additionalPropertyAll = (_31 = params.additionalProperty) === null || _31 === void 0 ? void 0 : _31.$all;
309
+ const additionalPropertyAll = (_32 = params.additionalProperty) === null || _32 === void 0 ? void 0 : _32.$all;
306
310
  if (Array.isArray(additionalPropertyAll)) {
307
311
  andConditions.push({
308
312
  additionalProperty: {
@@ -311,7 +315,7 @@ class MongoRepository {
311
315
  }
312
316
  });
313
317
  }
314
- const additionalPropertyElemMatch = (_32 = params.additionalProperty) === null || _32 === void 0 ? void 0 : _32.$elemMatch;
318
+ const additionalPropertyElemMatch = (_33 = params.additionalProperty) === null || _33 === void 0 ? void 0 : _33.$elemMatch;
315
319
  if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
316
320
  andConditions.push({
317
321
  additionalProperty: {
@@ -25,7 +25,7 @@
25
25
  import { Connection } from 'mongoose';
26
26
  import * as factory from '../factory';
27
27
  export type IProduct = factory.product.IProduct | factory.service.paymentService.IService;
28
- export type IPaymentServiceByProvider = Pick<factory.service.paymentService.IService, 'name' | 'description' | 'typeOf' | 'id' | 'productID' | 'serviceType' | 'additionalProperty'> & {
28
+ export type IPaymentServiceByProvider = Pick<factory.service.paymentService.IService, 'name' | 'description' | 'typeOf' | 'id' | 'productID' | 'serviceType' | 'serviceOutput' | 'additionalProperty'> & {
29
29
  provider?: Pick<factory.service.paymentService.IProvider, 'credentials'>;
30
30
  };
31
31
  /**
@@ -286,6 +286,7 @@ class MongoRepository {
286
286
  name: '$name',
287
287
  // provider: [ [Object] ],
288
288
  additionalProperty: '$additionalProperty',
289
+ serviceOutput: '$serviceOutput',
289
290
  serviceType: '$serviceType',
290
291
  id: { $toString: '$_id' },
291
292
  // ↓セキュアな情報を隠蔽するように
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.325.0-alpha.0",
12
+ "@chevre/factory": "^4.325.0-alpha.1",
13
13
  "@cinerino/sdk": "3.163.0",
14
14
  "@motionpicture/coa-service": "9.2.0",
15
15
  "@motionpicture/gmo-service": "5.2.0",
@@ -117,5 +117,5 @@
117
117
  "postversion": "git push origin --tags",
118
118
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
119
119
  },
120
- "version": "21.7.0-alpha.0"
120
+ "version": "21.7.0-alpha.2"
121
121
  }