@chevre/domain 21.2.0-alpha.33 → 21.2.0-alpha.35
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.
- package/example/src/chevre/aggregation/aggregateSystem.ts +58 -31
- package/example/src/chevre/task/executeTasks.ts +26 -0
- package/lib/chevre/repo/assetTransaction.js +13 -20
- package/lib/chevre/repo/task.d.ts +11 -0
- package/lib/chevre/repo/task.js +29 -0
- package/lib/chevre/repo/transaction.js +10 -19
- package/lib/chevre/service/aggregation/system.d.ts +67 -22
- package/lib/chevre/service/aggregation/system.js +101 -89
- package/lib/chevre/service/offer.js +1 -1
- package/lib/chevre/service/payment/any/onPaid.js +1 -1
- package/lib/chevre/service/payment/any/onRefund.js +1 -1
- package/lib/chevre/service/product.js +1 -5
- package/lib/chevre/service/reserve/cancelReservation.js +0 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +0 -3
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +18 -17
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -31
- package/lib/chevre/service/task/confirmRegisterServiceTransaction.js +1 -1
- package/lib/chevre/service/task/returnPayTransaction.js +1 -5
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +16 -15
- package/package.json +1 -1
|
@@ -6,8 +6,10 @@ import { chevre } from '../../../../lib/index';
|
|
|
6
6
|
const EXCLUDED_PROJECT_ID = process.env.EXCLUDED_PROJECT_ID;
|
|
7
7
|
const AGGREGATE_DAYS = Number(process.env.AGGREGATE_DAYS);
|
|
8
8
|
const AGGREGATE_CLIENT_IDS = (typeof process.env.AGGREGATE_CLIENT_IDS === 'string') ? process.env.AGGREGATE_CLIENT_IDS.split(' ') : [];
|
|
9
|
+
const ONE_DAY_IN_HOURS = 24;
|
|
9
10
|
console.log('AGGREGATE_CLIENT_IDS:', AGGREGATE_CLIENT_IDS);
|
|
10
11
|
|
|
12
|
+
// tslint:disable-next-line:max-func-body-length
|
|
11
13
|
async function main() {
|
|
12
14
|
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
13
15
|
|
|
@@ -18,94 +20,119 @@ async function main() {
|
|
|
18
20
|
const actionRepo = new chevre.repository.Action(mongoose.connection);
|
|
19
21
|
const taskRepo = new chevre.repository.Task(mongoose.connection);
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
let result: { aggregationCount: number; aggregateDuration: string };
|
|
24
|
+
|
|
25
|
+
result = await chevre.service.aggregation.system.aggregatePlaceOrder({
|
|
26
|
+
aggregateDurationUnit: 'hours',
|
|
27
|
+
aggregationCount: AGGREGATE_DAYS * ONE_DAY_IN_HOURS,
|
|
28
|
+
excludedProjectId: EXCLUDED_PROJECT_ID,
|
|
29
|
+
clientIds: AGGREGATE_CLIENT_IDS
|
|
24
30
|
})({
|
|
25
31
|
agregation: aggregationRepo,
|
|
26
|
-
|
|
32
|
+
transaction: transactionRepo
|
|
27
33
|
});
|
|
34
|
+
console.log('aggregatePlaceOrder processed.', result);
|
|
35
|
+
// return;
|
|
28
36
|
|
|
29
|
-
await chevre.service.aggregation.system.
|
|
30
|
-
|
|
37
|
+
result = await chevre.service.aggregation.system.aggregateTask({
|
|
38
|
+
aggregateDurationUnit: 'hours',
|
|
39
|
+
aggregationCount: AGGREGATE_DAYS * ONE_DAY_IN_HOURS,
|
|
31
40
|
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
32
41
|
})({
|
|
33
42
|
agregation: aggregationRepo,
|
|
34
|
-
|
|
43
|
+
task: taskRepo
|
|
35
44
|
});
|
|
45
|
+
console.log('aggregateTask processed.', result);
|
|
36
46
|
|
|
37
|
-
await chevre.service.aggregation.system.
|
|
38
|
-
|
|
47
|
+
result = await chevre.service.aggregation.system.aggregatePayMovieTicketAction({
|
|
48
|
+
aggregateDurationUnit: 'hours',
|
|
49
|
+
aggregationCount: AGGREGATE_DAYS * ONE_DAY_IN_HOURS,
|
|
39
50
|
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
40
51
|
})({
|
|
41
52
|
agregation: aggregationRepo,
|
|
42
|
-
|
|
53
|
+
action: actionRepo
|
|
43
54
|
});
|
|
55
|
+
console.log('aggregatePayMovieTicketAction processed.', result);
|
|
44
56
|
|
|
45
|
-
await chevre.service.aggregation.system.
|
|
46
|
-
|
|
57
|
+
result = await chevre.service.aggregation.system.aggregatePayTransaction({
|
|
58
|
+
aggregateDurationUnit: 'hours',
|
|
59
|
+
aggregationCount: AGGREGATE_DAYS * ONE_DAY_IN_HOURS,
|
|
47
60
|
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
48
61
|
})({
|
|
49
62
|
agregation: aggregationRepo,
|
|
50
|
-
|
|
63
|
+
assetTransaction: assetTransactionRepo
|
|
51
64
|
});
|
|
65
|
+
console.log('aggregatePayTransaction processed.', result);
|
|
52
66
|
|
|
53
|
-
await chevre.service.aggregation.system.
|
|
54
|
-
|
|
67
|
+
result = await chevre.service.aggregation.system.aggregateEvent({
|
|
68
|
+
aggregateDurationUnit: 'hours',
|
|
69
|
+
aggregationCount: AGGREGATE_DAYS * ONE_DAY_IN_HOURS,
|
|
55
70
|
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
56
71
|
})({
|
|
57
72
|
agregation: aggregationRepo,
|
|
58
|
-
|
|
73
|
+
event: eventRepo
|
|
59
74
|
});
|
|
75
|
+
console.log('aggregateEvent processed.', result);
|
|
60
76
|
|
|
61
|
-
await chevre.service.aggregation.system.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
77
|
+
result = await chevre.service.aggregation.system.aggregateReserveTransaction({
|
|
78
|
+
aggregateDurationUnit: 'hours',
|
|
79
|
+
aggregationCount: AGGREGATE_DAYS * ONE_DAY_IN_HOURS,
|
|
80
|
+
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
65
81
|
})({
|
|
66
82
|
agregation: aggregationRepo,
|
|
67
|
-
|
|
83
|
+
assetTransaction: assetTransactionRepo
|
|
68
84
|
});
|
|
85
|
+
console.log('aggregateReserveTransaction processed.', result);
|
|
69
86
|
|
|
70
|
-
await chevre.service.aggregation.system.aggregateAuthorizeOrderAction({
|
|
71
|
-
|
|
87
|
+
result = await chevre.service.aggregation.system.aggregateAuthorizeOrderAction({
|
|
88
|
+
aggregateDurationUnit: 'hours',
|
|
89
|
+
aggregationCount: AGGREGATE_DAYS * ONE_DAY_IN_HOURS,
|
|
72
90
|
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
73
91
|
})({
|
|
74
92
|
agregation: aggregationRepo,
|
|
75
93
|
action: actionRepo
|
|
76
94
|
});
|
|
95
|
+
console.log('aggregateAuthorizeOrderAction processed.', result);
|
|
77
96
|
|
|
78
|
-
await chevre.service.aggregation.system.aggregateAuthorizeEventServiceOfferAction({
|
|
79
|
-
|
|
97
|
+
result = await chevre.service.aggregation.system.aggregateAuthorizeEventServiceOfferAction({
|
|
98
|
+
aggregateDurationUnit: 'hours',
|
|
99
|
+
aggregationCount: AGGREGATE_DAYS * ONE_DAY_IN_HOURS,
|
|
80
100
|
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
81
101
|
})({
|
|
82
102
|
agregation: aggregationRepo,
|
|
83
103
|
action: actionRepo
|
|
84
104
|
});
|
|
105
|
+
console.log('aggregateAuthorizeEventServiceOfferAction processed.', result);
|
|
85
106
|
|
|
86
|
-
await chevre.service.aggregation.system.aggregateAuthorizePaymentAction({
|
|
87
|
-
|
|
107
|
+
result = await chevre.service.aggregation.system.aggregateAuthorizePaymentAction({
|
|
108
|
+
aggregateDurationUnit: 'hours',
|
|
109
|
+
aggregationCount: AGGREGATE_DAYS * ONE_DAY_IN_HOURS,
|
|
88
110
|
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
89
111
|
})({
|
|
90
112
|
agregation: aggregationRepo,
|
|
91
113
|
action: actionRepo
|
|
92
114
|
});
|
|
115
|
+
console.log('aggregateAuthorizePaymentAction processed.', result);
|
|
93
116
|
|
|
94
|
-
await chevre.service.aggregation.system.aggregateUseAction({
|
|
95
|
-
|
|
117
|
+
result = await chevre.service.aggregation.system.aggregateUseAction({
|
|
118
|
+
aggregateDurationUnit: 'hours',
|
|
119
|
+
aggregationCount: AGGREGATE_DAYS * ONE_DAY_IN_HOURS,
|
|
96
120
|
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
97
121
|
})({
|
|
98
122
|
agregation: aggregationRepo,
|
|
99
123
|
action: actionRepo
|
|
100
124
|
});
|
|
125
|
+
console.log('aggregateUseAction processed.', result);
|
|
101
126
|
|
|
102
|
-
await chevre.service.aggregation.system.aggregateCheckMovieTicketAction({
|
|
103
|
-
|
|
127
|
+
result = await chevre.service.aggregation.system.aggregateCheckMovieTicketAction({
|
|
128
|
+
aggregateDurationUnit: 'hours',
|
|
129
|
+
aggregationCount: AGGREGATE_DAYS * ONE_DAY_IN_HOURS,
|
|
104
130
|
excludedProjectId: EXCLUDED_PROJECT_ID
|
|
105
131
|
})({
|
|
106
132
|
agregation: aggregationRepo,
|
|
107
133
|
action: actionRepo
|
|
108
134
|
});
|
|
135
|
+
console.log('aggregateCheckMovieTicketAction processed.', result);
|
|
109
136
|
}
|
|
110
137
|
|
|
111
138
|
main()
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../../lib/index';
|
|
5
|
+
|
|
6
|
+
async function main() {
|
|
7
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
8
|
+
|
|
9
|
+
const taskRepo = new chevre.repository.Task(mongoose.connection);
|
|
10
|
+
const result = await taskRepo.executeTasks({
|
|
11
|
+
now: new Date(),
|
|
12
|
+
delayInSeconds: 60,
|
|
13
|
+
limit: 1,
|
|
14
|
+
name: {
|
|
15
|
+
$nin: [
|
|
16
|
+
chevre.factory.taskName.ImportEventCapacitiesFromCOA,
|
|
17
|
+
chevre.factory.taskName.ImportEventsFromCOA
|
|
18
|
+
]
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
console.log(result);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
main()
|
|
25
|
+
.then(console.log)
|
|
26
|
+
.catch(console.error);
|
|
@@ -248,7 +248,9 @@ class MongoRepository {
|
|
|
248
248
|
*/
|
|
249
249
|
start(params) {
|
|
250
250
|
return __awaiter(this, void 0, void 0, function* () {
|
|
251
|
-
return this.transactionModel.create(Object.assign(Object.assign({}, params), { typeOf: params.typeOf, status: factory.transactionStatusType.InProgress, startDate: new Date(), endDate: undefined,
|
|
251
|
+
return this.transactionModel.create(Object.assign(Object.assign({}, params), { typeOf: params.typeOf, status: factory.transactionStatusType.InProgress, startDate: new Date(), endDate: undefined, tasksExportAction: {
|
|
252
|
+
actionStatus: factory.actionStatusType.PotentialActionStatus
|
|
253
|
+
}, tasksExportationStatus: factory.transactionTasksExportationStatus.Unexported }))
|
|
252
254
|
.then((doc) => doc.toObject());
|
|
253
255
|
});
|
|
254
256
|
}
|
|
@@ -349,7 +351,9 @@ class MongoRepository {
|
|
|
349
351
|
*/
|
|
350
352
|
startAndConfirm(params) {
|
|
351
353
|
return __awaiter(this, void 0, void 0, function* () {
|
|
352
|
-
return this.transactionModel.create(Object.assign(Object.assign({ _id: params.id, typeOf: params.typeOf
|
|
354
|
+
return this.transactionModel.create(Object.assign(Object.assign({}, params), { _id: params.id, typeOf: params.typeOf, startDate: new Date(), status: factory.transactionStatusType.Confirmed, tasksExportAction: {
|
|
355
|
+
actionStatus: factory.actionStatusType.PotentialActionStatus
|
|
356
|
+
}, tasksExportationStatus: factory.transactionTasksExportationStatus.Unexported, endDate: new Date(), result: params.result, potentialActions: params.potentialActions }))
|
|
353
357
|
.then((doc) => doc.toObject());
|
|
354
358
|
});
|
|
355
359
|
}
|
|
@@ -367,10 +371,9 @@ class MongoRepository {
|
|
|
367
371
|
}
|
|
368
372
|
const typeOfIn = (_a = params.typeOf) === null || _a === void 0 ? void 0 : _a.$in;
|
|
369
373
|
return this.transactionModel.findOneAndUpdate(Object.assign(Object.assign(Object.assign(Object.assign({}, (typeof ((_b = params.project) === null || _b === void 0 ? void 0 : _b.id) === 'string') ? { 'project.id': { $eq: params.project.id } } : undefined), (Array.isArray(typeOfIn)) ? { typeOf: { $in: typeOfIn } } : undefined), { status: { $eq: params.status }, tasksExportationStatus: { $eq: factory.transactionTasksExportationStatus.Unexported } }), (typeof params.id === 'string') ? { _id: { $eq: params.id } } : undefined), {
|
|
370
|
-
tasksExportAction:
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
},
|
|
374
|
+
'tasksExportAction.actionStatus': factory.actionStatusType.ActiveActionStatus,
|
|
375
|
+
'tasksExportAction.agent': { name: params.tasksExportAction.agent.name },
|
|
376
|
+
'tasksExportAction.startDate': new Date(),
|
|
374
377
|
tasksExportationStatus: factory.transactionTasksExportationStatus.Exporting
|
|
375
378
|
}, { new: true })
|
|
376
379
|
.select({
|
|
@@ -410,6 +413,9 @@ class MongoRepository {
|
|
|
410
413
|
_id: { $eq: reexportingTransaction.id },
|
|
411
414
|
tasksExportationStatus: { $eq: factory.transactionTasksExportationStatus.Exporting }
|
|
412
415
|
}, {
|
|
416
|
+
tasksExportAction: {
|
|
417
|
+
actionStatus: factory.actionStatusType.PotentialActionStatus
|
|
418
|
+
},
|
|
413
419
|
tasksExportationStatus: factory.transactionTasksExportationStatus.Unexported
|
|
414
420
|
})
|
|
415
421
|
.exec();
|
|
@@ -420,20 +426,6 @@ class MongoRepository {
|
|
|
420
426
|
});
|
|
421
427
|
}
|
|
422
428
|
}
|
|
423
|
-
// await this.transactionModel.updateMany(
|
|
424
|
-
// {
|
|
425
|
-
// tasksExportationStatus: { $eq: factory.transactionTasksExportationStatus.Exporting },
|
|
426
|
-
// updatedAt: {
|
|
427
|
-
// $lt: moment()
|
|
428
|
-
// .add(-params.intervalInMinutes, 'minutes')
|
|
429
|
-
// .toDate()
|
|
430
|
-
// }
|
|
431
|
-
// },
|
|
432
|
-
// {
|
|
433
|
-
// tasksExportationStatus: factory.transactionTasksExportationStatus.Unexported
|
|
434
|
-
// }
|
|
435
|
-
// )
|
|
436
|
-
// .exec();
|
|
437
429
|
});
|
|
438
430
|
}
|
|
439
431
|
/**
|
|
@@ -489,6 +481,7 @@ class MongoRepository {
|
|
|
489
481
|
}, {
|
|
490
482
|
tasksExportationStatus: factory.transactionTasksExportationStatus.Exported,
|
|
491
483
|
tasksExportedAt: endDate,
|
|
484
|
+
'tasksExportAction.actionStatus': factory.actionStatusType.CompletedActionStatus,
|
|
492
485
|
'tasksExportAction.endDate': endDate
|
|
493
486
|
})
|
|
494
487
|
.exec();
|
|
@@ -43,6 +43,17 @@ export declare class MongoRepository {
|
|
|
43
43
|
name: string;
|
|
44
44
|
};
|
|
45
45
|
}): Promise<factory.task.ITask<T> | null>;
|
|
46
|
+
/**
|
|
47
|
+
* 一定期間遅延したタスクを実行する
|
|
48
|
+
*/
|
|
49
|
+
executeTasks(params: {
|
|
50
|
+
now: Date;
|
|
51
|
+
delayInSeconds: number;
|
|
52
|
+
limit: number;
|
|
53
|
+
name: {
|
|
54
|
+
$nin?: factory.taskName[];
|
|
55
|
+
};
|
|
56
|
+
}): Promise<Pick<import("@chevre/factory/lib/task").ITask | import("@chevre/factory/lib/task/deleteAssetTransaction").ITask | import("@chevre/factory/lib/task/deleteOrder").ITask | import("@chevre/factory/lib/task/deleteTransaction").ITask | import("@chevre/factory/lib/task/sendEmailMessage").ITask | import("@chevre/factory/lib/task/triggerWebhook").ITask | import("@chevre/factory/lib/task/confirmMoneyTransfer").ITask | import("@chevre/factory/lib/task/confirmRegisterService").ITask | import("@chevre/factory/lib/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/task/deleteMember").ITask | import("@chevre/factory/lib/task/givePointAward").ITask | import("@chevre/factory/lib/task/orderProgramMembership").ITask | import("@chevre/factory/lib/task/placeOrder").ITask | import("@chevre/factory/lib/task/returnOrder").ITask | import("@chevre/factory/lib/task/returnMoneyTransfer").ITask | import("@chevre/factory/lib/task/returnPayTransaction").ITask | import("@chevre/factory/lib/task/returnPointAward").ITask | import("@chevre/factory/lib/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/task/sendOrder").ITask | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").ITask | import("@chevre/factory/lib/task/voidPayTransaction").ITask | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/voidReserveTransaction").ITask, "name" | "id" | "status">[]>;
|
|
46
57
|
retry(params: {
|
|
47
58
|
intervalInMinutes: number;
|
|
48
59
|
}): Promise<void>;
|
package/lib/chevre/repo/task.js
CHANGED
|
@@ -246,6 +246,35 @@ class MongoRepository {
|
|
|
246
246
|
return doc.toObject();
|
|
247
247
|
});
|
|
248
248
|
}
|
|
249
|
+
/**
|
|
250
|
+
* 一定期間遅延したタスクを実行する
|
|
251
|
+
*/
|
|
252
|
+
executeTasks(params) {
|
|
253
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
254
|
+
const runsAtLt = moment(params.now)
|
|
255
|
+
.add(-params.delayInSeconds, 'seconds')
|
|
256
|
+
.toDate();
|
|
257
|
+
const delayedTasks = yield this.taskModel.find(Object.assign({ status: { $eq: factory.taskStatus.Ready }, runsAt: { $lt: runsAtLt } }, (Array.isArray(params.name.$nin)) ? { name: { $nin: params.name.$nin } } : undefined))
|
|
258
|
+
.select({
|
|
259
|
+
_id: 1,
|
|
260
|
+
name: 1,
|
|
261
|
+
status: 1
|
|
262
|
+
})
|
|
263
|
+
.limit(params.limit)
|
|
264
|
+
.setOptions({ maxTimeMS: 10000 })
|
|
265
|
+
.exec();
|
|
266
|
+
if (delayedTasks.length > 0) {
|
|
267
|
+
delayedTasks.forEach((delayedTask) => {
|
|
268
|
+
task_2.taskEventEmitter.emitTaskStatusChanged({
|
|
269
|
+
id: delayedTask.id,
|
|
270
|
+
name: delayedTask.name,
|
|
271
|
+
status: delayedTask.status
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
return delayedTasks;
|
|
276
|
+
});
|
|
277
|
+
}
|
|
249
278
|
retry(params) {
|
|
250
279
|
return __awaiter(this, void 0, void 0, function* () {
|
|
251
280
|
const lastTriedAtShoudBeLessThan = moment()
|
|
@@ -264,7 +264,9 @@ class MongoRepository {
|
|
|
264
264
|
else {
|
|
265
265
|
expires = params.expires;
|
|
266
266
|
}
|
|
267
|
-
return this.transactionModel.create(Object.assign(Object.assign({}, params), { typeOf: params.typeOf, status: factory.transactionStatusType.InProgress, startDate, endDate: undefined, expires,
|
|
267
|
+
return this.transactionModel.create(Object.assign(Object.assign({}, params), { typeOf: params.typeOf, status: factory.transactionStatusType.InProgress, startDate, endDate: undefined, expires, tasksExportAction: {
|
|
268
|
+
actionStatus: factory.actionStatusType.PotentialActionStatus
|
|
269
|
+
}, tasksExportationStatus: factory.transactionTasksExportationStatus.Unexported }))
|
|
268
270
|
.then((doc) => doc.toObject());
|
|
269
271
|
});
|
|
270
272
|
}
|
|
@@ -478,10 +480,9 @@ class MongoRepository {
|
|
|
478
480
|
}
|
|
479
481
|
const typeOfIn = (_a = params.typeOf) === null || _a === void 0 ? void 0 : _a.$in;
|
|
480
482
|
return this.transactionModel.findOneAndUpdate(Object.assign(Object.assign(Object.assign(Object.assign({}, (params.project !== undefined) ? { 'project.id': { $eq: params.project.id } } : undefined), (Array.isArray(typeOfIn)) ? { typeOf: { $in: typeOfIn } } : undefined), { status: { $eq: params.status }, tasksExportationStatus: { $eq: factory.transactionTasksExportationStatus.Unexported } }), (typeof params.id === 'string') ? { _id: { $eq: params.id } } : undefined), {
|
|
481
|
-
tasksExportAction:
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
},
|
|
483
|
+
'tasksExportAction.actionStatus': factory.actionStatusType.ActiveActionStatus,
|
|
484
|
+
'tasksExportAction.agent': { name: params.tasksExportAction.agent.name },
|
|
485
|
+
'tasksExportAction.startDate': new Date(),
|
|
485
486
|
tasksExportationStatus: factory.transactionTasksExportationStatus.Exporting
|
|
486
487
|
}, { new: true })
|
|
487
488
|
.select({
|
|
@@ -521,6 +522,9 @@ class MongoRepository {
|
|
|
521
522
|
_id: { $eq: reexportingTransaction.id },
|
|
522
523
|
tasksExportationStatus: { $eq: factory.transactionTasksExportationStatus.Exporting }
|
|
523
524
|
}, {
|
|
525
|
+
tasksExportAction: {
|
|
526
|
+
actionStatus: factory.actionStatusType.PotentialActionStatus
|
|
527
|
+
},
|
|
524
528
|
tasksExportationStatus: factory.transactionTasksExportationStatus.Unexported
|
|
525
529
|
})
|
|
526
530
|
.exec();
|
|
@@ -531,20 +535,6 @@ class MongoRepository {
|
|
|
531
535
|
});
|
|
532
536
|
}
|
|
533
537
|
}
|
|
534
|
-
// await this.transactionModel.updateMany(
|
|
535
|
-
// {
|
|
536
|
-
// tasksExportationStatus: { $eq: factory.transactionTasksExportationStatus.Exporting },
|
|
537
|
-
// updatedAt: {
|
|
538
|
-
// $lt: moment()
|
|
539
|
-
// .add(-params.intervalInMinutes, 'minutes')
|
|
540
|
-
// .toDate()
|
|
541
|
-
// }
|
|
542
|
-
// },
|
|
543
|
-
// {
|
|
544
|
-
// tasksExportationStatus: factory.transactionTasksExportationStatus.Unexported
|
|
545
|
-
// }
|
|
546
|
-
// )
|
|
547
|
-
// .exec();
|
|
548
538
|
});
|
|
549
539
|
}
|
|
550
540
|
/**
|
|
@@ -600,6 +590,7 @@ class MongoRepository {
|
|
|
600
590
|
}, {
|
|
601
591
|
tasksExportationStatus: factory.transactionTasksExportationStatus.Exported,
|
|
602
592
|
tasksExportedAt: endDate,
|
|
593
|
+
'tasksExportAction.actionStatus': factory.actionStatusType.CompletedActionStatus,
|
|
603
594
|
'tasksExportAction.endDate': endDate
|
|
604
595
|
})
|
|
605
596
|
.exec();
|
|
@@ -4,97 +4,142 @@ import { MongoRepository as AssetTransactionRepo } from '../../repo/assetTransac
|
|
|
4
4
|
import { MongoRepository as EventRepo } from '../../repo/event';
|
|
5
5
|
import { MongoRepository as TasKRepo } from '../../repo/task';
|
|
6
6
|
import { MongoRepository as TransactionRepo } from '../../repo/transaction';
|
|
7
|
+
type AggregateDurationUnit = 'days' | 'hours';
|
|
7
8
|
declare function aggregateEvent(params: {
|
|
8
|
-
|
|
9
|
+
aggregateDurationUnit: AggregateDurationUnit;
|
|
10
|
+
aggregationCount: number;
|
|
9
11
|
excludedProjectId?: string;
|
|
10
12
|
}): (repos: {
|
|
11
13
|
agregation: AggregationRepo;
|
|
12
14
|
event: EventRepo;
|
|
13
|
-
}) => Promise<
|
|
15
|
+
}) => Promise<{
|
|
16
|
+
aggregationCount: number;
|
|
17
|
+
aggregateDuration: string;
|
|
18
|
+
}>;
|
|
14
19
|
/**
|
|
15
20
|
* 注文取引集計
|
|
16
21
|
*/
|
|
17
22
|
declare function aggregatePlaceOrder(params: {
|
|
18
|
-
|
|
23
|
+
aggregateDurationUnit: AggregateDurationUnit;
|
|
24
|
+
aggregationCount: number;
|
|
19
25
|
excludedProjectId?: string;
|
|
20
26
|
clientIds?: string[];
|
|
21
27
|
}): (repos: {
|
|
22
28
|
agregation: AggregationRepo;
|
|
23
29
|
transaction: TransactionRepo;
|
|
24
|
-
}) => Promise<
|
|
30
|
+
}) => Promise<{
|
|
31
|
+
aggregationCount: number;
|
|
32
|
+
aggregateDuration: string;
|
|
33
|
+
}>;
|
|
25
34
|
/**
|
|
26
35
|
* 興行オファー承認アクション集計
|
|
27
36
|
*/
|
|
28
37
|
declare function aggregateAuthorizeEventServiceOfferAction(params: {
|
|
29
|
-
|
|
38
|
+
aggregateDurationUnit: AggregateDurationUnit;
|
|
39
|
+
aggregationCount: number;
|
|
30
40
|
excludedProjectId?: string;
|
|
31
41
|
}): (repos: {
|
|
32
42
|
agregation: AggregationRepo;
|
|
33
43
|
action: ActionRepo;
|
|
34
|
-
}) => Promise<
|
|
44
|
+
}) => Promise<{
|
|
45
|
+
aggregationCount: number;
|
|
46
|
+
aggregateDuration: string;
|
|
47
|
+
}>;
|
|
35
48
|
/**
|
|
36
49
|
* 決済承認アクション集計
|
|
37
50
|
*/
|
|
38
51
|
declare function aggregateAuthorizePaymentAction(params: {
|
|
39
|
-
|
|
52
|
+
aggregateDurationUnit: AggregateDurationUnit;
|
|
53
|
+
aggregationCount: number;
|
|
40
54
|
excludedProjectId?: string;
|
|
41
55
|
}): (repos: {
|
|
42
56
|
agregation: AggregationRepo;
|
|
43
57
|
action: ActionRepo;
|
|
44
|
-
}) => Promise<
|
|
58
|
+
}) => Promise<{
|
|
59
|
+
aggregationCount: number;
|
|
60
|
+
aggregateDuration: string;
|
|
61
|
+
}>;
|
|
45
62
|
declare function aggregateAuthorizeOrderAction(params: {
|
|
46
|
-
|
|
63
|
+
aggregateDurationUnit: AggregateDurationUnit;
|
|
64
|
+
aggregationCount: number;
|
|
47
65
|
excludedProjectId?: string;
|
|
48
66
|
}): (repos: {
|
|
49
67
|
agregation: AggregationRepo;
|
|
50
68
|
action: ActionRepo;
|
|
51
|
-
}) => Promise<
|
|
69
|
+
}) => Promise<{
|
|
70
|
+
aggregationCount: number;
|
|
71
|
+
aggregateDuration: string;
|
|
72
|
+
}>;
|
|
52
73
|
/**
|
|
53
74
|
* 使用アクション集計
|
|
54
75
|
*/
|
|
55
76
|
declare function aggregateUseAction(params: {
|
|
56
|
-
|
|
77
|
+
aggregateDurationUnit: AggregateDurationUnit;
|
|
78
|
+
aggregationCount: number;
|
|
57
79
|
excludedProjectId?: string;
|
|
58
80
|
}): (repos: {
|
|
59
81
|
agregation: AggregationRepo;
|
|
60
82
|
action: ActionRepo;
|
|
61
|
-
}) => Promise<
|
|
83
|
+
}) => Promise<{
|
|
84
|
+
aggregationCount: number;
|
|
85
|
+
aggregateDuration: string;
|
|
86
|
+
}>;
|
|
62
87
|
declare function aggregateCheckMovieTicketAction(params: {
|
|
63
|
-
|
|
88
|
+
aggregateDurationUnit: AggregateDurationUnit;
|
|
89
|
+
aggregationCount: number;
|
|
64
90
|
excludedProjectId?: string;
|
|
65
91
|
}): (repos: {
|
|
66
92
|
agregation: AggregationRepo;
|
|
67
93
|
action: ActionRepo;
|
|
68
|
-
}) => Promise<
|
|
94
|
+
}) => Promise<{
|
|
95
|
+
aggregationCount: number;
|
|
96
|
+
aggregateDuration: string;
|
|
97
|
+
}>;
|
|
69
98
|
declare function aggregatePayMovieTicketAction(params: {
|
|
70
|
-
|
|
99
|
+
aggregateDurationUnit: AggregateDurationUnit;
|
|
100
|
+
aggregationCount: number;
|
|
71
101
|
excludedProjectId?: string;
|
|
72
102
|
}): (repos: {
|
|
73
103
|
agregation: AggregationRepo;
|
|
74
104
|
action: ActionRepo;
|
|
75
|
-
}) => Promise<
|
|
105
|
+
}) => Promise<{
|
|
106
|
+
aggregationCount: number;
|
|
107
|
+
aggregateDuration: string;
|
|
108
|
+
}>;
|
|
76
109
|
declare function aggregatePayTransaction(params: {
|
|
77
|
-
|
|
110
|
+
aggregateDurationUnit: AggregateDurationUnit;
|
|
111
|
+
aggregationCount: number;
|
|
78
112
|
excludedProjectId?: string;
|
|
79
113
|
}): (repos: {
|
|
80
114
|
agregation: AggregationRepo;
|
|
81
115
|
assetTransaction: AssetTransactionRepo;
|
|
82
|
-
}) => Promise<
|
|
116
|
+
}) => Promise<{
|
|
117
|
+
aggregationCount: number;
|
|
118
|
+
aggregateDuration: string;
|
|
119
|
+
}>;
|
|
83
120
|
/**
|
|
84
121
|
* 予約集計
|
|
85
122
|
*/
|
|
86
123
|
declare function aggregateReserveTransaction(params: {
|
|
87
|
-
|
|
124
|
+
aggregateDurationUnit: AggregateDurationUnit;
|
|
125
|
+
aggregationCount: number;
|
|
88
126
|
excludedProjectId?: string;
|
|
89
127
|
}): (repos: {
|
|
90
128
|
agregation: AggregationRepo;
|
|
91
129
|
assetTransaction: AssetTransactionRepo;
|
|
92
|
-
}) => Promise<
|
|
130
|
+
}) => Promise<{
|
|
131
|
+
aggregationCount: number;
|
|
132
|
+
aggregateDuration: string;
|
|
133
|
+
}>;
|
|
93
134
|
declare function aggregateTask(params: {
|
|
94
|
-
|
|
135
|
+
aggregateDurationUnit: AggregateDurationUnit;
|
|
136
|
+
aggregationCount: number;
|
|
95
137
|
excludedProjectId?: string;
|
|
96
138
|
}): (repos: {
|
|
97
139
|
agregation: AggregationRepo;
|
|
98
140
|
task: TasKRepo;
|
|
99
|
-
}) => Promise<
|
|
141
|
+
}) => Promise<{
|
|
142
|
+
aggregationCount: number;
|
|
143
|
+
aggregateDuration: string;
|
|
144
|
+
}>;
|
|
100
145
|
export { aggregateAuthorizeEventServiceOfferAction, aggregateAuthorizeOrderAction, aggregateAuthorizePaymentAction, aggregateCheckMovieTicketAction, aggregateEvent, aggregatePayMovieTicketAction, aggregatePayTransaction, aggregatePlaceOrder, aggregateReserveTransaction, aggregateTask, aggregateUseAction };
|
|
@@ -19,22 +19,22 @@ function aggregateEvent(params) {
|
|
|
19
19
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
20
20
|
var _a;
|
|
21
21
|
const aggregateDate = new Date();
|
|
22
|
-
const aggregateDuration = moment.duration(1,
|
|
22
|
+
const aggregateDuration = moment.duration(1, params.aggregateDurationUnit)
|
|
23
23
|
.toISOString();
|
|
24
24
|
let i = -1;
|
|
25
|
-
while (i < params.
|
|
25
|
+
while (i < params.aggregationCount) {
|
|
26
26
|
i += 1;
|
|
27
|
-
const startFrom = moment()
|
|
27
|
+
const startFrom = moment(aggregateDate)
|
|
28
28
|
.utc()
|
|
29
29
|
// .tz('Asia/Tokyo')
|
|
30
|
-
.add(-i,
|
|
31
|
-
.startOf(
|
|
30
|
+
.add(-i, params.aggregateDurationUnit)
|
|
31
|
+
.startOf(params.aggregateDurationUnit)
|
|
32
32
|
.toDate();
|
|
33
|
-
const startThrough = moment()
|
|
33
|
+
const startThrough = moment(aggregateDate)
|
|
34
34
|
.utc()
|
|
35
35
|
// .tz('Asia/Tokyo')
|
|
36
|
-
.add(-i,
|
|
37
|
-
.endOf(
|
|
36
|
+
.add(-i, params.aggregateDurationUnit)
|
|
37
|
+
.endOf(params.aggregateDurationUnit)
|
|
38
38
|
.toDate();
|
|
39
39
|
const aggregateResult = yield repos.event.aggregateEvent({
|
|
40
40
|
project: { id: { $ne: params.excludedProjectId } },
|
|
@@ -45,6 +45,7 @@ function aggregateEvent(params) {
|
|
|
45
45
|
debug('aggregateEvent:result', aggregateResult, (_a = aggregateResult.statuses[0]) === null || _a === void 0 ? void 0 : _a.aggregation.percentilesRemainingCapacityRate, startFrom);
|
|
46
46
|
yield repos.agregation.saveAggregation(Object.assign({ typeOf: aggregation_1.AggregationType.AggregateEvent, project: { id: '*', typeOf: factory.organizationType.Project }, aggregateDuration, aggregateStart: startFrom, aggregateDate }, aggregateResult));
|
|
47
47
|
}
|
|
48
|
+
return { aggregationCount: i, aggregateDuration };
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
51
|
exports.aggregateEvent = aggregateEvent;
|
|
@@ -55,22 +56,22 @@ function aggregatePlaceOrder(params) {
|
|
|
55
56
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
56
57
|
var _a, _b;
|
|
57
58
|
const aggregateDate = new Date();
|
|
58
|
-
const aggregateDuration = moment.duration(1,
|
|
59
|
+
const aggregateDuration = moment.duration(1, params.aggregateDurationUnit)
|
|
59
60
|
.toISOString();
|
|
60
61
|
let i = -1;
|
|
61
|
-
while (i < params.
|
|
62
|
+
while (i < params.aggregationCount) {
|
|
62
63
|
i += 1;
|
|
63
|
-
const startFrom = moment()
|
|
64
|
+
const startFrom = moment(aggregateDate)
|
|
64
65
|
.utc()
|
|
65
66
|
// .tz('Asia/Tokyo')
|
|
66
|
-
.add(-i,
|
|
67
|
-
.startOf(
|
|
67
|
+
.add(-i, params.aggregateDurationUnit)
|
|
68
|
+
.startOf(params.aggregateDurationUnit)
|
|
68
69
|
.toDate();
|
|
69
|
-
const startThrough = moment()
|
|
70
|
+
const startThrough = moment(aggregateDate)
|
|
70
71
|
.utc()
|
|
71
72
|
// .tz('Asia/Tokyo')
|
|
72
|
-
.add(-i,
|
|
73
|
-
.endOf(
|
|
73
|
+
.add(-i, params.aggregateDurationUnit)
|
|
74
|
+
.endOf(params.aggregateDurationUnit)
|
|
74
75
|
.toDate();
|
|
75
76
|
const aggregateResult = yield repos.transaction.aggregatePlaceOrder({
|
|
76
77
|
project: { id: { $ne: params.excludedProjectId } },
|
|
@@ -98,6 +99,7 @@ function aggregatePlaceOrder(params) {
|
|
|
98
99
|
}
|
|
99
100
|
yield repos.agregation.saveAggregation(Object.assign({ typeOf: aggregation_1.AggregationType.AggregatePlaceOrder, project: { id: '*', typeOf: factory.organizationType.Project }, aggregateDuration, aggregateStart: startFrom, aggregateDate, aggregationByClient: aggregateResultsByClientId }, aggregateResult));
|
|
100
101
|
}
|
|
102
|
+
return { aggregationCount: i, aggregateDuration };
|
|
101
103
|
});
|
|
102
104
|
}
|
|
103
105
|
exports.aggregatePlaceOrder = aggregatePlaceOrder;
|
|
@@ -108,22 +110,22 @@ function aggregateAuthorizeEventServiceOfferAction(params) {
|
|
|
108
110
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
109
111
|
var _a;
|
|
110
112
|
const aggregateDate = new Date();
|
|
111
|
-
const aggregateDuration = moment.duration(1,
|
|
113
|
+
const aggregateDuration = moment.duration(1, params.aggregateDurationUnit)
|
|
112
114
|
.toISOString();
|
|
113
115
|
let i = -1;
|
|
114
|
-
while (i < params.
|
|
116
|
+
while (i < params.aggregationCount) {
|
|
115
117
|
i += 1;
|
|
116
|
-
const startFrom = moment()
|
|
118
|
+
const startFrom = moment(aggregateDate)
|
|
117
119
|
.utc()
|
|
118
120
|
// .tz('Asia/Tokyo')
|
|
119
|
-
.add(-i,
|
|
120
|
-
.startOf(
|
|
121
|
+
.add(-i, params.aggregateDurationUnit)
|
|
122
|
+
.startOf(params.aggregateDurationUnit)
|
|
121
123
|
.toDate();
|
|
122
|
-
const startThrough = moment()
|
|
124
|
+
const startThrough = moment(aggregateDate)
|
|
123
125
|
.utc()
|
|
124
126
|
// .tz('Asia/Tokyo')
|
|
125
|
-
.add(-i,
|
|
126
|
-
.endOf(
|
|
127
|
+
.add(-i, params.aggregateDurationUnit)
|
|
128
|
+
.endOf(params.aggregateDurationUnit)
|
|
127
129
|
.toDate();
|
|
128
130
|
const aggregateResult = yield repos.action.aggregateAuthorizeEventServiceOfferAction({
|
|
129
131
|
project: { id: { $ne: params.excludedProjectId } },
|
|
@@ -134,6 +136,7 @@ function aggregateAuthorizeEventServiceOfferAction(params) {
|
|
|
134
136
|
debug('aggregateAuthorizeEventServiceOfferAction:result', aggregateResult, (_a = aggregateResult.statuses[0]) === null || _a === void 0 ? void 0 : _a.aggregation.percentilesDuration, startFrom);
|
|
135
137
|
yield repos.agregation.saveAggregation(Object.assign({ typeOf: aggregation_1.AggregationType.AggregateAuthorizeEventServiceOfferAction, project: { id: '*', typeOf: factory.organizationType.Project }, aggregateDuration, aggregateStart: startFrom, aggregateDate }, aggregateResult));
|
|
136
138
|
}
|
|
139
|
+
return { aggregationCount: i, aggregateDuration };
|
|
137
140
|
});
|
|
138
141
|
}
|
|
139
142
|
exports.aggregateAuthorizeEventServiceOfferAction = aggregateAuthorizeEventServiceOfferAction;
|
|
@@ -144,22 +147,22 @@ function aggregateAuthorizePaymentAction(params) {
|
|
|
144
147
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
145
148
|
var _a;
|
|
146
149
|
const aggregateDate = new Date();
|
|
147
|
-
const aggregateDuration = moment.duration(1,
|
|
150
|
+
const aggregateDuration = moment.duration(1, params.aggregateDurationUnit)
|
|
148
151
|
.toISOString();
|
|
149
152
|
let i = -1;
|
|
150
|
-
while (i < params.
|
|
153
|
+
while (i < params.aggregationCount) {
|
|
151
154
|
i += 1;
|
|
152
|
-
const startFrom = moment()
|
|
155
|
+
const startFrom = moment(aggregateDate)
|
|
153
156
|
.utc()
|
|
154
157
|
// .tz('Asia/Tokyo')
|
|
155
|
-
.add(-i,
|
|
156
|
-
.startOf(
|
|
158
|
+
.add(-i, params.aggregateDurationUnit)
|
|
159
|
+
.startOf(params.aggregateDurationUnit)
|
|
157
160
|
.toDate();
|
|
158
|
-
const startThrough = moment()
|
|
161
|
+
const startThrough = moment(aggregateDate)
|
|
159
162
|
.utc()
|
|
160
163
|
// .tz('Asia/Tokyo')
|
|
161
|
-
.add(-i,
|
|
162
|
-
.endOf(
|
|
164
|
+
.add(-i, params.aggregateDurationUnit)
|
|
165
|
+
.endOf(params.aggregateDurationUnit)
|
|
163
166
|
.toDate();
|
|
164
167
|
const aggregateResult = yield repos.action.aggregateAuthorizePaymentAction({
|
|
165
168
|
project: { id: { $ne: params.excludedProjectId } },
|
|
@@ -170,6 +173,7 @@ function aggregateAuthorizePaymentAction(params) {
|
|
|
170
173
|
debug('aggregateAuthorizePaymentAction:result', aggregateResult, (_a = aggregateResult.statuses[0]) === null || _a === void 0 ? void 0 : _a.aggregation.percentilesDuration, startFrom);
|
|
171
174
|
yield repos.agregation.saveAggregation(Object.assign({ typeOf: aggregation_1.AggregationType.AggregateAuthorizePaymentAction, project: { id: '*', typeOf: factory.organizationType.Project }, aggregateDuration, aggregateStart: startFrom, aggregateDate }, aggregateResult));
|
|
172
175
|
}
|
|
176
|
+
return { aggregationCount: i, aggregateDuration };
|
|
173
177
|
});
|
|
174
178
|
}
|
|
175
179
|
exports.aggregateAuthorizePaymentAction = aggregateAuthorizePaymentAction;
|
|
@@ -177,22 +181,22 @@ function aggregateAuthorizeOrderAction(params) {
|
|
|
177
181
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
178
182
|
var _a;
|
|
179
183
|
const aggregateDate = new Date();
|
|
180
|
-
const aggregateDuration = moment.duration(1,
|
|
184
|
+
const aggregateDuration = moment.duration(1, params.aggregateDurationUnit)
|
|
181
185
|
.toISOString();
|
|
182
186
|
let i = -1;
|
|
183
|
-
while (i < params.
|
|
187
|
+
while (i < params.aggregationCount) {
|
|
184
188
|
i += 1;
|
|
185
|
-
const startFrom = moment()
|
|
189
|
+
const startFrom = moment(aggregateDate)
|
|
186
190
|
.utc()
|
|
187
191
|
// .tz('Asia/Tokyo')
|
|
188
|
-
.add(-i,
|
|
189
|
-
.startOf(
|
|
192
|
+
.add(-i, params.aggregateDurationUnit)
|
|
193
|
+
.startOf(params.aggregateDurationUnit)
|
|
190
194
|
.toDate();
|
|
191
|
-
const startThrough = moment()
|
|
195
|
+
const startThrough = moment(aggregateDate)
|
|
192
196
|
.utc()
|
|
193
197
|
// .tz('Asia/Tokyo')
|
|
194
|
-
.add(-i,
|
|
195
|
-
.endOf(
|
|
198
|
+
.add(-i, params.aggregateDurationUnit)
|
|
199
|
+
.endOf(params.aggregateDurationUnit)
|
|
196
200
|
.toDate();
|
|
197
201
|
const aggregateResult = yield repos.action.aggregateAuthorizeOrderAction({
|
|
198
202
|
project: { id: { $ne: params.excludedProjectId } },
|
|
@@ -203,6 +207,7 @@ function aggregateAuthorizeOrderAction(params) {
|
|
|
203
207
|
debug('aggregateAuthorizeOrderAction:result', aggregateResult, (_a = aggregateResult.statuses[0]) === null || _a === void 0 ? void 0 : _a.aggregation.percentilesDuration, startFrom);
|
|
204
208
|
yield repos.agregation.saveAggregation(Object.assign({ typeOf: aggregation_1.AggregationType.AggregateAuthorizeOrderAction, project: { id: '*', typeOf: factory.organizationType.Project }, aggregateDuration, aggregateStart: startFrom, aggregateDate }, aggregateResult));
|
|
205
209
|
}
|
|
210
|
+
return { aggregationCount: i, aggregateDuration };
|
|
206
211
|
});
|
|
207
212
|
}
|
|
208
213
|
exports.aggregateAuthorizeOrderAction = aggregateAuthorizeOrderAction;
|
|
@@ -213,22 +218,22 @@ function aggregateUseAction(params) {
|
|
|
213
218
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
214
219
|
var _a;
|
|
215
220
|
const aggregateDate = new Date();
|
|
216
|
-
const aggregateDuration = moment.duration(1,
|
|
221
|
+
const aggregateDuration = moment.duration(1, params.aggregateDurationUnit)
|
|
217
222
|
.toISOString();
|
|
218
223
|
let i = -1;
|
|
219
|
-
while (i < params.
|
|
224
|
+
while (i < params.aggregationCount) {
|
|
220
225
|
i += 1;
|
|
221
|
-
const startFrom = moment()
|
|
226
|
+
const startFrom = moment(aggregateDate)
|
|
222
227
|
.utc()
|
|
223
228
|
// .tz('Asia/Tokyo')
|
|
224
|
-
.add(-i,
|
|
225
|
-
.startOf(
|
|
229
|
+
.add(-i, params.aggregateDurationUnit)
|
|
230
|
+
.startOf(params.aggregateDurationUnit)
|
|
226
231
|
.toDate();
|
|
227
|
-
const startThrough = moment()
|
|
232
|
+
const startThrough = moment(aggregateDate)
|
|
228
233
|
.utc()
|
|
229
234
|
// .tz('Asia/Tokyo')
|
|
230
|
-
.add(-i,
|
|
231
|
-
.endOf(
|
|
235
|
+
.add(-i, params.aggregateDurationUnit)
|
|
236
|
+
.endOf(params.aggregateDurationUnit)
|
|
232
237
|
.toDate();
|
|
233
238
|
const aggregateResult = yield repos.action.aggregateUseAction({
|
|
234
239
|
project: { id: { $ne: params.excludedProjectId } },
|
|
@@ -239,6 +244,7 @@ function aggregateUseAction(params) {
|
|
|
239
244
|
debug('aggregateUseAction:result', aggregateResult, (_a = aggregateResult.statuses[0]) === null || _a === void 0 ? void 0 : _a.aggregation.percentilesDuration, startFrom);
|
|
240
245
|
yield repos.agregation.saveAggregation(Object.assign({ typeOf: aggregation_1.AggregationType.AggregateUseAction, project: { id: '*', typeOf: factory.organizationType.Project }, aggregateDuration, aggregateStart: startFrom, aggregateDate }, aggregateResult));
|
|
241
246
|
}
|
|
247
|
+
return { aggregationCount: i, aggregateDuration };
|
|
242
248
|
});
|
|
243
249
|
}
|
|
244
250
|
exports.aggregateUseAction = aggregateUseAction;
|
|
@@ -246,22 +252,22 @@ function aggregateCheckMovieTicketAction(params) {
|
|
|
246
252
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
247
253
|
var _a;
|
|
248
254
|
const aggregateDate = new Date();
|
|
249
|
-
const aggregateDuration = moment.duration(1,
|
|
255
|
+
const aggregateDuration = moment.duration(1, params.aggregateDurationUnit)
|
|
250
256
|
.toISOString();
|
|
251
257
|
let i = -1;
|
|
252
|
-
while (i < params.
|
|
258
|
+
while (i < params.aggregationCount) {
|
|
253
259
|
i += 1;
|
|
254
|
-
const startFrom = moment()
|
|
260
|
+
const startFrom = moment(aggregateDate)
|
|
255
261
|
.utc()
|
|
256
262
|
// .tz('Asia/Tokyo')
|
|
257
|
-
.add(-i,
|
|
258
|
-
.startOf(
|
|
263
|
+
.add(-i, params.aggregateDurationUnit)
|
|
264
|
+
.startOf(params.aggregateDurationUnit)
|
|
259
265
|
.toDate();
|
|
260
|
-
const startThrough = moment()
|
|
266
|
+
const startThrough = moment(aggregateDate)
|
|
261
267
|
.utc()
|
|
262
268
|
// .tz('Asia/Tokyo')
|
|
263
|
-
.add(-i,
|
|
264
|
-
.endOf(
|
|
269
|
+
.add(-i, params.aggregateDurationUnit)
|
|
270
|
+
.endOf(params.aggregateDurationUnit)
|
|
265
271
|
.toDate();
|
|
266
272
|
const aggregateResult = yield repos.action.aggregateCheckMovieTicketAction({
|
|
267
273
|
project: { id: { $ne: params.excludedProjectId } },
|
|
@@ -271,6 +277,7 @@ function aggregateCheckMovieTicketAction(params) {
|
|
|
271
277
|
debug('aggregateCheckMovieTicketAction:result', aggregateResult, (_a = aggregateResult.statuses[0]) === null || _a === void 0 ? void 0 : _a.aggregation.percentilesDuration, startFrom);
|
|
272
278
|
yield repos.agregation.saveAggregation(Object.assign({ typeOf: aggregation_1.AggregationType.AggregateCheckMovieTicketAction, project: { id: '*', typeOf: factory.organizationType.Project }, aggregateDuration, aggregateStart: startFrom, aggregateDate }, aggregateResult));
|
|
273
279
|
}
|
|
280
|
+
return { aggregationCount: i, aggregateDuration };
|
|
274
281
|
});
|
|
275
282
|
}
|
|
276
283
|
exports.aggregateCheckMovieTicketAction = aggregateCheckMovieTicketAction;
|
|
@@ -278,22 +285,22 @@ function aggregatePayMovieTicketAction(params) {
|
|
|
278
285
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
279
286
|
var _a;
|
|
280
287
|
const aggregateDate = new Date();
|
|
281
|
-
const aggregateDuration = moment.duration(1,
|
|
288
|
+
const aggregateDuration = moment.duration(1, params.aggregateDurationUnit)
|
|
282
289
|
.toISOString();
|
|
283
290
|
let i = -1;
|
|
284
|
-
while (i < params.
|
|
291
|
+
while (i < params.aggregationCount) {
|
|
285
292
|
i += 1;
|
|
286
|
-
const startFrom = moment()
|
|
293
|
+
const startFrom = moment(aggregateDate)
|
|
287
294
|
.utc()
|
|
288
295
|
// .tz('Asia/Tokyo')
|
|
289
|
-
.add(-i,
|
|
290
|
-
.startOf(
|
|
296
|
+
.add(-i, params.aggregateDurationUnit)
|
|
297
|
+
.startOf(params.aggregateDurationUnit)
|
|
291
298
|
.toDate();
|
|
292
|
-
const startThrough = moment()
|
|
299
|
+
const startThrough = moment(aggregateDate)
|
|
293
300
|
.utc()
|
|
294
301
|
// .tz('Asia/Tokyo')
|
|
295
|
-
.add(-i,
|
|
296
|
-
.endOf(
|
|
302
|
+
.add(-i, params.aggregateDurationUnit)
|
|
303
|
+
.endOf(params.aggregateDurationUnit)
|
|
297
304
|
.toDate();
|
|
298
305
|
const aggregateResult = yield repos.action.aggregatePayMovieTicketAction({
|
|
299
306
|
project: { id: { $ne: params.excludedProjectId } },
|
|
@@ -303,6 +310,7 @@ function aggregatePayMovieTicketAction(params) {
|
|
|
303
310
|
debug('aggregatePayMovieTicketAction:result', aggregateResult, (_a = aggregateResult.statuses[0]) === null || _a === void 0 ? void 0 : _a.aggregation.percentilesDuration, startFrom);
|
|
304
311
|
yield repos.agregation.saveAggregation(Object.assign({ typeOf: aggregation_1.AggregationType.AggregatePayMovieTicketAction, project: { id: '*', typeOf: factory.organizationType.Project }, aggregateDuration, aggregateStart: startFrom, aggregateDate }, aggregateResult));
|
|
305
312
|
}
|
|
313
|
+
return { aggregationCount: i, aggregateDuration };
|
|
306
314
|
});
|
|
307
315
|
}
|
|
308
316
|
exports.aggregatePayMovieTicketAction = aggregatePayMovieTicketAction;
|
|
@@ -310,22 +318,22 @@ function aggregatePayTransaction(params) {
|
|
|
310
318
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
311
319
|
var _a;
|
|
312
320
|
const aggregateDate = new Date();
|
|
313
|
-
const aggregateDuration = moment.duration(1,
|
|
321
|
+
const aggregateDuration = moment.duration(1, params.aggregateDurationUnit)
|
|
314
322
|
.toISOString();
|
|
315
323
|
let i = -1;
|
|
316
|
-
while (i < params.
|
|
324
|
+
while (i < params.aggregationCount) {
|
|
317
325
|
i += 1;
|
|
318
|
-
const startFrom = moment()
|
|
326
|
+
const startFrom = moment(aggregateDate)
|
|
319
327
|
.utc()
|
|
320
328
|
// .tz('Asia/Tokyo')
|
|
321
|
-
.add(-i,
|
|
322
|
-
.startOf(
|
|
329
|
+
.add(-i, params.aggregateDurationUnit)
|
|
330
|
+
.startOf(params.aggregateDurationUnit)
|
|
323
331
|
.toDate();
|
|
324
|
-
const startThrough = moment()
|
|
332
|
+
const startThrough = moment(aggregateDate)
|
|
325
333
|
.utc()
|
|
326
334
|
// .tz('Asia/Tokyo')
|
|
327
|
-
.add(-i,
|
|
328
|
-
.endOf(
|
|
335
|
+
.add(-i, params.aggregateDurationUnit)
|
|
336
|
+
.endOf(params.aggregateDurationUnit)
|
|
329
337
|
.toDate();
|
|
330
338
|
const aggregateResult = yield repos.assetTransaction.aggregateAssetTransaction({
|
|
331
339
|
project: { id: { $ne: params.excludedProjectId } },
|
|
@@ -336,6 +344,7 @@ function aggregatePayTransaction(params) {
|
|
|
336
344
|
debug('aggregatePayTransaction:result', aggregateResult, (_a = aggregateResult.statuses[0]) === null || _a === void 0 ? void 0 : _a.aggregation, startFrom);
|
|
337
345
|
yield repos.agregation.saveAggregation(Object.assign({ typeOf: aggregation_1.AggregationType.AggregatePay, project: { id: '*', typeOf: factory.organizationType.Project }, aggregateDuration, aggregateStart: startFrom, aggregateDate }, aggregateResult));
|
|
338
346
|
}
|
|
347
|
+
return { aggregationCount: i, aggregateDuration };
|
|
339
348
|
});
|
|
340
349
|
}
|
|
341
350
|
exports.aggregatePayTransaction = aggregatePayTransaction;
|
|
@@ -346,22 +355,22 @@ function aggregateReserveTransaction(params) {
|
|
|
346
355
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
347
356
|
var _a;
|
|
348
357
|
const aggregateDate = new Date();
|
|
349
|
-
const aggregateDuration = moment.duration(1,
|
|
358
|
+
const aggregateDuration = moment.duration(1, params.aggregateDurationUnit)
|
|
350
359
|
.toISOString();
|
|
351
360
|
let i = -1;
|
|
352
|
-
while (i < params.
|
|
361
|
+
while (i < params.aggregationCount) {
|
|
353
362
|
i += 1;
|
|
354
|
-
const startFrom = moment()
|
|
363
|
+
const startFrom = moment(aggregateDate)
|
|
355
364
|
.utc()
|
|
356
365
|
// .tz('Asia/Tokyo')
|
|
357
|
-
.add(-i,
|
|
358
|
-
.startOf(
|
|
366
|
+
.add(-i, params.aggregateDurationUnit)
|
|
367
|
+
.startOf(params.aggregateDurationUnit)
|
|
359
368
|
.toDate();
|
|
360
|
-
const startThrough = moment()
|
|
369
|
+
const startThrough = moment(aggregateDate)
|
|
361
370
|
.utc()
|
|
362
371
|
// .tz('Asia/Tokyo')
|
|
363
|
-
.add(-i,
|
|
364
|
-
.endOf(
|
|
372
|
+
.add(-i, params.aggregateDurationUnit)
|
|
373
|
+
.endOf(params.aggregateDurationUnit)
|
|
365
374
|
.toDate();
|
|
366
375
|
const aggregateResult = yield repos.assetTransaction.aggregateAssetTransaction({
|
|
367
376
|
project: { id: { $ne: params.excludedProjectId } },
|
|
@@ -372,6 +381,7 @@ function aggregateReserveTransaction(params) {
|
|
|
372
381
|
debug('aggregateReserveTransaction:result', aggregateResult, (_a = aggregateResult.statuses[0]) === null || _a === void 0 ? void 0 : _a.aggregation, startFrom);
|
|
373
382
|
yield repos.agregation.saveAggregation(Object.assign({ typeOf: aggregation_1.AggregationType.AggregateReserve, project: { id: '*', typeOf: factory.organizationType.Project }, aggregateDuration, aggregateStart: startFrom, aggregateDate }, aggregateResult));
|
|
374
383
|
}
|
|
384
|
+
return { aggregationCount: i, aggregateDuration };
|
|
375
385
|
});
|
|
376
386
|
}
|
|
377
387
|
exports.aggregateReserveTransaction = aggregateReserveTransaction;
|
|
@@ -379,31 +389,33 @@ function aggregateTask(params) {
|
|
|
379
389
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
380
390
|
var _a;
|
|
381
391
|
const aggregateDate = new Date();
|
|
382
|
-
const aggregateDuration = moment.duration(1,
|
|
392
|
+
const aggregateDuration = moment.duration(1, params.aggregateDurationUnit)
|
|
383
393
|
.toISOString();
|
|
384
394
|
let i = -1;
|
|
385
|
-
while (i < params.
|
|
395
|
+
while (i < params.aggregationCount) {
|
|
386
396
|
i += 1;
|
|
387
|
-
const runsFrom = moment()
|
|
397
|
+
const runsFrom = moment(aggregateDate)
|
|
388
398
|
.utc()
|
|
389
399
|
// .tz('Asia/Tokyo')
|
|
390
|
-
.add(-i,
|
|
391
|
-
.startOf(
|
|
400
|
+
.add(-i, params.aggregateDurationUnit)
|
|
401
|
+
.startOf(params.aggregateDurationUnit)
|
|
392
402
|
.toDate();
|
|
393
|
-
const runsThrough = moment()
|
|
403
|
+
const runsThrough = moment(aggregateDate)
|
|
394
404
|
.utc()
|
|
395
405
|
// .tz('Asia/Tokyo')
|
|
396
|
-
.add(-i,
|
|
397
|
-
.endOf(
|
|
406
|
+
.add(-i, params.aggregateDurationUnit)
|
|
407
|
+
.endOf(params.aggregateDurationUnit)
|
|
398
408
|
.toDate();
|
|
399
409
|
const aggregateResult = yield repos.task.aggregateTask({
|
|
400
410
|
project: { id: { $ne: params.excludedProjectId } },
|
|
401
411
|
runsFrom,
|
|
402
412
|
runsThrough
|
|
403
413
|
});
|
|
404
|
-
debug('aggregateTask:result', aggregateResult, (_a = aggregateResult.statuses[0]) === null || _a === void 0 ? void 0 : _a.aggregation, runsFrom);
|
|
414
|
+
debug('aggregateTask:result', aggregateResult, (_a = aggregateResult.statuses[0]) === null || _a === void 0 ? void 0 : _a.aggregation, runsFrom, runsThrough);
|
|
405
415
|
yield repos.agregation.saveAggregation(Object.assign({ typeOf: aggregation_1.AggregationType.AggregateTask, project: { id: '*', typeOf: factory.organizationType.Project }, aggregateDuration, aggregateStart: runsFrom, aggregateDate }, aggregateResult));
|
|
406
416
|
}
|
|
417
|
+
debug(i, 'aggregations saved');
|
|
418
|
+
return { aggregationCount: i, aggregateDuration };
|
|
407
419
|
});
|
|
408
420
|
}
|
|
409
421
|
exports.aggregateTask = aggregateTask;
|
|
@@ -77,10 +77,6 @@ function onRegistered(actionAttributes, __) {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
// タスク保管
|
|
80
|
-
|
|
81
|
-
yield repos.task.saveMany(taskAttributes);
|
|
82
|
-
// await Promise.all(taskAttributes.map(async (taskAttribute) => {
|
|
83
|
-
// return repos.task.save(taskAttribute);
|
|
84
|
-
// }));
|
|
80
|
+
yield repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
85
81
|
});
|
|
86
82
|
}
|
|
@@ -144,7 +144,6 @@ function cancelPendingReservation(actionAttributesList) {
|
|
|
144
144
|
// canceledReservationId: canceledReservation?.id
|
|
145
145
|
);
|
|
146
146
|
yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
147
|
-
// await onReservationCanceledByAction(actionAttributes)({ task: repos.task });
|
|
148
147
|
if (actionObject.typeOf === factory.reservationType.ReservationPackage) {
|
|
149
148
|
// 最新のconfirmedReservationsを検索
|
|
150
149
|
canceledReservations = yield repos.reservation.search({
|
|
@@ -297,7 +296,6 @@ function cancelReservation(actionAttributesList) {
|
|
|
297
296
|
// canceledReservationId: canceledReservation?.id
|
|
298
297
|
);
|
|
299
298
|
yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
300
|
-
// await onReservationCanceledByAction(actionAttributes)({ task: repos.task });
|
|
301
299
|
let canceledReservations = [];
|
|
302
300
|
if (actionAttributes.object.typeOf === factory.reservationType.ReservationPackage) {
|
|
303
301
|
const reservationNumber = actionAttributes.object.reservationNumber;
|
|
@@ -4,9 +4,6 @@ type IEventReservation = factory.reservation.IReservation<factory.reservationTyp
|
|
|
4
4
|
/**
|
|
5
5
|
* 予約取消後のアクション
|
|
6
6
|
*/
|
|
7
|
-
export declare function onReservationCanceledByAction(actionAttributes: factory.action.cancel.reservation.IAttributes): (repos: {
|
|
8
|
-
task: TaskRepo;
|
|
9
|
-
}) => Promise<void>;
|
|
10
7
|
export declare function onReservationCanceled(canceledReservations: IEventReservation[], useInformReservation: boolean): (repos: {
|
|
11
8
|
task: TaskRepo;
|
|
12
9
|
}) => Promise<void>;
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.onReservationCanceled =
|
|
12
|
+
exports.onReservationCanceled = void 0;
|
|
13
13
|
/**
|
|
14
14
|
* 予約取消時アクション
|
|
15
15
|
*/
|
|
@@ -23,22 +23,23 @@ const INFORM_TASK_DELAY_IN_SECONDS = 30;
|
|
|
23
23
|
/**
|
|
24
24
|
* 予約取消後のアクション
|
|
25
25
|
*/
|
|
26
|
-
function onReservationCanceledByAction(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
|
|
26
|
+
// export function onReservationCanceledByAction(
|
|
27
|
+
// actionAttributes: factory.action.cancel.reservation.IAttributes
|
|
28
|
+
// ) {
|
|
29
|
+
// return async (repos: {
|
|
30
|
+
// task: TaskRepo;
|
|
31
|
+
// }) => {
|
|
32
|
+
// const potentialActions = actionAttributes.potentialActions;
|
|
33
|
+
// const taskAttributes: factory.task.IAttributes<factory.taskName>[] = [];
|
|
34
|
+
// if (potentialActions !== undefined) {
|
|
35
|
+
// // no op
|
|
36
|
+
// }
|
|
37
|
+
// // タスク保管
|
|
38
|
+
// if (taskAttributes.length > 0) {
|
|
39
|
+
// await repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
40
|
+
// }
|
|
41
|
+
// };
|
|
42
|
+
// }
|
|
42
43
|
function onReservationCanceled(canceledReservations, useInformReservation) {
|
|
43
44
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
44
45
|
if (Array.isArray(canceledReservations) && canceledReservations.length > 0) {
|
|
@@ -57,38 +57,9 @@ function onReservationConfirmedByAction(actionAttributes
|
|
|
57
57
|
}));
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
// inform galobally
|
|
61
|
-
// if (Array.isArray(informReservations)) {
|
|
62
|
-
// const reservation4inform: IReservation4informConfirmed = maskUnderName(confirmedReservation);
|
|
63
|
-
// taskAttributes.push(...informReservations.map<ITriggerWebhookTaskAttributes>((informReservation) => {
|
|
64
|
-
// const informUrl: string = String(informReservation.recipient?.url);
|
|
65
|
-
// const informReservationAttributes: InformReservationActionattributes = {
|
|
66
|
-
// agent: confirmedReservation.project,
|
|
67
|
-
// object: [reservation4inform],
|
|
68
|
-
// project: confirmedReservation.project,
|
|
69
|
-
// recipient: {
|
|
70
|
-
// id: '',
|
|
71
|
-
// name: informUrl,
|
|
72
|
-
// typeOf: factory.creativeWorkType.WebApplication,
|
|
73
|
-
// url: informUrl
|
|
74
|
-
// },
|
|
75
|
-
// typeOf: factory.actionType.InformAction
|
|
76
|
-
// };
|
|
77
|
-
// return {
|
|
78
|
-
// project: actionAttributes.project,
|
|
79
|
-
// name: factory.taskName.TriggerWebhook,
|
|
80
|
-
// status: factory.taskStatus.Ready,
|
|
81
|
-
// runsAt: now,
|
|
82
|
-
// remainingNumberOfTries: NUM_TRY_INFORM_RESERVATION,
|
|
83
|
-
// numberOfTried: 0,
|
|
84
|
-
// executionResults: [],
|
|
85
|
-
// data: informReservationAttributes
|
|
86
|
-
// };
|
|
87
|
-
// }));
|
|
88
|
-
// }
|
|
89
60
|
// タスク保管
|
|
90
61
|
if (taskAttributes.length > 0) {
|
|
91
|
-
yield repos.task.saveMany(taskAttributes);
|
|
62
|
+
yield repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
92
63
|
}
|
|
93
64
|
});
|
|
94
65
|
}
|
|
@@ -142,7 +113,7 @@ function onReservationConfirmed(confirmedReservations) {
|
|
|
142
113
|
}
|
|
143
114
|
// タスク保管
|
|
144
115
|
if (taskAttributes.length > 0) {
|
|
145
|
-
yield repos.task.saveMany(taskAttributes);
|
|
116
|
+
yield repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
146
117
|
}
|
|
147
118
|
}
|
|
148
119
|
});
|
|
@@ -95,7 +95,7 @@ function onRegistered(actionAttributes) {
|
|
|
95
95
|
taskAttributes.push(...orderProgramMembershipTasks);
|
|
96
96
|
}
|
|
97
97
|
// タスク保管
|
|
98
|
-
yield repos.task.saveMany(taskAttributes);
|
|
98
|
+
yield repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
101
|
exports.onRegistered = onRegistered;
|
|
@@ -219,10 +219,6 @@ function onRefund(refundActionAttributes) {
|
|
|
219
219
|
});
|
|
220
220
|
}
|
|
221
221
|
// タスク保管
|
|
222
|
-
|
|
223
|
-
yield repos.task.saveMany(taskAttributes);
|
|
224
|
-
// await Promise.all(taskAttributes.map(async (taskAttribute) => {
|
|
225
|
-
// return repos.task.save(taskAttribute);
|
|
226
|
-
// }));
|
|
222
|
+
yield repos.task.saveMany(taskAttributes, { emitImmediately: true });
|
|
227
223
|
});
|
|
228
224
|
}
|
|
@@ -92,7 +92,21 @@ function createTasks(params) {
|
|
|
92
92
|
purpose: { typeOf: transaction.typeOf, id: transaction.id }
|
|
93
93
|
}
|
|
94
94
|
};
|
|
95
|
-
|
|
95
|
+
// 確定取引にも興行オファー承認中止タスクを追加(2023-05-09~)
|
|
96
|
+
const voidReserveTaskAttributes = {
|
|
97
|
+
project: transaction.project,
|
|
98
|
+
name: factory.taskName.VoidReserveTransaction,
|
|
99
|
+
status: factory.taskStatus.Ready,
|
|
100
|
+
runsAt: taskRunsAt,
|
|
101
|
+
remainingNumberOfTries: 10,
|
|
102
|
+
numberOfTried: 0,
|
|
103
|
+
executionResults: [],
|
|
104
|
+
data: {
|
|
105
|
+
project: transaction.project,
|
|
106
|
+
purpose: { typeOf: transaction.typeOf, id: transaction.id }
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
taskAttributes.push(...triggerWebhookTaskAttributes, deleteTransactionTask, voidPaymentTaskAttributes, voidReserveTaskAttributes);
|
|
96
110
|
switch (transaction.status) {
|
|
97
111
|
case factory.transactionStatusType.Confirmed:
|
|
98
112
|
const potentialActions = transaction.potentialActions;
|
|
@@ -123,19 +137,6 @@ function createTasks(params) {
|
|
|
123
137
|
break;
|
|
124
138
|
case factory.transactionStatusType.Canceled:
|
|
125
139
|
case factory.transactionStatusType.Expired:
|
|
126
|
-
const voidReserveTaskAttributes = {
|
|
127
|
-
project: transaction.project,
|
|
128
|
-
name: factory.taskName.VoidReserveTransaction,
|
|
129
|
-
status: factory.taskStatus.Ready,
|
|
130
|
-
runsAt: taskRunsAt,
|
|
131
|
-
remainingNumberOfTries: 10,
|
|
132
|
-
numberOfTried: 0,
|
|
133
|
-
executionResults: [],
|
|
134
|
-
data: {
|
|
135
|
-
project: transaction.project,
|
|
136
|
-
purpose: { typeOf: transaction.typeOf, id: transaction.id }
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
140
|
const voidRegisterServiceTaskAttributes = {
|
|
140
141
|
project: transaction.project,
|
|
141
142
|
name: factory.taskName.VoidRegisterServiceTransaction,
|
|
@@ -162,7 +163,7 @@ function createTasks(params) {
|
|
|
162
163
|
purpose: { typeOf: transaction.typeOf, id: transaction.id }
|
|
163
164
|
}
|
|
164
165
|
};
|
|
165
|
-
taskAttributes.push(
|
|
166
|
+
taskAttributes.push(voidRegisterServiceTaskAttributes, voidMoneyTransferTaskAttributes);
|
|
166
167
|
break;
|
|
167
168
|
default:
|
|
168
169
|
throw new factory.errors.NotImplemented(`Transaction status "${transaction.status}" not implemented.`);
|
package/package.json
CHANGED