@chevre/domain 20.2.0-alpha.6 → 20.2.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.
@@ -0,0 +1 @@
1
+ dst
@@ -0,0 +1 @@
1
+ *.csv
@@ -26,5 +26,5 @@ export declare function aggregateScreeningEvent(params: {
26
26
  id: string;
27
27
  }): IAggregateScreeningEventOperation<void>;
28
28
  export declare function aggregateByEvent(params: {
29
- event: factory.event.screeningEvent.IEvent;
29
+ event: factory.event.screeningEvent.IEvent | factory.event.event.IEvent;
30
30
  }): IAggregateScreeningEventOperation<void>;
@@ -120,9 +120,16 @@ exports.aggregateByEvent = aggregateByEvent;
120
120
  */
121
121
  function findLocation(params) {
122
122
  return (repos) => __awaiter(this, void 0, void 0, function* () {
123
+ var _a;
123
124
  let movieTheater;
124
125
  try {
125
- movieTheater = yield repos.place.findById({ id: params.event.superEvent.location.id });
126
+ if (params.event.typeOf === factory.eventType.ScreeningEvent) {
127
+ movieTheater = yield repos.place.findById({ id: params.event.superEvent.location.id });
128
+ }
129
+ else {
130
+ const movieTheaterId = String((_a = params.event.offers) === null || _a === void 0 ? void 0 : _a.itemOffered.availableChannel.serviceLocation.containedInPlace.id);
131
+ movieTheater = yield repos.place.findById({ id: movieTheaterId });
132
+ }
126
133
  }
127
134
  catch (error) {
128
135
  let throwsError = true;
@@ -223,6 +230,8 @@ function aggregateReservationByOffer(params) {
223
230
  let reservationCount4offer;
224
231
  let attendeeCount4offer;
225
232
  let checkInCount4offer;
233
+ // tslint:disable-next-line:no-suspicious-comment
234
+ // TODO EventReservationを旅客対応
226
235
  reservationCount4offer = yield repos.reservation.count({
227
236
  typeOf: factory.reservationType.EventReservation,
228
237
  reservationFor: { ids: [params.event.id] },
@@ -22,6 +22,7 @@ function createOwnershipInfosFromOrder(params) {
22
22
  const ownedBy = createOwnedby(params);
23
23
  const itemOfferedType = itemOffered.typeOf;
24
24
  switch (itemOfferedType) {
25
+ case factory.reservationType.BusReservation:
25
26
  case factory.reservationType.EventReservation:
26
27
  ownershipInfo = (0, factory_2.createReservationOwnershipInfo)({
27
28
  project: params.order.project,
@@ -211,7 +211,7 @@ exports.responseBody2acceptedOffers4result = responseBody2acceptedOffers4result;
211
211
  */
212
212
  // tslint:disable-next-line:max-func-body-length
213
213
  function createReservation(params) {
214
- var _a;
214
+ var _a, _b, _c, _d;
215
215
  const itemOffered = params.itemOffered;
216
216
  const event = params.event;
217
217
  let reservationItem;
@@ -243,16 +243,36 @@ function createReservation(params) {
243
243
  .toDate(),
244
244
  // 最適化(2022-05-31~)
245
245
  superEvent: Object.assign(Object.assign({ typeOf: event.superEvent.typeOf, id: event.superEvent.id, kanaName: event.superEvent.kanaName, location: event.superEvent.location, name: event.superEvent.name, soundFormat: event.superEvent.soundFormat, videoFormat: event.superEvent.videoFormat, workPerformed }, (typeof event.superEvent.duration === 'string') ? { duration: event.superEvent.duration } : undefined), (event.superEvent.headline !== undefined) ? { headline: event.superEvent.headline } : undefined)
246
- // 廃止(superEvent.workPerformedへ完全移行)
247
- // workPerformed: {},
248
246
  };
249
- reservationItem = Object.assign({ project: itemOffered.project, typeOf: itemOffered.typeOf, additionalProperty: itemOffered.additionalProperty, additionalTicketText: itemOffered.additionalTicketText, id: itemOffered.id, issuedThrough: itemOffered.issuedThrough, reservationNumber: itemOffered.reservationNumber, reservationFor: reservationFor, reservedTicket: reservedTicket }, (typeof ((_a = itemOffered.programMembershipUsed) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
247
+ reservationItem = Object.assign({ project: itemOffered.project, typeOf: itemOffered.typeOf, additionalProperty: itemOffered.additionalProperty, additionalTicketText: itemOffered.additionalTicketText, id: itemOffered.id, issuedThrough: itemOffered.issuedThrough, reservationNumber: itemOffered.reservationNumber, reservationFor,
248
+ reservedTicket }, (typeof ((_a = itemOffered.programMembershipUsed) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
250
249
  ? { programMembershipUsed: itemOffered.programMembershipUsed }
251
250
  : undefined);
252
251
  }
253
252
  else if (itemOffered.typeOf === factory.reservationType.BusReservation
254
253
  && event.typeOf === factory.eventType.Event) {
255
- throw new factory.errors.NotImplemented(`${itemOffered.typeOf} not impelemented`);
254
+ const tripByEvent = (_c = (_b = event.offers) === null || _b === void 0 ? void 0 : _b.itemOffered.serviceOutput) === null || _c === void 0 ? void 0 : _c.reservationFor;
255
+ if (typeof (tripByEvent === null || tripByEvent === void 0 ? void 0 : tripByEvent.typeOf) !== 'string') {
256
+ throw new factory.errors.NotFound('event.offers.itemOffered.serviceOutput.reservationFor');
257
+ }
258
+ const reservationFor = {
259
+ typeOf: tripByEvent.typeOf,
260
+ id: event.id,
261
+ arrivalBusStop: tripByEvent.arrivalBusStop,
262
+ departureBusStop: tripByEvent.departureBusStop,
263
+ name: event.name,
264
+ departureTime: moment(tripByEvent.departureTime)
265
+ .toDate(),
266
+ arrivalTime: moment(tripByEvent.arrivalTime)
267
+ .toDate(),
268
+ busName: tripByEvent.busName,
269
+ busNumber: tripByEvent.busNumber,
270
+ identifier: tripByEvent.identifier
271
+ };
272
+ reservationItem = Object.assign({ project: itemOffered.project, typeOf: itemOffered.typeOf, additionalProperty: itemOffered.additionalProperty, additionalTicketText: itemOffered.additionalTicketText, id: itemOffered.id, issuedThrough: itemOffered.issuedThrough, reservationNumber: itemOffered.reservationNumber, reservationFor,
273
+ reservedTicket }, (typeof ((_d = itemOffered.programMembershipUsed) === null || _d === void 0 ? void 0 : _d.typeOf) === 'string')
274
+ ? { programMembershipUsed: itemOffered.programMembershipUsed }
275
+ : undefined);
256
276
  }
257
277
  else {
258
278
  throw new factory.errors.Argument('itemOffered');
@@ -35,37 +35,52 @@ function createReservationAcceptedOffers(params) {
35
35
  }
36
36
  exports.createReservationAcceptedOffers = createReservationAcceptedOffers;
37
37
  function reservationOffers2orderedItem(params) {
38
- var _a, _b, _c, _d;
38
+ var _a, _b, _c, _d, _e;
39
39
  const reservationFor = params.reservationFor;
40
40
  const issuedThrough = params.issuedThrough;
41
- if (reservationFor.typeOf !== factory.eventType.ScreeningEvent) {
42
- throw new factory.errors.NotImplemented(`reservationFor.typeOf '${reservationFor.typeOf}' not implemented`);
43
- }
44
- const reservationFor4orderedItem = {
45
- location: {
46
- branchCode: (_a = reservationFor.location) === null || _a === void 0 ? void 0 : _a.branchCode,
47
- name: (_b = reservationFor.location) === null || _b === void 0 ? void 0 : _b.name,
41
+ if (reservationFor.typeOf === factory.eventType.ScreeningEvent
42
+ && issuedThrough.typeOf === factory.product.ProductType.EventService) {
43
+ const reservationFor4orderedItem = {
44
+ location: {
45
+ branchCode: (_a = reservationFor.location) === null || _a === void 0 ? void 0 : _a.branchCode,
46
+ name: (_b = reservationFor.location) === null || _b === void 0 ? void 0 : _b.name,
47
+ // 不要なので廃止(2022-12-19~)
48
+ // project: reservationFor.location?.project,
49
+ typeOf: (_c = reservationFor.location) === null || _c === void 0 ? void 0 : _c.typeOf
50
+ },
48
51
  // 不要なので廃止(2022-12-19~)
49
- // project: reservationFor.location?.project,
50
- typeOf: (_c = reservationFor.location) === null || _c === void 0 ? void 0 : _c.typeOf
51
- },
52
- // 不要なので廃止(2022-12-19~)
53
- // project: reservationFor.project,
54
- typeOf: reservationFor.typeOf,
55
- id: reservationFor.id,
56
- name: reservationFor.name,
57
- startDate: reservationFor.startDate,
58
- endDate: reservationFor.endDate
59
- };
60
- if (issuedThrough.typeOf !== factory.product.ProductType.EventService) {
61
- throw new factory.errors.NotImplemented(`issuedThrough.typeOf '${issuedThrough.typeOf}' not implemented`);
52
+ // project: reservationFor.project,
53
+ typeOf: reservationFor.typeOf,
54
+ id: reservationFor.id,
55
+ name: reservationFor.name,
56
+ startDate: reservationFor.startDate,
57
+ endDate: reservationFor.endDate
58
+ };
59
+ return Object.assign(Object.assign({ typeOf: issuedThrough.typeOf }, (typeof ((_d = issuedThrough.serviceType) === null || _d === void 0 ? void 0 : _d.typeOf) === 'string')
60
+ ? { serviceType: issuedThrough.serviceType }
61
+ : undefined), { serviceOutput: {
62
+ typeOf: factory.reservationType.EventReservation,
63
+ reservationFor: reservationFor4orderedItem
64
+ } });
65
+ }
66
+ else if (reservationFor.typeOf === factory.tripType.BusTrip
67
+ && issuedThrough.typeOf === factory.product.ProductType.Transportation) {
68
+ const reservationFor4orderedItem = {
69
+ typeOf: reservationFor.typeOf,
70
+ id: reservationFor.id,
71
+ departureTime: reservationFor.departureTime,
72
+ arrivalTime: reservationFor.arrivalTime
73
+ };
74
+ return Object.assign(Object.assign({ typeOf: issuedThrough.typeOf }, (typeof ((_e = issuedThrough.serviceType) === null || _e === void 0 ? void 0 : _e.typeOf) === 'string')
75
+ ? { serviceType: issuedThrough.serviceType }
76
+ : undefined), { serviceOutput: {
77
+ typeOf: factory.reservationType.ReservationPackage,
78
+ reservationFor: reservationFor4orderedItem
79
+ } });
80
+ }
81
+ else {
82
+ throw new factory.errors.ServiceUnavailable('unexpected params on reservationOffers2orderedItem');
62
83
  }
63
- return Object.assign(Object.assign({ typeOf: issuedThrough.typeOf }, (typeof ((_d = issuedThrough.serviceType) === null || _d === void 0 ? void 0 : _d.typeOf) === 'string')
64
- ? { serviceType: issuedThrough.serviceType }
65
- : undefined), { serviceOutput: {
66
- typeOf: factory.reservationType.EventReservation,
67
- reservationFor: reservationFor4orderedItem
68
- } });
69
84
  }
70
85
  function createProductItems(params) {
71
86
  const acceptedOffers = [];
package/package.json CHANGED
@@ -9,8 +9,8 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.281.0-alpha.2",
13
- "@cinerino/sdk": "3.135.0-alpha.6",
12
+ "@chevre/factory": "4.281.0-alpha.3",
13
+ "@cinerino/sdk": "3.135.0-alpha.7",
14
14
  "@motionpicture/coa-service": "9.2.0",
15
15
  "@motionpicture/gmo-service": "5.2.0",
16
16
  "@sendgrid/mail": "6.4.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.2.0-alpha.6"
123
+ "version": "20.2.0-alpha.8"
124
124
  }