@chevre/domain 26.0.0-alpha.11 → 26.0.0-alpha.12
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.
|
@@ -93,15 +93,16 @@ const indexes = [
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
],
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
96
|
+
// 非同期アクションは移行につきexpires廃止(2026-08-05~)
|
|
97
|
+
// [
|
|
98
|
+
// { expires: 1, runsAt: -1 },
|
|
99
|
+
// {
|
|
100
|
+
// name: 'expires',
|
|
101
|
+
// partialFilterExpression: {
|
|
102
|
+
// expires: { $exists: true }
|
|
103
|
+
// }
|
|
104
|
+
// }
|
|
105
|
+
// ],
|
|
105
106
|
[
|
|
106
107
|
{ remainingNumberOfTries: 1, runsAt: -1 },
|
|
107
108
|
{ name: 'searchByRemainingNumberOfTries-v2' }
|
|
@@ -195,15 +196,16 @@ const indexes = [
|
|
|
195
196
|
}
|
|
196
197
|
}
|
|
197
198
|
],
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
199
|
+
// 非同期アクションは移行につきexpires廃止(2026-08-05~)
|
|
200
|
+
// [
|
|
201
|
+
// { status: 1, expires: 1 },
|
|
202
|
+
// {
|
|
203
|
+
// name: 'makeExpiredMany',
|
|
204
|
+
// partialFilterExpression: {
|
|
205
|
+
// expires: { $exists: true }
|
|
206
|
+
// }
|
|
207
|
+
// }
|
|
208
|
+
// ],
|
|
207
209
|
[
|
|
208
210
|
// add unique index(2025-03-28~)
|
|
209
211
|
{ alternateName: 1 },
|
|
@@ -18,4 +18,10 @@ export declare class ScheduledTaskMigrationRepo {
|
|
|
18
18
|
validationErrors: import("mongoose").Error[];
|
|
19
19
|
} | undefined;
|
|
20
20
|
}) | undefined>;
|
|
21
|
+
deleteLagacyTasks(params: {
|
|
22
|
+
limit: number;
|
|
23
|
+
}): Promise<import("mongodb").DeleteResult | undefined>;
|
|
24
|
+
deleteLagacyAsyncActions(params: {
|
|
25
|
+
limit: number;
|
|
26
|
+
}): Promise<import("mongodb").DeleteResult | undefined>;
|
|
21
27
|
}
|
|
@@ -66,5 +66,56 @@ class ScheduledTaskMigrationRepo {
|
|
|
66
66
|
}
|
|
67
67
|
return result;
|
|
68
68
|
}
|
|
69
|
+
async deleteLagacyTasks(params) {
|
|
70
|
+
const { limit } = params;
|
|
71
|
+
const deletingTasks = await this.taskModel.find({
|
|
72
|
+
name: {
|
|
73
|
+
$in: [
|
|
74
|
+
factory_1.factory.taskName.DeleteTransaction,
|
|
75
|
+
factory_1.factory.taskName.ImportEventsFromCOA,
|
|
76
|
+
factory_1.factory.taskName.ImportEventCapacitiesFromCOA
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
}, { _id: 1 })
|
|
80
|
+
.limit(limit)
|
|
81
|
+
.lean()
|
|
82
|
+
.exec();
|
|
83
|
+
// console.log(deletingTasks);
|
|
84
|
+
if (deletingTasks.length === 0) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
;
|
|
88
|
+
return this.taskModel.deleteMany({
|
|
89
|
+
_id: { $in: deletingTasks.map((doc) => doc._id) }
|
|
90
|
+
})
|
|
91
|
+
.exec();
|
|
92
|
+
}
|
|
93
|
+
async deleteLagacyAsyncActions(params) {
|
|
94
|
+
const { limit } = params;
|
|
95
|
+
const deletingTasks = await this.taskModel.find({
|
|
96
|
+
name: {
|
|
97
|
+
$in: [
|
|
98
|
+
factory_1.factory.taskName.AcceptCOAOffer,
|
|
99
|
+
factory_1.factory.taskName.AuthorizePayment,
|
|
100
|
+
factory_1.factory.taskName.CheckMovieTicket,
|
|
101
|
+
factory_1.factory.taskName.PublishPaymentUrl,
|
|
102
|
+
factory_1.factory.taskName.VoidReserveTransaction
|
|
103
|
+
]
|
|
104
|
+
},
|
|
105
|
+
expires: { $exists: true, $lte: new Date() }
|
|
106
|
+
}, { _id: 1 })
|
|
107
|
+
.limit(limit)
|
|
108
|
+
.lean()
|
|
109
|
+
.exec();
|
|
110
|
+
// console.log(deletingTasks);
|
|
111
|
+
if (deletingTasks.length === 0) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
;
|
|
115
|
+
return this.taskModel.deleteMany({
|
|
116
|
+
_id: { $in: deletingTasks.map((doc) => doc._id) }
|
|
117
|
+
})
|
|
118
|
+
.exec();
|
|
119
|
+
}
|
|
69
120
|
}
|
|
70
121
|
exports.ScheduledTaskMigrationRepo = ScheduledTaskMigrationRepo;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Connection, UpdateWriteOpResult } from 'mongoose';
|
|
2
2
|
import { INextFunction } from '../eventEmitter/task';
|
|
3
3
|
import { factory } from '../factory';
|
|
4
|
-
import {
|
|
4
|
+
import { IDocType } from './mongoose/schemas/task';
|
|
5
5
|
import type { IExecutableTask } from '../taskSettings';
|
|
6
6
|
/**
|
|
7
7
|
* リトライ可能なタスク作成属性
|
|
@@ -13,7 +13,7 @@ type ICreatingTask = Pick<factory.task.IAttributes<factory.taskName>, 'data' | '
|
|
|
13
13
|
* タスクリポジトリ
|
|
14
14
|
*/
|
|
15
15
|
export declare class TaskRepo {
|
|
16
|
-
readonly taskModel
|
|
16
|
+
private readonly taskModel;
|
|
17
17
|
constructor(connection: Connection);
|
|
18
18
|
saveMany(taskAttributes: ICreatingTask[]): Promise<{
|
|
19
19
|
id: string;
|
|
@@ -31,6 +31,23 @@ export declare class TaskRepo {
|
|
|
31
31
|
id: string;
|
|
32
32
|
status: factory.taskStatus;
|
|
33
33
|
} | undefined>;
|
|
34
|
+
/**
|
|
35
|
+
* イベント予約集計タスクの冗長な作成を避けるためのメソッド
|
|
36
|
+
*/
|
|
37
|
+
findReadyAggregateEventTask(params: {
|
|
38
|
+
project: {
|
|
39
|
+
id: string;
|
|
40
|
+
};
|
|
41
|
+
reservationFor: {
|
|
42
|
+
id: string;
|
|
43
|
+
};
|
|
44
|
+
}): Promise<(import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit<import("@chevre/factory/lib/chevre/task").ITask | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/chevre/task/createAccountingReport").ITask | import("@chevre/factory/lib/chevre/task/onAssetTransactionStatusChanged").ITask | import("@chevre/factory/lib/chevre/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/chevre/task/onEventChanged").ITask | import("@chevre/factory/lib/chevre/task/onResourceDeleted").ITask | import("@chevre/factory/lib/chevre/task/onResourceUpdated").ITask | import("@chevre/factory/lib/chevre/task/onOrderPaymentCompleted").ITask | import("@chevre/factory/lib/chevre/task/placeOrder").ITask | import("@chevre/factory/lib/chevre/task/returnOrder").ITask | import("@chevre/factory/lib/chevre/task/returnPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/chevre/task/sendEmailMessage").ITask | import("@chevre/factory/lib/chevre/task/sendOrder").ITask | import("@chevre/factory/lib/chevre/task/triggerWebhook").ITask | import("@chevre/factory/lib/chevre/task/useReservation").ITask | import("@chevre/factory/lib/chevre/task/voidPayTransaction").ITask, "id"> & {
|
|
45
|
+
expires?: Date;
|
|
46
|
+
} & {
|
|
47
|
+
_id: import("mongoose").Types.ObjectId;
|
|
48
|
+
} & {
|
|
49
|
+
__v: number;
|
|
50
|
+
}) | null>;
|
|
34
51
|
/**
|
|
35
52
|
* タスク識別子から冪等作成する
|
|
36
53
|
* reimplement createIfNotExistByIdentifier(2025-03-28~)
|
package/lib/chevre/repo/task.js
CHANGED
|
@@ -87,6 +87,18 @@ class TaskRepo {
|
|
|
87
87
|
const { id, status } = doc;
|
|
88
88
|
return { id, status };
|
|
89
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* イベント予約集計タスクの冗長な作成を避けるためのメソッド
|
|
92
|
+
*/
|
|
93
|
+
async findReadyAggregateEventTask(params) {
|
|
94
|
+
return this.taskModel.findOne({
|
|
95
|
+
'project.id': { $eq: params.project.id },
|
|
96
|
+
name: { $eq: factory_1.factory.taskName.AggregateScreeningEvent },
|
|
97
|
+
status: { $eq: factory_1.factory.taskStatus.Ready },
|
|
98
|
+
'data.id': { $exists: true, $eq: params.reservationFor.id }
|
|
99
|
+
}, { _id: 1 })
|
|
100
|
+
.exec();
|
|
101
|
+
}
|
|
90
102
|
/**
|
|
91
103
|
* タスク識別子から冪等作成する
|
|
92
104
|
* reimplement createIfNotExistByIdentifier(2025-03-28~)
|
package/package.json
CHANGED