@chevre/domain 20.0.0-alpha.4 → 20.0.0-alpha.5

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.
@@ -0,0 +1,42 @@
1
+ // tslint:disable:no-console
2
+ import * as mongoose from 'mongoose';
3
+ import * as redis from 'redis';
4
+
5
+ import { chevre } from '../../../lib/index';
6
+
7
+ // const PROJECT_ID = process.env.PROJECT_ID;
8
+
9
+ const client = redis.createClient({
10
+ host: process.env.REDIS_HOST,
11
+ port: Number(process.env.REDIS_PORT),
12
+ password: process.env.REDIS_KEY
13
+ });
14
+
15
+ async function main() {
16
+ await mongoose.connect(<string>process.env.MONGOLAB_URI);
17
+
18
+ const eventRepo = new chevre.repository.Event(mongoose.connection);
19
+ const priceSpecificationRepo = new chevre.repository.PriceSpecification(mongoose.connection);
20
+ const offerRepo = new chevre.repository.Offer(mongoose.connection);
21
+ const offerRateLimitRepo = new chevre.repository.rateLimit.Offer(client);
22
+ const productRepo = new chevre.repository.Product(mongoose.connection);
23
+
24
+ const offers = await chevre.service.offer.event.searchEventTicketOffers({
25
+ event: { id: 'al9ew43f5' },
26
+ onlyValid: true
27
+ // ...(typeof sellerId === 'string') ? { seller: { id: sellerId } } : undefined,
28
+ // ...(typeof availableAtId === 'string') ? { store: { id: availableAtId } } : undefined
29
+ })({
30
+ event: eventRepo,
31
+ offer: offerRepo,
32
+ offerRateLimit: offerRateLimitRepo,
33
+ priceSpecification: priceSpecificationRepo,
34
+ product: productRepo
35
+ });
36
+ // console.log(offers);
37
+ console.log(offers.length);
38
+ }
39
+
40
+ main()
41
+ .then(console.log)
42
+ .catch(console.error);
@@ -30,7 +30,7 @@ function createCompoundPriceSpec4event(params) {
30
30
  const unitPriceSpec = Object.assign(Object.assign({}, params.offer.priceSpecification), { name: params.offer.name });
31
31
  const videoFormatChargeSpecComponents = params.videoFormatChargeSpecifications.map(categoryCodeChargePriceSpec2component);
32
32
  const soundFormatChargeSpecComponents = params.soundFormatChargeSpecifications.map(categoryCodeChargePriceSpec2component);
33
- let mvtkPriceComponents = [];
33
+ const mvtkPriceComponents = [];
34
34
  // 複数決済カード対応(2022-07-11~)
35
35
  if (Array.isArray(unitPriceSpec.appliesToMovieTicket)) {
36
36
  unitPriceSpec.appliesToMovieTicket.forEach((appliesToMovieTicket) => {
@@ -42,7 +42,7 @@ function createCompoundPriceSpec4event(params) {
42
42
  && s.appliesToMovieTicket.serviceType === appliesToMovieTicket.serviceType
43
43
  && params.videoFormatTypes.includes(s.appliesToVideoFormat);
44
44
  });
45
- mvtkPriceComponents = mvtkSpecs4appliesToMovieTicket.map(mvtkChargePriceSpec2component);
45
+ mvtkPriceComponents.push(...mvtkSpecs4appliesToMovieTicket.map(mvtkChargePriceSpec2component));
46
46
  }
47
47
  else {
48
48
  const mvtkSpec4appliesToMovieTicket = params.movieTicketTypeChargeSpecs.find((s) => {
@@ -51,7 +51,7 @@ function createCompoundPriceSpec4event(params) {
51
51
  && s.appliesToMovieTicket.serviceType === appliesToMovieTicket.serviceType;
52
52
  });
53
53
  if (mvtkSpec4appliesToMovieTicket !== undefined) {
54
- mvtkPriceComponents = [mvtkChargePriceSpec2component(mvtkSpec4appliesToMovieTicket)];
54
+ mvtkPriceComponents.push(mvtkChargePriceSpec2component(mvtkSpec4appliesToMovieTicket));
55
55
  }
56
56
  }
57
57
  });
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": "20.0.0-alpha.4"
123
+ "version": "20.0.0-alpha.5"
124
124
  }