@chevre/domain 22.6.0-alpha.37 → 22.6.0-alpha.39

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.
@@ -8,6 +8,7 @@ export type IUseReservationAction = factory.action.consume.use.reservation.IActi
8
8
  */
9
9
  export declare function onReservationUsed(attendedReservation: IAttendedReservation, action: factory.action.consume.use.reservation.IAttributes & {
10
10
  id: string;
11
+ startDate: Date;
11
12
  }): (repos: {
12
13
  task: TaskRepo;
13
14
  }, settings: Settings) => Promise<void>;
@@ -28,27 +28,22 @@ function onReservationUsed(attendedReservation, action) {
28
28
  const informReservations = settings.onReservationStatusChanged.informReservation;
29
29
  const informTaskRunsAt = now;
30
30
  // support notification.reservation.IUseAction(2024-11-11~)
31
+ let action4inform;
31
32
  let reservation4inform;
32
- if (settings.useNotificationUseAction) {
33
- reservation4inform = Object.assign({ typeOf: action.typeOf, project: action.project, id: action.id, object: {
34
- typeOf: attendedReservation.typeOf,
35
- id: attendedReservation.id,
36
- modifiedTime: attendedReservation.modifiedTime,
37
- reservedTicket: { dateUsed: attendedReservation.reservedTicket.dateUsed }
38
- } }, (typeof ((_a = action.location) === null || _a === void 0 ? void 0 : _a.identifier) === 'string')
39
- ? { location: { identifier: action.location.identifier } }
40
- : undefined);
41
- }
42
- else {
43
- reservation4inform = {
44
- typeOf: attendedReservation.typeOf,
45
- project: attendedReservation.project,
46
- id: attendedReservation.id,
47
- attended: true,
33
+ // let reservation4inform: factory.notification.reservation.IReservation4informUsed
34
+ // | factory.notification.reservation.IUseAction;
35
+ const useForTheFirstTime = attendedReservation.reservedTicket.dateUsed !== undefined
36
+ && moment(action.startDate)
37
+ .isSame(moment(attendedReservation.reservedTicket.dateUsed), 'milliseconds');
38
+ reservation4inform = Object.assign({ typeOf: attendedReservation.typeOf, id: attendedReservation.id }, (useForTheFirstTime)
39
+ ? {
48
40
  modifiedTime: attendedReservation.modifiedTime,
49
41
  reservedTicket: { dateUsed: attendedReservation.reservedTicket.dateUsed }
50
- };
51
- }
42
+ }
43
+ : undefined);
44
+ action4inform = Object.assign({ typeOf: action.typeOf, project: action.project, id: action.id, object: reservation4inform }, (typeof ((_a = action.location) === null || _a === void 0 ? void 0 : _a.identifier) === 'string')
45
+ ? { location: { identifier: action.location.identifier } }
46
+ : undefined);
52
47
  const modifiedTimeInMilliseconds = moment(attendedReservation.modifiedTime)
53
48
  .valueOf();
54
49
  const informIdentifier = `${attendedReservation.typeOf}:${attendedReservation.id}:attended:${modifiedTimeInMilliseconds}`;
@@ -58,7 +53,7 @@ function onReservationUsed(attendedReservation, action) {
58
53
  var _a;
59
54
  const informUrl = String((_a = informReservation.recipient) === null || _a === void 0 ? void 0 : _a.url);
60
55
  const informReservationAttributes = {
61
- object: reservation4inform,
56
+ object: action4inform,
62
57
  recipient: {
63
58
  id: '',
64
59
  name: informUrl,
@@ -72,7 +72,7 @@ function useReservation(params) {
72
72
  throw error;
73
73
  }
74
74
  yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: {} });
75
- yield (0, onReservationUsed_1.onReservationUsed)(attendedReservation, Object.assign(Object.assign({}, actionAttributes), { id: action.id }))({ task: repos.task }, settings);
75
+ yield (0, onReservationUsed_1.onReservationUsed)(attendedReservation, Object.assign(Object.assign({}, actionAttributes), { id: action.id, startDate: action.startDate }))({ task: repos.task }, settings);
76
76
  });
77
77
  }
78
78
  exports.useReservation = useReservation;
@@ -87,7 +87,6 @@ interface IOptions {
87
87
  movieticketReserve: ISurfrockSettings;
88
88
  useAssetTransactionSyncProcessing: boolean;
89
89
  useExperimentalFeature: boolean;
90
- useNotificationUseAction?: boolean;
91
90
  notification: IWebhookSettings;
92
91
  }
93
92
  /**
@@ -133,7 +132,6 @@ declare class Settings {
133
132
  readonly movieticketReserve: ISurfrockSettings;
134
133
  readonly useAssetTransactionSyncProcessing: boolean;
135
134
  readonly useExperimentalFeature: boolean;
136
- readonly useNotificationUseAction: boolean;
137
135
  /**
138
136
  * 通知設定
139
137
  */
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "AggregationSettings", { enumerable: true, get: f
8
8
  */
9
9
  class Settings {
10
10
  constructor(options) {
11
- const { onEventChanged, onOrderStatusChanged, onResourceUpdated, onReservationStatusChanged, userPoolIdOld, userPoolIdNew, abortedTasksWithoutReport, numTryConfirmReserveTransaction, transaction, defaultSenderEmail, deliverOrderLimit, coa, gmo, movieticketReserve, useAssetTransactionSyncProcessing, useExperimentalFeature, useNotificationUseAction, notification } = options;
11
+ const { onEventChanged, onOrderStatusChanged, onResourceUpdated, onReservationStatusChanged, userPoolIdOld, userPoolIdNew, abortedTasksWithoutReport, numTryConfirmReserveTransaction, transaction, defaultSenderEmail, deliverOrderLimit, coa, gmo, movieticketReserve, useAssetTransactionSyncProcessing, useExperimentalFeature, notification } = options;
12
12
  this.onEventChanged = onEventChanged;
13
13
  this.onOrderStatusChanged = onOrderStatusChanged;
14
14
  this.onResourceUpdated = onResourceUpdated;
@@ -25,7 +25,6 @@ class Settings {
25
25
  this.movieticketReserve = movieticketReserve;
26
26
  this.useAssetTransactionSyncProcessing = useAssetTransactionSyncProcessing;
27
27
  this.useExperimentalFeature = useExperimentalFeature;
28
- this.useNotificationUseAction = useNotificationUseAction === true;
29
28
  this.notification = notification;
30
29
  }
31
30
  }
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "dependencies": {
12
12
  "@aws-sdk/client-cognito-identity-provider": "3.600.0",
13
13
  "@aws-sdk/credential-providers": "3.600.0",
14
- "@chevre/factory": "4.389.0",
14
+ "@chevre/factory": "4.390.0-alpha.0",
15
15
  "@cinerino/sdk": "10.17.0",
16
16
  "@motionpicture/coa-service": "9.6.0-alpha.0",
17
17
  "@motionpicture/gmo-service": "5.3.0",
@@ -108,5 +108,5 @@
108
108
  "postversion": "git push origin --tags",
109
109
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
110
110
  },
111
- "version": "22.6.0-alpha.37"
111
+ "version": "22.6.0-alpha.39"
112
112
  }