@chevre/domain 20.2.0-alpha.43 → 20.2.0-alpha.45

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.
@@ -42,6 +42,12 @@ export declare class MongoRepository {
42
42
  ok?: number;
43
43
  deletedCount?: number;
44
44
  } | null>;
45
+ /**
46
+ * 有効期限を一定期間過ぎた承認を削除する
47
+ */
48
+ deleteValidUntilPassedCertainPeriod(params: {
49
+ $lt: Date;
50
+ }): Promise<void>;
45
51
  /**
46
52
  * コードを保管する
47
53
  */
@@ -221,6 +221,20 @@ class MongoRepository {
221
221
  });
222
222
  });
223
223
  }
224
+ /**
225
+ * 有効期限を一定期間過ぎた承認を削除する
226
+ */
227
+ deleteValidUntilPassedCertainPeriod(params) {
228
+ return __awaiter(this, void 0, void 0, function* () {
229
+ yield this.authorizationModel.deleteMany({
230
+ validUntil: {
231
+ $exists: true,
232
+ $lt: params.$lt
233
+ }
234
+ })
235
+ .exec();
236
+ });
237
+ }
224
238
  /**
225
239
  * コードを保管する
226
240
  */
@@ -56,7 +56,7 @@ export declare class MongoRepository {
56
56
  /**
57
57
  * 発券する
58
58
  */
59
- checkIn(params: {
59
+ checkInIfNot(params: {
60
60
  id?: string | {
61
61
  $in?: string[];
62
62
  };
@@ -68,6 +68,9 @@ export declare class MongoRepository {
68
68
  */
69
69
  now: Date;
70
70
  }): Promise<void>;
71
+ /**
72
+ * 発券する
73
+ */
71
74
  /**
72
75
  * 入場する
73
76
  */
@@ -1027,7 +1027,7 @@ class MongoRepository {
1027
1027
  /**
1028
1028
  * 発券する
1029
1029
  */
1030
- checkIn(params) {
1030
+ checkInIfNot(params) {
1031
1031
  var _a, _b;
1032
1032
  return __awaiter(this, void 0, void 0, function* () {
1033
1033
  const conditions = [];
@@ -1055,6 +1055,8 @@ class MongoRepository {
1055
1055
  }
1056
1056
  // 無条件で実行されないように
1057
1057
  if (conditions.length > 0) {
1058
+ // false->trueのみ(2023-01-31~)
1059
+ conditions.push({ checkedIn: { $eq: false } });
1058
1060
  yield this.reservationModel.updateMany({ $and: conditions }, {
1059
1061
  checkedIn: true,
1060
1062
  modifiedTime: params.now
@@ -1063,6 +1065,50 @@ class MongoRepository {
1063
1065
  }
1064
1066
  });
1065
1067
  }
1068
+ /**
1069
+ * 発券する
1070
+ */
1071
+ // public async checkIn(params: {
1072
+ // id?: string | { $in?: string[] };
1073
+ // reservationNumber?: string | { $in?: string[] };
1074
+ // /**
1075
+ // * modifiedTime
1076
+ // */
1077
+ // now: Date;
1078
+ // }): Promise<void> {
1079
+ // const conditions: any[] = [];
1080
+ // if (typeof params.id === 'string') {
1081
+ // if (params.id.length > 0) {
1082
+ // conditions.push({ _id: { $eq: params.id } });
1083
+ // }
1084
+ // } else {
1085
+ // const idIn = params.id?.$in;
1086
+ // if (Array.isArray(idIn)) {
1087
+ // conditions.push({ _id: { $in: idIn } });
1088
+ // }
1089
+ // }
1090
+ // if (typeof params.reservationNumber === 'string') {
1091
+ // if (params.reservationNumber.length > 0) {
1092
+ // conditions.push({ reservationNumber: { $eq: params.reservationNumber } });
1093
+ // }
1094
+ // } else {
1095
+ // const reservationNumberIn = params.reservationNumber?.$in;
1096
+ // if (Array.isArray(reservationNumberIn)) {
1097
+ // conditions.push({ reservationNumber: { $in: reservationNumberIn } });
1098
+ // }
1099
+ // }
1100
+ // // 無条件で実行されないように
1101
+ // if (conditions.length > 0) {
1102
+ // await this.reservationModel.updateMany(
1103
+ // { $and: conditions },
1104
+ // {
1105
+ // checkedIn: true,
1106
+ // modifiedTime: params.now
1107
+ // }
1108
+ // )
1109
+ // .exec();
1110
+ // }
1111
+ // }
1066
1112
  /**
1067
1113
  * 入場する
1068
1114
  */
@@ -117,7 +117,8 @@ function addReservations(params) {
117
117
  event: { id: event.id },
118
118
  // 対応アプリケーション条件追加(2023-01-27~)
119
119
  store: { id: (_a = params.availableAtOrFrom) === null || _a === void 0 ? void 0 : _a.id },
120
- sort: false // ソート不要(2023-01-27~)
120
+ sort: false,
121
+ validateOfferRateLimit: true
121
122
  })(repos);
122
123
  ticketOffers = searchEventTicketOffersResult.ticketOffers;
123
124
  availableOffers = searchEventTicketOffersResult.unitPriceOffers;
@@ -219,7 +219,8 @@ function validateAcceptedOffers(params) {
219
219
  event: { id: params.event.id },
220
220
  // seller: params.seller,
221
221
  store: params.store,
222
- sort: false // ソート不要(2023-01-27~)
222
+ sort: false,
223
+ validateOfferRateLimit: true
223
224
  })(repos);
224
225
  // 利用可能なチケットオファーであれば受け入れる
225
226
  const acceptedOffers = (Array.isArray(acceptedOffersWithoutDetail))
@@ -75,6 +75,7 @@ declare function searchEventTicketOffers(params: {
75
75
  kbnEisyahousiki: string;
76
76
  };
77
77
  sort: boolean;
78
+ validateOfferRateLimit: boolean;
78
79
  }): ISearchEventTicketOffersOperation<{
79
80
  ticketOffers: factory.product.ITicketOffer[];
80
81
  unitPriceOffers: factory.unitPriceOffer.IUnitPriceOffer[];
@@ -101,10 +101,12 @@ function searchTransportationEventTicketOffers(params) {
101
101
  videoFormatTypes
102
102
  });
103
103
  });
104
- // レート制限を確認
105
- offers4event = yield Promise.all(offers4event.map((offer) => __awaiter(this, void 0, void 0, function* () {
106
- return checkAvailability({ event: screeningEvent, offer })(repos);
107
- })));
104
+ if (params.validateOfferRateLimit) {
105
+ // レート制限を確認
106
+ offers4event = yield Promise.all(offers4event.map((offer) => __awaiter(this, void 0, void 0, function* () {
107
+ return checkAvailability({ event: screeningEvent, offer })(repos);
108
+ })));
109
+ }
108
110
  // アドオン設定があれば、プロダクトオファーを検索
109
111
  for (const offer of offers4event) {
110
112
  const offerAddOn = [];
@@ -220,10 +222,12 @@ function searchScreeningEventTicketOffers(params) {
220
222
  videoFormatTypes
221
223
  });
222
224
  });
223
- // レート制限を確認
224
- offers4event = yield Promise.all(offers4event.map((offer) => __awaiter(this, void 0, void 0, function* () {
225
- return checkAvailability({ event: screeningEvent, offer })(repos);
226
- })));
225
+ if (params.validateOfferRateLimit) {
226
+ // レート制限を確認
227
+ offers4event = yield Promise.all(offers4event.map((offer) => __awaiter(this, void 0, void 0, function* () {
228
+ return checkAvailability({ event: screeningEvent, offer })(repos);
229
+ })));
230
+ }
227
231
  // アドオン設定があれば、プロダクトオファーを検索
228
232
  for (const offer of offers4event) {
229
233
  const offerAddOn = [];
@@ -390,7 +394,8 @@ function searchEventTicketOffers(params) {
390
394
  ids: params.ids,
391
395
  event,
392
396
  store: params.store,
393
- sort: params.sort
397
+ sort: params.sort,
398
+ validateOfferRateLimit: params.validateOfferRateLimit
394
399
  })(repos);
395
400
  offers = searchOffersResult.ticketOffers;
396
401
  unitPriceOffers = searchOffersResult.unitPriceOffers;
@@ -400,7 +405,8 @@ function searchEventTicketOffers(params) {
400
405
  ids: params.ids,
401
406
  event,
402
407
  store: params.store,
403
- sort: params.sort
408
+ sort: params.sort,
409
+ validateOfferRateLimit: params.validateOfferRateLimit
404
410
  })(repos);
405
411
  offers = searchOffersResult.ticketOffers;
406
412
  unitPriceOffers = searchOffersResult.unitPriceOffers;
@@ -17,11 +17,11 @@ function checkInRerservation(params) {
17
17
  // 発券処理(Array対応)
18
18
  let checkedInReservationIds;
19
19
  if (Array.isArray(params.object.ids) && params.object.ids.length > 0) {
20
- yield repos.reservation.checkIn({ id: { $in: params.object.ids }, now });
20
+ yield repos.reservation.checkInIfNot({ id: { $in: params.object.ids }, now });
21
21
  checkedInReservationIds = params.object.ids;
22
22
  }
23
23
  if (Array.isArray(params.object.reservationNumbers) && params.object.reservationNumbers.length > 0) {
24
- yield repos.reservation.checkIn({ reservationNumber: { $in: params.object.reservationNumbers }, now });
24
+ yield repos.reservation.checkInIfNot({ reservationNumber: { $in: params.object.reservationNumbers }, now });
25
25
  // 予約番号リストを予約IDリストに変換
26
26
  checkedInReservationIds = yield repos.reservation.searchIdsByReservationNumber({
27
27
  reservationNumber: { $in: params.object.reservationNumbers }
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.2.0-alpha.43"
123
+ "version": "20.2.0-alpha.45"
124
124
  }