@chevre/domain 21.2.0-alpha.96 → 21.2.0-alpha.98

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.
@@ -69,7 +69,9 @@ async function main() {
69
69
  validateEvent: false,
70
70
  validateEventOfferPeriod: false,
71
71
  validateAppliesToMovieTicket: true,
72
- disablePendingReservations: true
72
+ disablePendingReservations: true,
73
+ stockHoldUntilDaysAfterEventEnd: 31,
74
+ useHoldStockByTransactionNumber: true
73
75
  })({
74
76
  stockHolder: itemAvailabilityRepo,
75
77
  event: eventRepo,
@@ -0,0 +1,30 @@
1
+ // tslint:disable:no-implicit-dependencies no-console
2
+ import { chevre } from '../../../lib/index';
3
+
4
+ import * as mongoose from 'mongoose';
5
+
6
+ const project = { id: String(process.env.PROJECT_ID) };
7
+
8
+ async function main() {
9
+ await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: true });
10
+
11
+ const assetTransactionRepo = new chevre.repository.AssetTransaction(mongoose.connection);
12
+ const assetTransactions = await assetTransactionRepo.search(
13
+ {
14
+ typeOf: chevre.factory.assetTransactionType.Reserve,
15
+ project: { id: { $eq: project.id } },
16
+ object: {
17
+ reservations: { reservedTicket: { ticketedSeat: { seatNumber: { $eq: 'A-03' } } } }
18
+ }
19
+ },
20
+ ['_id', 'transactionNumber'],
21
+ []
22
+ );
23
+ console.log('assetTransactions:', assetTransactions);
24
+ }
25
+
26
+ main()
27
+ .then(() => {
28
+ console.log('success!');
29
+ })
30
+ .catch(console.error);
@@ -23,7 +23,7 @@ class MongoRepository {
23
23
  }
24
24
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
25
25
  static CREATE_MONGO_CONDITIONS(params) {
26
- 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;
26
+ 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;
27
27
  const andConditions = [
28
28
  {
29
29
  typeOf: params.typeOf
@@ -246,9 +246,18 @@ class MongoRepository {
246
246
  }
247
247
  });
248
248
  }
249
+ const objectSubReservationSeatNumberEq = (_13 = (_12 = (_11 = (_10 = (_9 = params.object) === null || _9 === void 0 ? void 0 : _9.reservations) === null || _10 === void 0 ? void 0 : _10.reservedTicket) === null || _11 === void 0 ? void 0 : _11.ticketedSeat) === null || _12 === void 0 ? void 0 : _12.seatNumber) === null || _13 === void 0 ? void 0 : _13.$eq;
250
+ if (typeof objectSubReservationSeatNumberEq === 'string') {
251
+ andConditions.push({
252
+ 'object.subReservation.reservedTicket.ticketedSeat.seatNumber': {
253
+ $exists: true,
254
+ $eq: objectSubReservationSeatNumberEq
255
+ }
256
+ });
257
+ }
249
258
  break;
250
259
  case factory.assetTransactionType.RegisterService:
251
- const objectItemOfferedServiceOutputIdentifierEq = (_12 = (_11 = (_10 = (_9 = params.object) === null || _9 === void 0 ? void 0 : _9.itemOffered) === null || _10 === void 0 ? void 0 : _10.serviceOutput) === null || _11 === void 0 ? void 0 : _11.identifier) === null || _12 === void 0 ? void 0 : _12.$eq;
260
+ const objectItemOfferedServiceOutputIdentifierEq = (_17 = (_16 = (_15 = (_14 = params.object) === null || _14 === void 0 ? void 0 : _14.itemOffered) === null || _15 === void 0 ? void 0 : _15.serviceOutput) === null || _16 === void 0 ? void 0 : _16.identifier) === null || _17 === void 0 ? void 0 : _17.$eq;
252
261
  if (typeof objectItemOfferedServiceOutputIdentifierEq === 'string') {
253
262
  andConditions.push({
254
263
  'object.itemOffered.serviceOutput.identifier': {
@@ -257,7 +266,7 @@ class MongoRepository {
257
266
  }
258
267
  });
259
268
  }
260
- const objectItemOfferedServiceOutputIdentifierIn = (_16 = (_15 = (_14 = (_13 = params.object) === null || _13 === void 0 ? void 0 : _13.itemOffered) === null || _14 === void 0 ? void 0 : _14.serviceOutput) === null || _15 === void 0 ? void 0 : _15.identifier) === null || _16 === void 0 ? void 0 : _16.$in;
269
+ const objectItemOfferedServiceOutputIdentifierIn = (_21 = (_20 = (_19 = (_18 = params.object) === null || _18 === void 0 ? void 0 : _18.itemOffered) === null || _19 === void 0 ? void 0 : _19.serviceOutput) === null || _20 === void 0 ? void 0 : _20.identifier) === null || _21 === void 0 ? void 0 : _21.$in;
261
270
  if (Array.isArray(objectItemOfferedServiceOutputIdentifierIn)) {
262
271
  andConditions.push({
263
272
  'object.itemOffered.serviceOutput.identifier': {
@@ -117,6 +117,12 @@ schema.index({ 'object.subReservation.reservationFor.id': 1, startDate: -1 }, {
117
117
  'object.subReservation.reservationFor.id': { $exists: true }
118
118
  }
119
119
  });
120
+ schema.index({ 'object.subReservation.reservedTicket.ticketedSeat.seatNumber': 1, startDate: -1 }, {
121
+ name: 'searchByObjectSubReservationTicketedSeatSeatNumber',
122
+ partialFilterExpression: {
123
+ 'object.subReservation.reservedTicket.ticketedSeat.seatNumber': { $exists: true }
124
+ }
125
+ });
120
126
  schema.index({ 'object.reservationFor.id': 1, startDate: -1 }, {
121
127
  name: 'searchByObjectReservationForId',
122
128
  partialFilterExpression: {
@@ -61,10 +61,10 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
61
61
  project?: any;
62
62
  additionalProperty?: any;
63
63
  reservationFor?: any;
64
+ underName?: any;
64
65
  issuedThrough?: any;
65
66
  subReservation?: any;
66
67
  broker?: any;
67
- underName?: any;
68
68
  price?: any;
69
69
  priceCurrency?: string | undefined;
70
70
  reservedTicket?: any;
@@ -89,10 +89,10 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
89
89
  project?: any;
90
90
  additionalProperty?: any;
91
91
  reservationFor?: any;
92
+ underName?: any;
92
93
  issuedThrough?: any;
93
94
  subReservation?: any;
94
95
  broker?: any;
95
- underName?: any;
96
96
  price?: any;
97
97
  priceCurrency?: string | undefined;
98
98
  reservedTicket?: any;
@@ -117,10 +117,10 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
117
117
  project?: any;
118
118
  additionalProperty?: any;
119
119
  reservationFor?: any;
120
+ underName?: any;
120
121
  issuedThrough?: any;
121
122
  subReservation?: any;
122
123
  broker?: any;
123
- underName?: any;
124
124
  price?: any;
125
125
  priceCurrency?: string | undefined;
126
126
  reservedTicket?: any;
@@ -50,7 +50,7 @@ export declare function createReservationFor(params: factory.event.screeningEven
50
50
  export declare function createIssuedThrough(params: {
51
51
  reservationFor: factory.event.screeningEvent.IEvent | factory.event.event.IEvent;
52
52
  }): {
53
- issuedThrough: factory.reservation.busReservation.IIssuedThrough | factory.reservation.eventReservation.IIssuedThrough;
53
+ issuedThrough: factory.assetTransaction.reserve.IIssuedThrough;
54
54
  };
55
55
  export declare function createReservation(params: {
56
56
  project: {
@@ -60,7 +60,6 @@ export declare function createReservation(params: {
60
60
  id: string;
61
61
  reserveDate: Date;
62
62
  agent: factory.assetTransaction.reserve.IAgent;
63
- broker?: factory.reservation.IBroker<factory.reservationType.EventReservation>;
64
63
  reservationNumber: string;
65
64
  reservationFor: factory.event.screeningEvent.IEvent | factory.event.event.IEvent;
66
65
  reservedTicket: factory.reservation.ITicket;
@@ -394,7 +394,7 @@ function createIssuedThrough(params) {
394
394
  exports.createIssuedThrough = createIssuedThrough;
395
395
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
396
396
  function createReservation(params) {
397
- var _a, _b, _c, _d, _e;
397
+ var _a, _b;
398
398
  // 適用メンバーシップ確認
399
399
  validateEligibleMembershipType({
400
400
  availableOffer: params.availableOffer,
@@ -409,27 +409,36 @@ function createReservation(params) {
409
409
  }
410
410
  // priceを最適化
411
411
  const price4reservation = (0, price_1.createPrice)(params);
412
- const eventOffers = params.reservationFor.offers;
413
- // offersは必ず存在するはず
414
- if (eventOffers === undefined) {
415
- throw new factory.errors.NotFound('reservationFor.offers');
416
- }
417
- const serviceTypeOfIssuedThrough = (typeof ((_a = eventOffers.itemOffered.serviceType) === null || _a === void 0 ? void 0 : _a.codeValue) === 'string')
418
- ? {
419
- codeValue: eventOffers.itemOffered.serviceType.codeValue,
420
- inCodeSet: {
421
- typeOf: 'CategoryCodeSet',
422
- identifier: factory.categoryCode.CategorySetIdentifier.ServiceType
423
- },
424
- typeOf: 'CategoryCode'
425
- }
426
- : undefined;
427
- const availableChannel = eventOffers.itemOffered.availableChannel;
412
+ // const eventOffers = <factory.event.screeningEvent.IOffer | undefined>params.reservationFor.offers;
413
+ // // offersは必ず存在するはず
414
+ // if (eventOffers === undefined) {
415
+ // throw new factory.errors.NotFound('reservationFor.offers');
416
+ // }
417
+ // const serviceTypeOfIssuedThrough: factory.reservation.eventReservation.IServiceTypeOfIssuedThrough | undefined
418
+ // = (typeof eventOffers.itemOffered.serviceType?.codeValue === 'string')
419
+ // ? {
420
+ // codeValue: eventOffers.itemOffered.serviceType.codeValue,
421
+ // inCodeSet: {
422
+ // typeOf: 'CategoryCodeSet',
423
+ // identifier: factory.categoryCode.CategorySetIdentifier.ServiceType
424
+ // },
425
+ // typeOf: 'CategoryCode'
426
+ // }
427
+ // : undefined;
428
+ // const availableChannel: factory.reservation.IServiceChannel = eventOffers.itemOffered.availableChannel;
428
429
  if (params.reservationFor.typeOf === factory.eventType.ScreeningEvent) {
429
- const issuedThrough = Object.assign({ typeOf: factory.product.ProductType.EventService,
430
- // 興行IDを追加(2022-09-08~)
431
- id: eventOffers.itemOffered.id, availableChannel }, (typeof (serviceTypeOfIssuedThrough === null || serviceTypeOfIssuedThrough === void 0 ? void 0 : serviceTypeOfIssuedThrough.typeOf) === 'string') ? { serviceType: serviceTypeOfIssuedThrough } : undefined);
432
- return Object.assign(Object.assign(Object.assign(Object.assign({ project: params.project, typeOf: factory.reservationType.EventReservation, id: params.id, issuedThrough, additionalProperty: params.additionalProperty, bookingTime: params.reserveDate, modifiedTime: params.reserveDate, numSeats: 1, price: price4reservation, priceCurrency: factory.priceCurrency.JPY, reservationNumber: params.reservationNumber, reservationStatus: factory.reservationStatusType.ReservationPending, reservedTicket: params.reservedTicket,
430
+ // const issuedThrough: factory.reservation.eventReservation.IIssuedThrough = {
431
+ // typeOf: factory.product.ProductType.EventService,
432
+ // // 興行IDを追加(2022-09-08~)
433
+ // id: eventOffers.itemOffered.id,
434
+ // availableChannel,
435
+ // // issuedThrough.serviceTypeを連携
436
+ // ...(typeof serviceTypeOfIssuedThrough?.typeOf === 'string') ? { serviceType: serviceTypeOfIssuedThrough } : undefined
437
+ // };
438
+ return Object.assign(Object.assign(Object.assign({ project: params.project, typeOf: factory.reservationType.EventReservation, id: params.id,
439
+ // reservationPackage保管に移行(2023-06-06~)
440
+ // issuedThrough,
441
+ additionalProperty: params.additionalProperty, bookingTime: params.reserveDate, modifiedTime: params.reserveDate, numSeats: 1, price: price4reservation, priceCurrency: factory.priceCurrency.JPY, reservationNumber: params.reservationNumber, reservationStatus: factory.reservationStatusType.ReservationPending, reservedTicket: params.reservedTicket,
433
442
  // 最適化(2022-12-19~)
434
443
  underName: {
435
444
  typeOf: params.agent.typeOf,
@@ -445,15 +454,23 @@ function createReservation(params) {
445
454
  };
446
455
  })
447
456
  }
448
- : undefined), (typeof ((_b = params.broker) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string') ? { broker: params.broker } : undefined), (typeof ((_c = params.programMembershipUsed) === null || _c === void 0 ? void 0 : _c.identifier) === 'string')
457
+ : undefined), (typeof ((_a = params.programMembershipUsed) === null || _a === void 0 ? void 0 : _a.identifier) === 'string')
449
458
  ? { programMembershipUsed: params.programMembershipUsed }
450
459
  : undefined);
451
460
  }
452
461
  else {
453
- const issuedThrough = Object.assign({ typeOf: factory.product.ProductType.Transportation,
454
- // 興行IDを追加(2022-09-08~)
455
- id: eventOffers.itemOffered.id, availableChannel }, (typeof (serviceTypeOfIssuedThrough === null || serviceTypeOfIssuedThrough === void 0 ? void 0 : serviceTypeOfIssuedThrough.typeOf) === 'string') ? { serviceType: serviceTypeOfIssuedThrough } : undefined);
456
- return Object.assign(Object.assign(Object.assign(Object.assign({ project: params.project, typeOf: factory.reservationType.BusReservation, id: params.id, issuedThrough, additionalProperty: params.additionalProperty, bookingTime: params.reserveDate, modifiedTime: params.reserveDate, numSeats: 1, price: price4reservation, priceCurrency: factory.priceCurrency.JPY, reservationNumber: params.reservationNumber, reservationStatus: factory.reservationStatusType.ReservationPending, reservedTicket: params.reservedTicket, underName: {
462
+ // const issuedThrough: factory.reservation.busReservation.IIssuedThrough = {
463
+ // typeOf: factory.product.ProductType.Transportation,
464
+ // // 興行IDを追加(2022-09-08~)
465
+ // id: eventOffers.itemOffered.id,
466
+ // availableChannel,
467
+ // // issuedThrough.serviceTypeを連携
468
+ // ...(typeof serviceTypeOfIssuedThrough?.typeOf === 'string') ? { serviceType: serviceTypeOfIssuedThrough } : undefined
469
+ // };
470
+ return Object.assign(Object.assign(Object.assign({ project: params.project, typeOf: factory.reservationType.BusReservation, id: params.id,
471
+ // reservationPackage保管に移行(2023-06-06~)
472
+ // issuedThrough,
473
+ additionalProperty: params.additionalProperty, bookingTime: params.reserveDate, modifiedTime: params.reserveDate, numSeats: 1, price: price4reservation, priceCurrency: factory.priceCurrency.JPY, reservationNumber: params.reservationNumber, reservationStatus: factory.reservationStatusType.ReservationPending, reservedTicket: params.reservedTicket, underName: {
457
474
  typeOf: params.agent.typeOf,
458
475
  name: params.agent.name
459
476
  }, checkedIn: false, attended: false }, (typeof params.additionalTicketText === 'string') ? { additionalTicketText: params.additionalTicketText } : undefined), (Array.isArray(params.subReservation))
@@ -467,7 +484,7 @@ function createReservation(params) {
467
484
  };
468
485
  })
469
486
  }
470
- : undefined), (typeof ((_d = params.broker) === null || _d === void 0 ? void 0 : _d.typeOf) === 'string') ? { broker: params.broker } : undefined), (typeof ((_e = params.programMembershipUsed) === null || _e === void 0 ? void 0 : _e.identifier) === 'string')
487
+ : undefined), (typeof ((_b = params.programMembershipUsed) === null || _b === void 0 ? void 0 : _b.identifier) === 'string')
471
488
  ? { programMembershipUsed: params.programMembershipUsed }
472
489
  : undefined);
473
490
  }
@@ -102,6 +102,7 @@ export declare function start(params: IStartParams & {
102
102
  }): IStartOperation<{
103
103
  transaction: factory.assetTransaction.ITransaction<factory.assetTransactionType.Reserve>;
104
104
  objectSubReservations: IObjectSubReservation[];
105
+ issuedThrough: factory.assetTransaction.reserve.IIssuedThrough;
105
106
  }>;
106
107
  /**
107
108
  * 取引確定
@@ -27,7 +27,7 @@ const validateStartRequest_1 = require("./reserve/validateStartRequest");
27
27
  */
28
28
  function start(params) {
29
29
  return (repos) => __awaiter(this, void 0, void 0, function* () {
30
- var _a, _b, _c, _d, _e;
30
+ var _a, _b, _c, _d;
31
31
  const now = new Date();
32
32
  // 自動発行廃止(2022-05-17~)
33
33
  const reservationNumber = params.transactionNumber;
@@ -35,7 +35,8 @@ function start(params) {
35
35
  throw new factory.errors.ArgumentNull('transactionNumber');
36
36
  }
37
37
  // eventをfix
38
- if (typeof ((_a = params.object.reservationFor) === null || _a === void 0 ? void 0 : _a.id) !== 'string' || params.object.reservationFor.id.length === 0) {
38
+ const reservationForId = (_a = params.object.reservationFor) === null || _a === void 0 ? void 0 : _a.id;
39
+ if (typeof reservationForId !== 'string' || reservationForId.length === 0) {
39
40
  throw new factory.errors.ArgumentNull('object.reservationFor.id');
40
41
  }
41
42
  let event;
@@ -43,7 +44,7 @@ function start(params) {
43
44
  event = params.preSearchedEvent;
44
45
  }
45
46
  else {
46
- event = yield repos.event.findMinimizedIndividualEventById({ id: params.object.reservationFor.id });
47
+ event = yield repos.event.findMinimizedIndividualEventById({ id: reservationForId });
47
48
  }
48
49
  // validationを承認アクション開始前から移行(2023-01-27~)
49
50
  (0, validateStartRequest_1.validateStartRequest)({
@@ -64,22 +65,23 @@ function start(params) {
64
65
  throw error;
65
66
  }
66
67
  let objectSubReservations = [];
67
- // 指定があれば予約追加
68
- if (typeof ((_d = params.object.reservationFor) === null || _d === void 0 ? void 0 : _d.id) === 'string') {
69
- const addReservationsResult = yield addReservations({
70
- id: transaction.id,
71
- object: params.object,
72
- event,
73
- preSearchedTicketOffers: params.preSearchedTicketOffers,
74
- preSearchedUnitPriceOffers: params.preSearchedUnitPriceOffers,
75
- availableAtOrFrom: { id: (_e = params.availableAtOrFrom) === null || _e === void 0 ? void 0 : _e.id },
76
- validateAppliesToMovieTicket: params.validateAppliesToMovieTicket,
77
- stockHoldUntilDaysAfterEventEnd: params.stockHoldUntilDaysAfterEventEnd
78
- })(repos);
79
- transaction = addReservationsResult.transaction;
80
- objectSubReservations = addReservationsResult.objectSubReservations;
81
- }
82
- return { transaction, objectSubReservations };
68
+ const addReservationsResult = yield addReservations({
69
+ id: transaction.id,
70
+ object: params.object,
71
+ event,
72
+ preSearchedTicketOffers: params.preSearchedTicketOffers,
73
+ preSearchedUnitPriceOffers: params.preSearchedUnitPriceOffers,
74
+ availableAtOrFrom: { id: (_d = params.availableAtOrFrom) === null || _d === void 0 ? void 0 : _d.id },
75
+ validateAppliesToMovieTicket: params.validateAppliesToMovieTicket,
76
+ stockHoldUntilDaysAfterEventEnd: params.stockHoldUntilDaysAfterEventEnd
77
+ })(repos);
78
+ transaction = addReservationsResult.transaction;
79
+ objectSubReservations = addReservationsResult.objectSubReservations;
80
+ return {
81
+ transaction,
82
+ objectSubReservations,
83
+ issuedThrough: addReservationsResult.issuedThrough
84
+ };
83
85
  });
84
86
  }
85
87
  exports.start = start;
@@ -195,7 +197,7 @@ function addReservations(params) {
195
197
  }
196
198
  // ストックホルダー処理(stockHolderで残席数を集計しているので必要)
197
199
  yield onReservationsCreated({ event })(repos);
198
- return { transaction, objectSubReservations };
200
+ return { transaction, objectSubReservations, issuedThrough };
199
201
  });
200
202
  }
201
203
  /**
@@ -412,7 +414,7 @@ function createReservations4transactionObject(params) {
412
414
  id: reservationId,
413
415
  reserveDate: params.now,
414
416
  agent: params.transaction.agent,
415
- broker: params.transaction.object.broker,
417
+ // broker: params.transaction.object.broker,
416
418
  reservationNumber: reservationNumber,
417
419
  reservationFor: params.event,
418
420
  reservedTicket: reservedTicket,
@@ -169,6 +169,7 @@ function processStartReserve4chevre(params) {
169
169
  responseBody = startReserveTransactionResult.transaction;
170
170
  // 予約取引からオファー情報を生成する
171
171
  acceptedOffers4result = (0, factory_1.responseBody2acceptedOffers4result)({
172
+ issuedThrough: startReserveTransactionResult.issuedThrough,
172
173
  objectSubReservations: startReserveTransactionResult.objectSubReservations,
173
174
  responseBody: responseBody,
174
175
  event: event,
@@ -26,6 +26,7 @@ export declare function acceptedOffers2amount(params: {
26
26
  type IObjectSubReservation = factory.assetTransaction.reserve.IObjectSubReservation;
27
27
  type IResultAcceptedOffer = factory.action.authorize.offer.seatReservation.IResultAcceptedOffer;
28
28
  export declare function responseBody2acceptedOffers4result(params: {
29
+ issuedThrough: factory.assetTransaction.reserve.IIssuedThrough;
29
30
  objectSubReservations: IObjectSubReservation[];
30
31
  responseBody: factory.assetTransaction.reserve.ITransaction;
31
32
  event: IMinimizedIndividualEvent<factory.eventType.ScreeningEvent>;
@@ -157,7 +157,12 @@ function responseBody2acceptedOffers4result(params) {
157
157
  if (Array.isArray(params.objectSubReservations)) {
158
158
  acceptedOffers4result = params.objectSubReservations.map((itemOffered) => {
159
159
  var _a;
160
- const reservation = createReservation({ project: params.project, itemOffered, event: params.event });
160
+ const reservation = createReservation({
161
+ project: params.project,
162
+ itemOffered,
163
+ event: params.event,
164
+ issuedThrough: params.issuedThrough
165
+ });
161
166
  // appliesToMovieTicketがArrayでないケースは廃止(2022-09-12~)
162
167
  const priceSpecification = itemOffered.price;
163
168
  const priceComponent = priceSpecification.priceComponent.map((c) => {
@@ -244,7 +249,10 @@ function createReservation(params) {
244
249
  // 最適化(2022-05-31~)
245
250
  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
251
  };
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,
252
+ if (params.issuedThrough.typeOf !== factory.product.ProductType.EventService) {
253
+ throw new factory.errors.Argument('issuedThrough', `issuedThrough.typeOf must be ${factory.product.ProductType.EventService}`);
254
+ }
255
+ reservationItem = Object.assign({ project: itemOffered.project, typeOf: itemOffered.typeOf, additionalProperty: itemOffered.additionalProperty, additionalTicketText: itemOffered.additionalTicketText, id: itemOffered.id, issuedThrough: params.issuedThrough, reservationNumber: itemOffered.reservationNumber, reservationFor,
248
256
  reservedTicket }, (typeof ((_a = itemOffered.programMembershipUsed) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string')
249
257
  ? { programMembershipUsed: itemOffered.programMembershipUsed }
250
258
  : undefined);
@@ -269,7 +277,10 @@ function createReservation(params) {
269
277
  busNumber: tripByEvent.busNumber,
270
278
  identifier: tripByEvent.identifier
271
279
  };
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,
280
+ if (params.issuedThrough.typeOf !== factory.product.ProductType.Transportation) {
281
+ throw new factory.errors.Argument('issuedThrough', `issuedThrough.typeOf must be ${factory.product.ProductType.Transportation}`);
282
+ }
283
+ reservationItem = Object.assign({ project: itemOffered.project, typeOf: itemOffered.typeOf, additionalProperty: itemOffered.additionalProperty, additionalTicketText: itemOffered.additionalTicketText, id: itemOffered.id, issuedThrough: params.issuedThrough, reservationNumber: itemOffered.reservationNumber, reservationFor,
273
284
  reservedTicket }, (typeof ((_d = itemOffered.programMembershipUsed) === null || _d === void 0 ? void 0 : _d.typeOf) === 'string')
274
285
  ? { programMembershipUsed: itemOffered.programMembershipUsed }
275
286
  : undefined);
package/package.json CHANGED
@@ -9,8 +9,8 @@
9
9
  }
10
10
  ],
11
11
  "dependencies": {
12
- "@chevre/factory": "4.313.0-alpha.25",
13
- "@cinerino/sdk": "3.157.0-alpha.6",
12
+ "@chevre/factory": "4.313.0-alpha.27",
13
+ "@cinerino/sdk": "3.157.0-alpha.8",
14
14
  "@motionpicture/coa-service": "9.2.0",
15
15
  "@motionpicture/gmo-service": "5.2.0",
16
16
  "@sendgrid/mail": "6.4.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.2.0-alpha.96"
120
+ "version": "21.2.0-alpha.98"
121
121
  }
@@ -1,26 +0,0 @@
1
- // tslint:disable:no-implicit-dependencies no-console
2
- import { chevre } from '../../../lib/index';
3
-
4
- import * as mongoose from 'mongoose';
5
-
6
- // const project = { id: String(process.env.PROJECT_ID) };
7
-
8
- async function main() {
9
- await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
10
-
11
- const actionRepo = new chevre.repository.Action(mongoose.connection);
12
- const actions = await actionRepo.search(
13
- {
14
- object: { reservationNumber: { $eq: 'xxx' } }
15
- },
16
- ['_id'],
17
- []
18
- );
19
- console.log('actions:', actions);
20
- }
21
-
22
- main()
23
- .then(() => {
24
- console.log('success!');
25
- })
26
- .catch(console.error);