@chevre/domain 21.29.0-alpha.16 → 21.29.0-alpha.18

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.
@@ -34,7 +34,7 @@ async function main() {
34
34
  object: 1
35
35
  }
36
36
  );
37
- console.log('orders found');
37
+ console.log('transactions found');
38
38
 
39
39
  let i = 0;
40
40
  let updateCount = 0;
@@ -182,6 +182,12 @@ export declare class MongoRepository {
182
182
  id: string;
183
183
  };
184
184
  }): Promise<void>;
185
+ /**
186
+ * 終了日時を一定期間過ぎたアクションを削除する
187
+ */
188
+ deleteEndDatePassedCertainPeriod(params: {
189
+ $lt: Date;
190
+ }): Promise<void>;
185
191
  /**
186
192
  * 特定の取引を更新する(汎用)
187
193
  */
@@ -24,7 +24,7 @@ class MongoRepository {
24
24
  }
25
25
  // tslint:disable-next-line:cyclomatic-complexity max-func-body-length
26
26
  static CREATE_MONGO_CONDITIONS(params) {
27
- 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;
27
+ 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;
28
28
  const andConditions = [
29
29
  {
30
30
  typeOf: params.typeOf
@@ -172,13 +172,25 @@ class MongoRepository {
172
172
  }
173
173
  break;
174
174
  case factory.assetTransactionType.CancelReservation:
175
+ const objectReservationNumberIn4cancelReservation = (_0 = (_z = params.object) === null || _z === void 0 ? void 0 : _z.reservationNumber) === null || _0 === void 0 ? void 0 : _0.$in;
176
+ if (Array.isArray(objectReservationNumberIn4cancelReservation)) {
177
+ andConditions.push({
178
+ 'object.reservationNumber': { $exists: true, $in: objectReservationNumberIn4cancelReservation }
179
+ });
180
+ }
181
+ const objectReservationNumberEq4cancelReservation = (_2 = (_1 = params.object) === null || _1 === void 0 ? void 0 : _1.reservationNumber) === null || _2 === void 0 ? void 0 : _2.$eq;
182
+ if (typeof objectReservationNumberEq4cancelReservation === 'string') {
183
+ andConditions.push({
184
+ 'object.reservationNumber': { $exists: true, $eq: objectReservationNumberEq4cancelReservation }
185
+ });
186
+ }
175
187
  break;
176
188
  case factory.assetTransactionType.Reserve:
177
- const objectProviderIdEq = (_1 = (_0 = (_z = params.object) === null || _z === void 0 ? void 0 : _z.provider) === null || _0 === void 0 ? void 0 : _0.id) === null || _1 === void 0 ? void 0 : _1.$eq;
189
+ const objectProviderIdEq = (_5 = (_4 = (_3 = params.object) === null || _3 === void 0 ? void 0 : _3.provider) === null || _4 === void 0 ? void 0 : _4.id) === null || _5 === void 0 ? void 0 : _5.$eq;
178
190
  if (typeof objectProviderIdEq === 'string') {
179
191
  andConditions.push({ 'object.provider.id': { $exists: true, $eq: objectProviderIdEq } });
180
192
  }
181
- const objectReservationForIdEq = (_4 = (_3 = (_2 = params.object) === null || _2 === void 0 ? void 0 : _2.reservationFor) === null || _3 === void 0 ? void 0 : _3.id) === null || _4 === void 0 ? void 0 : _4.$eq;
193
+ const objectReservationForIdEq = (_8 = (_7 = (_6 = params.object) === null || _6 === void 0 ? void 0 : _6.reservationFor) === null || _7 === void 0 ? void 0 : _7.id) === null || _8 === void 0 ? void 0 : _8.$eq;
182
194
  if (typeof objectReservationForIdEq === 'string') {
183
195
  andConditions.push({
184
196
  'object.reservationFor.id': {
@@ -187,25 +199,19 @@ class MongoRepository {
187
199
  }
188
200
  });
189
201
  }
190
- const objectReservationNumberIn = (_6 = (_5 = params.object) === null || _5 === void 0 ? void 0 : _5.reservationNumber) === null || _6 === void 0 ? void 0 : _6.$in;
202
+ const objectReservationNumberIn = (_10 = (_9 = params.object) === null || _9 === void 0 ? void 0 : _9.reservationNumber) === null || _10 === void 0 ? void 0 : _10.$in;
191
203
  if (Array.isArray(objectReservationNumberIn)) {
192
204
  andConditions.push({
193
- 'object.reservationNumber': {
194
- $exists: true,
195
- $in: objectReservationNumberIn
196
- }
205
+ 'object.reservationNumber': { $exists: true, $in: objectReservationNumberIn }
197
206
  });
198
207
  }
199
- const objectReservationNumberEq = (_8 = (_7 = params.object) === null || _7 === void 0 ? void 0 : _7.reservationNumber) === null || _8 === void 0 ? void 0 : _8.$eq;
208
+ const objectReservationNumberEq = (_12 = (_11 = params.object) === null || _11 === void 0 ? void 0 : _11.reservationNumber) === null || _12 === void 0 ? void 0 : _12.$eq;
200
209
  if (typeof objectReservationNumberEq === 'string') {
201
210
  andConditions.push({
202
- 'object.reservationNumber': {
203
- $exists: true,
204
- $eq: objectReservationNumberEq
205
- }
211
+ 'object.reservationNumber': { $exists: true, $eq: objectReservationNumberEq }
206
212
  });
207
213
  }
208
- const objectSubReservationIdIn = (_11 = (_10 = (_9 = params.object) === null || _9 === void 0 ? void 0 : _9.reservations) === null || _10 === void 0 ? void 0 : _10.id) === null || _11 === void 0 ? void 0 : _11.$in;
214
+ const objectSubReservationIdIn = (_15 = (_14 = (_13 = params.object) === null || _13 === void 0 ? void 0 : _13.reservations) === null || _14 === void 0 ? void 0 : _14.id) === null || _15 === void 0 ? void 0 : _15.$in;
209
215
  if (Array.isArray(objectSubReservationIdIn)) {
210
216
  andConditions.push({
211
217
  'object.subReservation.id': {
@@ -240,7 +246,7 @@ class MongoRepository {
240
246
  }
241
247
  }
242
248
  }
243
- const objectUnderNameIdEq = (_14 = (_13 = (_12 = params.object) === null || _12 === void 0 ? void 0 : _12.underName) === null || _13 === void 0 ? void 0 : _13.id) === null || _14 === void 0 ? void 0 : _14.$eq;
249
+ const objectUnderNameIdEq = (_18 = (_17 = (_16 = params.object) === null || _16 === void 0 ? void 0 : _16.underName) === null || _17 === void 0 ? void 0 : _17.id) === null || _18 === void 0 ? void 0 : _18.$eq;
244
250
  if (typeof objectUnderNameIdEq === 'string') {
245
251
  andConditions.push({
246
252
  'object.underName.id': {
@@ -249,7 +255,7 @@ class MongoRepository {
249
255
  }
250
256
  });
251
257
  }
252
- const objectSubReservationSeatNumberEq = (_19 = (_18 = (_17 = (_16 = (_15 = params.object) === null || _15 === void 0 ? void 0 : _15.reservations) === null || _16 === void 0 ? void 0 : _16.reservedTicket) === null || _17 === void 0 ? void 0 : _17.ticketedSeat) === null || _18 === void 0 ? void 0 : _18.seatNumber) === null || _19 === void 0 ? void 0 : _19.$eq;
258
+ const objectSubReservationSeatNumberEq = (_23 = (_22 = (_21 = (_20 = (_19 = params.object) === null || _19 === void 0 ? void 0 : _19.reservations) === null || _20 === void 0 ? void 0 : _20.reservedTicket) === null || _21 === void 0 ? void 0 : _21.ticketedSeat) === null || _22 === void 0 ? void 0 : _22.seatNumber) === null || _23 === void 0 ? void 0 : _23.$eq;
253
259
  if (typeof objectSubReservationSeatNumberEq === 'string') {
254
260
  andConditions.push({
255
261
  'object.subReservation.reservedTicket.ticketedSeat.seatNumber': {
@@ -260,7 +266,7 @@ class MongoRepository {
260
266
  }
261
267
  break;
262
268
  case factory.assetTransactionType.RegisterService:
263
- const objectItemOfferedServiceOutputIdentifierEq = (_23 = (_22 = (_21 = (_20 = params.object) === null || _20 === void 0 ? void 0 : _20.itemOffered) === null || _21 === void 0 ? void 0 : _21.serviceOutput) === null || _22 === void 0 ? void 0 : _22.identifier) === null || _23 === void 0 ? void 0 : _23.$eq;
269
+ const objectItemOfferedServiceOutputIdentifierEq = (_27 = (_26 = (_25 = (_24 = params.object) === null || _24 === void 0 ? void 0 : _24.itemOffered) === null || _25 === void 0 ? void 0 : _25.serviceOutput) === null || _26 === void 0 ? void 0 : _26.identifier) === null || _27 === void 0 ? void 0 : _27.$eq;
264
270
  if (typeof objectItemOfferedServiceOutputIdentifierEq === 'string') {
265
271
  andConditions.push({
266
272
  'object.itemOffered.serviceOutput.identifier': {
@@ -269,7 +275,7 @@ class MongoRepository {
269
275
  }
270
276
  });
271
277
  }
272
- const objectItemOfferedServiceOutputIdentifierIn = (_27 = (_26 = (_25 = (_24 = params.object) === null || _24 === void 0 ? void 0 : _24.itemOffered) === null || _25 === void 0 ? void 0 : _25.serviceOutput) === null || _26 === void 0 ? void 0 : _26.identifier) === null || _27 === void 0 ? void 0 : _27.$in;
278
+ const objectItemOfferedServiceOutputIdentifierIn = (_31 = (_30 = (_29 = (_28 = params.object) === null || _28 === void 0 ? void 0 : _28.itemOffered) === null || _29 === void 0 ? void 0 : _29.serviceOutput) === null || _30 === void 0 ? void 0 : _30.identifier) === null || _31 === void 0 ? void 0 : _31.$in;
273
279
  if (Array.isArray(objectItemOfferedServiceOutputIdentifierIn)) {
274
280
  andConditions.push({
275
281
  'object.itemOffered.serviceOutput.identifier': {
@@ -687,6 +693,21 @@ class MongoRepository {
687
693
  .exec();
688
694
  });
689
695
  }
696
+ /**
697
+ * 終了日時を一定期間過ぎたアクションを削除する
698
+ */
699
+ deleteEndDatePassedCertainPeriod(params) {
700
+ return __awaiter(this, void 0, void 0, function* () {
701
+ yield this.transactionModel.deleteMany({
702
+ // 終了日時を一定期間過ぎたもの
703
+ endDate: {
704
+ $exists: true,
705
+ $lt: params.$lt
706
+ }
707
+ })
708
+ .exec();
709
+ });
710
+ }
690
711
  /**
691
712
  * 特定の取引を更新する(汎用)
692
713
  */
@@ -109,7 +109,7 @@ class MongoRepository {
109
109
  let doc;
110
110
  if (typeof params.id === 'string') {
111
111
  // 上書き禁止属性を除外
112
- const _a = params.$set, { id, project, typeOf, offers } = _a, setFields = __rest(_a, ["id", "project", "typeOf", "offers"]);
112
+ const _a = params.$set, { id, project, typeOf } = _a, setFields = __rest(_a, ["id", "project", "typeOf"]);
113
113
  doc = yield this.productModelModel.findOneAndUpdate({ _id: { $eq: params.id } }, {
114
114
  $set: setFields
115
115
  // $unset: params.$unset
@@ -9,6 +9,7 @@ function createStartParams(params) {
9
9
  var _a;
10
10
  let reserveTransactionAsObject;
11
11
  let eventReservationsAsObject;
12
+ let reservationNumber;
12
13
  if (typeof ((_a = params.transaction) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') {
13
14
  const reservationFor = params.transaction.object.reservationFor;
14
15
  if (typeof (reservationFor === null || reservationFor === void 0 ? void 0 : reservationFor.typeOf) !== 'string') {
@@ -25,6 +26,7 @@ function createStartParams(params) {
25
26
  }
26
27
  }
27
28
  };
29
+ reservationNumber = params.transaction.transactionNumber;
28
30
  }
29
31
  if (Array.isArray(params.reservations)) {
30
32
  eventReservationsAsObject = params.reservations.map((r) => {
@@ -36,8 +38,13 @@ function createStartParams(params) {
36
38
  typeOf: r.typeOf
37
39
  };
38
40
  });
41
+ reservationNumber = eventReservationsAsObject[0].reservationNumber;
39
42
  }
40
- const cancelReservationObject = Object.assign(Object.assign({ clientUser: params.paramsWithoutDetail.object.clientUser }, (typeof (reserveTransactionAsObject === null || reserveTransactionAsObject === void 0 ? void 0 : reserveTransactionAsObject.typeOf) === 'string') ? { transaction: reserveTransactionAsObject } : undefined), (Array.isArray(eventReservationsAsObject)) ? { reservations: eventReservationsAsObject } : undefined);
43
+ if (typeof reservationNumber !== 'string') {
44
+ throw new factory.errors.Argument('object', 'reservationNumber must be specified');
45
+ }
46
+ const cancelReservationObject = Object.assign(Object.assign(Object.assign({ clientUser: params.paramsWithoutDetail.object.clientUser }, (typeof (reserveTransactionAsObject === null || reserveTransactionAsObject === void 0 ? void 0 : reserveTransactionAsObject.typeOf) === 'string') ? { transaction: reserveTransactionAsObject } : undefined), (Array.isArray(eventReservationsAsObject)) ? { reservations: eventReservationsAsObject } : undefined), { reservationNumber, typeOf: factory.reservationType.ReservationPackage // 拡張(2024-04-18~)
47
+ });
41
48
  return {
42
49
  project: { id: params.project.id, typeOf: params.project.typeOf },
43
50
  transactionNumber: params.transactionNumber,
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  ],
11
11
  "dependencies": {
12
12
  "@aws-sdk/credential-providers": "3.433.0",
13
- "@chevre/factory": "4.367.0-alpha.9",
13
+ "@chevre/factory": "4.367.0-alpha.10",
14
14
  "@cinerino/sdk": "5.17.1",
15
15
  "@motionpicture/coa-service": "9.4.0",
16
16
  "@motionpicture/gmo-service": "5.3.0",
@@ -110,5 +110,5 @@
110
110
  "postversion": "git push origin --tags",
111
111
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
112
112
  },
113
- "version": "21.29.0-alpha.16"
113
+ "version": "21.29.0-alpha.18"
114
114
  }