@chevre/domain 26.0.0-alpha.27 → 26.0.0-alpha.29
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/lib/chevre/repo/action.d.ts +3 -19
- package/lib/chevre/repo/action.js +0 -298
- package/lib/chevre/repo/adminAssetTransaction.d.ts +0 -6
- package/lib/chevre/repo/adminAssetTransaction.js +0 -13
- package/lib/chevre/repo/adminTask.d.ts +0 -8
- package/lib/chevre/repo/adminTask.js +0 -16
- package/lib/chevre/repo/aggregation.d.ts +0 -8
- package/lib/chevre/repo/aggregation.js +0 -10
- package/lib/chevre/repo/authorization.d.ts +0 -6
- package/lib/chevre/repo/authorization.js +0 -12
- package/lib/chevre/repo/message.d.ts +0 -7
- package/lib/chevre/repo/message.js +0 -38
- package/lib/chevre/repo/mongoose/schemas/action.d.ts +1 -1
- package/lib/chevre/repo/mongoose/schemas/action.js +1 -1
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +85 -76
- package/lib/chevre/repo/mongoose/schemas/updateAction.d.ts +12 -0
- package/lib/chevre/repo/mongoose/schemas/updateAction.js +107 -0
- package/lib/chevre/repo/ticket.d.ts +0 -6
- package/lib/chevre/repo/ticket.js +0 -11
- package/lib/chevre/repo/updateAction.d.ts +56 -0
- package/lib/chevre/repo/updateAction.js +173 -0
- package/lib/chevre/repository.d.ts +5 -0
- package/lib/chevre/repository.js +12 -1
- package/lib/chevre/service/event/processUpdateMovieTheater.d.ts +2 -2
- package/lib/chevre/service/event/processUpdateMovieTheater.js +3 -3
- package/lib/chevre/service/event.d.ts +2 -2
- package/lib/chevre/service/event.js +3 -3
- package/lib/chevre/service/task/deleteTransaction.js +4 -35
- package/lib/chevre/service/task/importEventsFromCOA.js +2 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByAggregateOffer.d.ts +2 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByAggregateOffer.js +4 -4
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByEventSeries.d.ts +2 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByEventSeries.js +4 -4
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByMovieTheater.d.ts +2 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByMovieTheater.js +4 -4
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByOfferCatalog.d.ts +2 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByOfferCatalog.js +4 -4
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByProduct.d.ts +2 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByProduct.js +4 -4
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByRoom.d.ts +2 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesByRoom.js +4 -4
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesBySeller.d.ts +2 -2
- package/lib/chevre/service/task/onResourceDeleted/deleteResourcesBySeller.js +4 -4
- package/lib/chevre/service/task/onResourceDeleted.js +2 -3
- package/lib/chevre/service/task/syncResourcesFromCOA.js +26 -18
- package/lib/chevre/service/transaction/deleteTransaction.d.ts +2 -0
- package/lib/chevre/service/transaction/deleteTransaction.js +3 -3
- package/package.json +2 -2
|
@@ -7,7 +7,7 @@ export { ICancelActionAction };
|
|
|
7
7
|
/**
|
|
8
8
|
* 汎用アクションリポジトリで開始可能なアクションタイプ
|
|
9
9
|
*/
|
|
10
|
-
type StartableActionType = Exclude<factory.actionType, factory.actionType.AcceptAction | factory.actionType.CheckAction | factory.actionType.AuthorizeAction | factory.actionType.PayAction | factory.actionType.RefundAction>;
|
|
10
|
+
type StartableActionType = Exclude<factory.actionType, factory.actionType.AcceptAction | factory.actionType.CheckAction | factory.actionType.AuthorizeAction | factory.actionType.PayAction | factory.actionType.RefundAction | factory.actionType.AddAction | factory.actionType.UpdateAction | factory.actionType.ReplaceAction | factory.actionType.DeleteAction>;
|
|
11
11
|
type IAvailableActionRecipe = IActionRecipe<Exclude<factory.recipe.RecipeCategory, factory.recipe.RecipeCategory.publishPaymentUrl | factory.recipe.RecipeCategory.checkMovieTicket | factory.recipe.RecipeCategory.acceptCOAOffer | factory.recipe.RecipeCategory.authorizeInvoice | factory.recipe.RecipeCategory.authorizeInvoice3ds | factory.recipe.RecipeCategory.payCreditCard | factory.recipe.RecipeCategory.payMovieTicket | factory.recipe.RecipeCategory.refundCreditCard | factory.recipe.RecipeCategory.refundMovieTicket>>;
|
|
12
12
|
export interface IDeleteActionResult {
|
|
13
13
|
identifier: string;
|
|
@@ -68,22 +68,6 @@ export declare class ActionRepo extends ActionProcessRepo<IAction<StartableActio
|
|
|
68
68
|
id: string;
|
|
69
69
|
};
|
|
70
70
|
}): Promise<void>;
|
|
71
|
-
/**
|
|
72
|
-
* 開始日時を一定期間過ぎたアクションを削除する
|
|
73
|
-
*/
|
|
74
|
-
deleteStartDatePassedCertainPeriod(params: {
|
|
75
|
-
$lt: Date;
|
|
76
|
-
}): Promise<import("mongodb").DeleteResult>;
|
|
77
|
-
/**
|
|
78
|
-
* 終了日時を一定期間過ぎたアクションを削除する
|
|
79
|
-
* 作成日時を一定期間過ぎたアクションレシピも削除する
|
|
80
|
-
*/
|
|
81
|
-
deleteEndDatePassedCertainPeriod(params: {
|
|
82
|
-
$lt: Date;
|
|
83
|
-
}): Promise<{
|
|
84
|
-
deleteActionRecipesResult: import("mongodb").DeleteResult;
|
|
85
|
-
deleteActionsResult: import("mongodb").DeleteResult;
|
|
86
|
-
} | undefined>;
|
|
87
71
|
/**
|
|
88
72
|
* 取引からアクションを削除する
|
|
89
73
|
*/
|
|
@@ -99,13 +83,13 @@ export declare class ActionRepo extends ActionProcessRepo<IAction<StartableActio
|
|
|
99
83
|
$in: factory.actionType[];
|
|
100
84
|
};
|
|
101
85
|
}): Promise<IDeleteActionResult[]>;
|
|
102
|
-
getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit<import("@chevre/factory/lib/chevre/action").IAction<import("@chevre/factory/lib/chevre/action").IAttributes<factory.actionType, any, any>>, "id"> & {
|
|
86
|
+
getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit<import("@chevre/factory/lib/chevre/action").IAction<import("@chevre/factory/lib/chevre/action").IAttributes<factory.actionType, any, any>>, "id" | "replacer"> & {
|
|
103
87
|
identifier?: string;
|
|
104
88
|
} & {
|
|
105
89
|
_id: import("mongoose").Types.ObjectId;
|
|
106
90
|
} & {
|
|
107
91
|
__v: number;
|
|
108
|
-
}, import("mongoose").QueryOptions<IDocType>, (import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit<import("@chevre/factory/lib/chevre/action").IAction<import("@chevre/factory/lib/chevre/action").IAttributes<factory.actionType, any, any>>, "id"> & {
|
|
92
|
+
}, import("mongoose").QueryOptions<IDocType>, (import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit<import("@chevre/factory/lib/chevre/action").IAction<import("@chevre/factory/lib/chevre/action").IAttributes<factory.actionType, any, any>>, "id" | "replacer"> & {
|
|
109
93
|
identifier?: string;
|
|
110
94
|
} & {
|
|
111
95
|
_id: import("mongoose").Types.ObjectId;
|
|
@@ -1,282 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.ActionRepo = void 0;
|
|
7
|
-
const moment_1 = __importDefault(require("moment"));
|
|
8
4
|
const factory_1 = require("../factory");
|
|
9
|
-
// import { createSchema as createRecipeSchema, IModel as IActionRecipeModel, modelName as recipeModelName } from './mongoose/schemas/actionRecipe';
|
|
10
5
|
const actionProcess_1 = require("./action/actionProcess");
|
|
11
6
|
/**
|
|
12
7
|
* アクションリポジトリ
|
|
13
8
|
*/
|
|
14
9
|
class ActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
15
|
-
// private readonly actionModel: IActionModel;
|
|
16
|
-
// private readonly actionRecipeModel: IActionRecipeModel;
|
|
17
|
-
// constructor(connection: Connection) {
|
|
18
|
-
// this.actionModel = connection.model(modelName, createSchema());
|
|
19
|
-
// this.actionRecipeModel = connection.model(recipeModelName, createRecipeSchema());
|
|
20
|
-
// }
|
|
21
10
|
/**
|
|
22
11
|
* 汎用アクション検索
|
|
23
12
|
*/
|
|
24
13
|
async findActionsByType(params, inclusion) {
|
|
25
14
|
return (this.findAnyActions(params, inclusion));
|
|
26
15
|
}
|
|
27
|
-
// /**
|
|
28
|
-
// * アクション開始
|
|
29
|
-
// */
|
|
30
|
-
// public async start<T extends factory.actionType>(
|
|
31
|
-
// attributes: factory.action.IAttributes<T, any, any>,
|
|
32
|
-
// options?: {
|
|
33
|
-
// recipe?: IRecipeAsActionAttributes;
|
|
34
|
-
// }
|
|
35
|
-
// ): Promise<Pick<IAction<T>, 'id' | 'typeOf' | 'startDate'>> {
|
|
36
|
-
// const startDate = new Date();
|
|
37
|
-
// const creatingAction: Omit<factory.action.IAction<factory.action.IAttributes<T, any, any>>, 'id'> = {
|
|
38
|
-
// ...attributes,
|
|
39
|
-
// actionStatus: factory.actionStatusType.ActiveActionStatus,
|
|
40
|
-
// startDate
|
|
41
|
-
// };s
|
|
42
|
-
// // reimplemnt with insertMany(2024-08-29~)
|
|
43
|
-
// const result = await this.actionModel.insertMany(creatingAction, { rawResult: true });
|
|
44
|
-
// const id = result.insertedIds?.[0]?.toHexString();
|
|
45
|
-
// if (typeof id !== 'string') {
|
|
46
|
-
// throw new factory.errors.Internal('action not saved');
|
|
47
|
-
// }
|
|
48
|
-
// // add recipe(2024-06-09~)
|
|
49
|
-
// const savingRecipe = options?.recipe;
|
|
50
|
-
// if (savingRecipe?.typeOf === 'Recipe') {
|
|
51
|
-
// await this.upsertRecipe({ ...savingRecipe, recipeFor: { id, typeOf: creatingAction.typeOf } });
|
|
52
|
-
// }
|
|
53
|
-
// return { id, startDate, typeOf: creatingAction.typeOf };
|
|
54
|
-
// }
|
|
55
|
-
// public async completeWithVoid(params: {
|
|
56
|
-
// typeOf: factory.actionType;
|
|
57
|
-
// id: string;
|
|
58
|
-
// result: any;
|
|
59
|
-
// recipe?: IRecipeAsActionAttributes;
|
|
60
|
-
// }): Promise<void> {
|
|
61
|
-
// if (params.recipe?.typeOf === 'Recipe') {
|
|
62
|
-
// await this.upsertRecipe({ ...params.recipe, recipeFor: { id: params.id, typeOf: params.typeOf } });
|
|
63
|
-
// }
|
|
64
|
-
// const doc = await this.actionModel.findOneAndUpdate(
|
|
65
|
-
// {
|
|
66
|
-
// _id: { $eq: params.id },
|
|
67
|
-
// typeOf: { $eq: params.typeOf }
|
|
68
|
-
// },
|
|
69
|
-
// {
|
|
70
|
-
// $set: {
|
|
71
|
-
// actionStatus: factory.actionStatusType.CompletedActionStatus,
|
|
72
|
-
// result: params.result,
|
|
73
|
-
// endDate: new Date()
|
|
74
|
-
// }
|
|
75
|
-
// },
|
|
76
|
-
// { new: false, projection: { _id: 1 } }
|
|
77
|
-
// )
|
|
78
|
-
// .lean<{ _id: ObjectId }>()
|
|
79
|
-
// .exec();
|
|
80
|
-
// if (doc === null) {
|
|
81
|
-
// throw new factory.errors.NotFound(this.actionModel.modelName);
|
|
82
|
-
// }
|
|
83
|
-
// }
|
|
84
|
-
// /**
|
|
85
|
-
// * アクション取消
|
|
86
|
-
// */
|
|
87
|
-
// public async cancelWithVoid(params: {
|
|
88
|
-
// typeOf: factory.actionType.AcceptAction | factory.actionType.AuthorizeAction; // 現時点でAcceptAction,AuthorizeActionのみ対応
|
|
89
|
-
// id: string;
|
|
90
|
-
// cancelAction?: Pick<ICancelActionAction, 'agent' | 'sameAs' | 'startTime'>;
|
|
91
|
-
// }): Promise<void> {
|
|
92
|
-
// const cancelDate = new Date();
|
|
93
|
-
// const cancelAction: ICancelActionAction | undefined = (params.cancelAction !== undefined)
|
|
94
|
-
// ? {
|
|
95
|
-
// ...params.cancelAction,
|
|
96
|
-
// endTime: cancelDate,
|
|
97
|
-
// typeOf: factory.actionType.CancelAction
|
|
98
|
-
// }
|
|
99
|
-
// : undefined;
|
|
100
|
-
// const doc = await this.actionModel.findOneAndUpdate(
|
|
101
|
-
// {
|
|
102
|
-
// _id: { $eq: params.id },
|
|
103
|
-
// typeOf: { $eq: params.typeOf },
|
|
104
|
-
// actionStatus: { $ne: factory.actionStatusType.CanceledActionStatus } // 冪等性確保(2024-05-26~)
|
|
105
|
-
// },
|
|
106
|
-
// {
|
|
107
|
-
// $set: {
|
|
108
|
-
// actionStatus: factory.actionStatusType.CanceledActionStatus,
|
|
109
|
-
// ...(cancelAction !== undefined) ? { cancelAction } : undefined // cancelAction連携(2024-05-26~)
|
|
110
|
-
// }
|
|
111
|
-
// },
|
|
112
|
-
// { new: false, projection: { _id: 1 } }
|
|
113
|
-
// )
|
|
114
|
-
// .lean<{ _id: ObjectId }>()
|
|
115
|
-
// .exec();
|
|
116
|
-
// if (doc === null) {
|
|
117
|
-
// // 既にCanceledActionStatusであればok
|
|
118
|
-
// const existingAction = <Pick<IAction<typeof params.typeOf>, 'actionStatus'>>
|
|
119
|
-
// await this.findById({ id: params.id, typeOf: params.typeOf }, ['actionStatus'], []);
|
|
120
|
-
// if (existingAction.actionStatus !== factory.actionStatusType.CanceledActionStatus) {
|
|
121
|
-
// throw new factory.errors.NotFound(this.actionModel.modelName);
|
|
122
|
-
// }
|
|
123
|
-
// }
|
|
124
|
-
// // endDateが存在しなければセット(2024-04-22~)
|
|
125
|
-
// await this.actionModel.updateOne(
|
|
126
|
-
// {
|
|
127
|
-
// _id: { $eq: params.id },
|
|
128
|
-
// endDate: { $exists: false }
|
|
129
|
-
// },
|
|
130
|
-
// { $set: { endDate: cancelDate } }
|
|
131
|
-
// )
|
|
132
|
-
// .exec();
|
|
133
|
-
// }
|
|
134
|
-
// /**
|
|
135
|
-
// * アクション失敗
|
|
136
|
-
// */
|
|
137
|
-
// public async giveUp(params: {
|
|
138
|
-
// typeOf: factory.actionType;
|
|
139
|
-
// id: string;
|
|
140
|
-
// error: Error | Error[];
|
|
141
|
-
// recipe?: IRecipeAsActionAttributes;
|
|
142
|
-
// }): Promise<void> {
|
|
143
|
-
// const actionError: IActionError | IActionError[] = (Array.isArray(params.error))
|
|
144
|
-
// ? params.error.map((e) => ({ ...e, message: e.message, name: e.name }))
|
|
145
|
-
// : { ...params.error, message: params.error.message, name: params.error.name };
|
|
146
|
-
// if (params.recipe?.typeOf === 'Recipe') {
|
|
147
|
-
// await this.upsertRecipe({ ...params.recipe, recipeFor: { id: params.id, typeOf: params.typeOf } });
|
|
148
|
-
// }
|
|
149
|
-
// const doc = await this.actionModel.findOneAndUpdate(
|
|
150
|
-
// {
|
|
151
|
-
// typeOf: { $eq: params.typeOf },
|
|
152
|
-
// _id: { $eq: params.id }
|
|
153
|
-
// },
|
|
154
|
-
// {
|
|
155
|
-
// $set: {
|
|
156
|
-
// actionStatus: factory.actionStatusType.FailedActionStatus,
|
|
157
|
-
// error: actionError,
|
|
158
|
-
// endDate: new Date()
|
|
159
|
-
// }
|
|
160
|
-
// },
|
|
161
|
-
// { new: true, projection: { _id: 1 } }
|
|
162
|
-
// )
|
|
163
|
-
// .lean<{ _id: ObjectId }>()
|
|
164
|
-
// .exec();
|
|
165
|
-
// if (doc === null) {
|
|
166
|
-
// throw new factory.errors.NotFound(this.actionModel.modelName);
|
|
167
|
-
// }
|
|
168
|
-
// }
|
|
169
|
-
// /**
|
|
170
|
-
// * アクション再開
|
|
171
|
-
// */
|
|
172
|
-
// public async reStart(params: {
|
|
173
|
-
// typeOf: factory.actionType;
|
|
174
|
-
// id: string;
|
|
175
|
-
// recipe?: IRecipeAsActionAttributes;
|
|
176
|
-
// }): Promise<void> {
|
|
177
|
-
// const doc = await this.actionModel.findOneAndUpdate(
|
|
178
|
-
// {
|
|
179
|
-
// _id: { $eq: params.id },
|
|
180
|
-
// typeOf: { $eq: params.typeOf },
|
|
181
|
-
// actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus }
|
|
182
|
-
// },
|
|
183
|
-
// {
|
|
184
|
-
// $set: {
|
|
185
|
-
// actionStatus: factory.actionStatusType.ActiveActionStatus,
|
|
186
|
-
// startDate: new Date()
|
|
187
|
-
// },
|
|
188
|
-
// $unset: { endDate: 1 }
|
|
189
|
-
// },
|
|
190
|
-
// { new: false, projection: { _id: 1 } }
|
|
191
|
-
// )
|
|
192
|
-
// .lean<{ _id: ObjectId }>()
|
|
193
|
-
// .exec();
|
|
194
|
-
// if (doc === null) {
|
|
195
|
-
// throw new factory.errors.NotFound(this.actionModel.modelName);
|
|
196
|
-
// }
|
|
197
|
-
// // add recipe(2024-06-09~)
|
|
198
|
-
// if (params.recipe?.typeOf === 'Recipe') {
|
|
199
|
-
// await this.upsertRecipe({ ...params.recipe, recipeFor: { id: params.id, typeOf: params.typeOf } });
|
|
200
|
-
// }
|
|
201
|
-
// }
|
|
202
|
-
// /**
|
|
203
|
-
// * 一定期間ActiveActionStatusのアクションをFailedActionStatusにする
|
|
204
|
-
// */
|
|
205
|
-
// public async giveUpStartDatePassedCertainPeriod(params: {
|
|
206
|
-
// id?: { $eq?: string };
|
|
207
|
-
// error: any;
|
|
208
|
-
// startDate: { $lt: Date };
|
|
209
|
-
// }): Promise<any> {
|
|
210
|
-
// return this.actionModel.updateMany(
|
|
211
|
-
// {
|
|
212
|
-
// actionStatus: { $eq: factory.actionStatusType.ActiveActionStatus },
|
|
213
|
-
// // 一定期間過ぎたもの
|
|
214
|
-
// startDate: { $lt: params.startDate.$lt },
|
|
215
|
-
// ...(typeof params.id?.$eq === 'string') ? { _id: { $eq: params.id.$eq } } : undefined
|
|
216
|
-
// },
|
|
217
|
-
// {
|
|
218
|
-
// actionStatus: factory.actionStatusType.FailedActionStatus,
|
|
219
|
-
// error: params.error,
|
|
220
|
-
// endDate: new Date()
|
|
221
|
-
// }
|
|
222
|
-
// )
|
|
223
|
-
// .exec();
|
|
224
|
-
// }
|
|
225
|
-
// public async findById<T extends factory.actionType>(
|
|
226
|
-
// params: {
|
|
227
|
-
// typeOf: T;
|
|
228
|
-
// id: string;
|
|
229
|
-
// },
|
|
230
|
-
// inclusion?: IKeyOfProjection[],
|
|
231
|
-
// exclusion?: IKeyOfProjection[]
|
|
232
|
-
// ): Promise<IAction<T>> {
|
|
233
|
-
// let positiveProjectionFields: IKeyOfProjection[] = AVAILABLE_PROJECT_FIELDS;
|
|
234
|
-
// if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
235
|
-
// positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
236
|
-
// } else {
|
|
237
|
-
// if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
238
|
-
// positiveProjectionFields = positiveProjectionFields.filter((key) => !exclusion.includes(key));
|
|
239
|
-
// }
|
|
240
|
-
// }
|
|
241
|
-
// const projection: ProjectionType<IAction<T>> = {
|
|
242
|
-
// _id: 0,
|
|
243
|
-
// id: { $toString: '$_id' },
|
|
244
|
-
// ...Object.fromEntries<1>(positiveProjectionFields.map((key) => ([key, 1])))
|
|
245
|
-
// };
|
|
246
|
-
// const doc = await this.actionModel.findOne(
|
|
247
|
-
// {
|
|
248
|
-
// typeOf: { $eq: params.typeOf },
|
|
249
|
-
// _id: { $eq: params.id }
|
|
250
|
-
// },
|
|
251
|
-
// projection
|
|
252
|
-
// )
|
|
253
|
-
// .lean<IAction<T>>() // 2024-08-26~
|
|
254
|
-
// .exec();
|
|
255
|
-
// if (doc === null) {
|
|
256
|
-
// throw new factory.errors.NotFound(this.actionModel.modelName);
|
|
257
|
-
// }
|
|
258
|
-
// return doc;
|
|
259
|
-
// }
|
|
260
|
-
// public async findPayAction(params: {
|
|
261
|
-
// project: { id: string };
|
|
262
|
-
// paymentMethodId: string;
|
|
263
|
-
// actionStatus?: { $in?: factory.actionStatusType[] };
|
|
264
|
-
// }): Promise<factory.action.trade.pay.IAction | undefined> {
|
|
265
|
-
// const payActions = await this.findActionsByType<factory.actionType.PayAction>(
|
|
266
|
-
// {
|
|
267
|
-
// limit: 1,
|
|
268
|
-
// page: 1,
|
|
269
|
-
// actionStatus: (Array.isArray(params.actionStatus?.$in))
|
|
270
|
-
// ? { $in: params.actionStatus?.$in }
|
|
271
|
-
// : { $in: [factory.actionStatusType.CompletedActionStatus] },
|
|
272
|
-
// project: { id: { $eq: params.project.id } },
|
|
273
|
-
// typeOf: { $eq: factory.actionType.PayAction },
|
|
274
|
-
// object: { paymentMethod: { paymentMethodId: { $eq: params.paymentMethodId } } }
|
|
275
|
-
// },
|
|
276
|
-
// []
|
|
277
|
-
// ) as factory.action.trade.pay.IAction[];
|
|
278
|
-
// return payActions.shift();
|
|
279
|
-
// }
|
|
280
16
|
/**
|
|
281
17
|
* 取引に対するアクションを検索する
|
|
282
18
|
*/
|
|
@@ -374,40 +110,6 @@ class ActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
|
374
110
|
})
|
|
375
111
|
.exec();
|
|
376
112
|
}
|
|
377
|
-
/**
|
|
378
|
-
* 開始日時を一定期間過ぎたアクションを削除する
|
|
379
|
-
*/
|
|
380
|
-
async deleteStartDatePassedCertainPeriod(params) {
|
|
381
|
-
return this.actionModel.deleteMany({
|
|
382
|
-
startDate: {
|
|
383
|
-
$lt: params.$lt
|
|
384
|
-
}
|
|
385
|
-
})
|
|
386
|
-
.exec();
|
|
387
|
-
}
|
|
388
|
-
/**
|
|
389
|
-
* 終了日時を一定期間過ぎたアクションを削除する
|
|
390
|
-
* 作成日時を一定期間過ぎたアクションレシピも削除する
|
|
391
|
-
*/
|
|
392
|
-
async deleteEndDatePassedCertainPeriod(params) {
|
|
393
|
-
const { $lt } = params;
|
|
394
|
-
if ($lt instanceof Date) {
|
|
395
|
-
const deleteActionsResult = await this.actionModel.deleteMany({
|
|
396
|
-
// 終了日時を一定期間過ぎたもの
|
|
397
|
-
endDate: { $exists: true, $lt }
|
|
398
|
-
})
|
|
399
|
-
.exec();
|
|
400
|
-
// clean actionRecipes(2025-01-10~)
|
|
401
|
-
const dateCreatedLt = (0, moment_1.default)($lt)
|
|
402
|
-
.add(-1, 'day') // レシピ作成とアクション終了の時間差を考慮
|
|
403
|
-
.toDate();
|
|
404
|
-
const deleteActionRecipesResult = await this.actionRecipeModel.deleteMany({
|
|
405
|
-
dateCreated: { $lt: dateCreatedLt }
|
|
406
|
-
})
|
|
407
|
-
.exec();
|
|
408
|
-
return { deleteActionRecipesResult, deleteActionsResult };
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
113
|
/**
|
|
412
114
|
* 取引からアクションを削除する
|
|
413
115
|
*/
|
|
@@ -53,12 +53,6 @@ export declare class AdminAssetTransactionRepo {
|
|
|
53
53
|
* 取引を検索する
|
|
54
54
|
*/
|
|
55
55
|
findAssetTransactions<T extends AvailableAssetTransactionType>(params: factory.assetTransaction.ISearchConditions<T>, inclusion?: string[], exclusion?: string[]): Promise<factory.assetTransaction.ITransaction<T>[]>;
|
|
56
|
-
/**
|
|
57
|
-
* 終了日時を一定期間過ぎたアクションを削除する
|
|
58
|
-
*/
|
|
59
|
-
deleteEndDatePassedCertainPeriod(params: {
|
|
60
|
-
$lt: Date;
|
|
61
|
-
}): Promise<import("mongodb").DeleteResult>;
|
|
62
56
|
getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & ((import("@chevre/factory/lib/chevre/assetTransaction/cancelReservation").IAttributes & {
|
|
63
57
|
id: string;
|
|
64
58
|
} & {
|
|
@@ -477,19 +477,6 @@ class AdminAssetTransactionRepo {
|
|
|
477
477
|
.exec()
|
|
478
478
|
.then((docs) => docs.map((doc) => doc.toObject()));
|
|
479
479
|
}
|
|
480
|
-
/**
|
|
481
|
-
* 終了日時を一定期間過ぎたアクションを削除する
|
|
482
|
-
*/
|
|
483
|
-
async deleteEndDatePassedCertainPeriod(params) {
|
|
484
|
-
return this.transactionModel.deleteMany({
|
|
485
|
-
// 終了日時を一定期間過ぎたもの
|
|
486
|
-
endDate: {
|
|
487
|
-
$exists: true,
|
|
488
|
-
$lt: params.$lt
|
|
489
|
-
}
|
|
490
|
-
})
|
|
491
|
-
.exec();
|
|
492
|
-
}
|
|
493
480
|
getCursor(conditions, projection) {
|
|
494
481
|
return this.transactionModel.find(conditions, projection)
|
|
495
482
|
// .sort({ startDate: factory.sortType.Ascending })
|
|
@@ -33,14 +33,6 @@ export declare class AdminTaskRepo {
|
|
|
33
33
|
}): Promise<{
|
|
34
34
|
count: number;
|
|
35
35
|
}>;
|
|
36
|
-
/**
|
|
37
|
-
* 不要なタスクを削除する
|
|
38
|
-
*/
|
|
39
|
-
deleteRunsAtPassedCertainPeriod(params: {
|
|
40
|
-
runsAt: {
|
|
41
|
-
$lt: Date;
|
|
42
|
-
};
|
|
43
|
-
}): Promise<import("mongodb").DeleteResult>;
|
|
44
36
|
getCursor(conditions: FilterQuery<factory.task.ITask<factory.taskName>>, projection: ProjectionType<factory.task.ITask<factory.taskName>>): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Pick<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, "name" | "description" | "project" | "identifier" | "data" | "status" | "runsAt" | "dateAborted" | "executionResults" | "executor" | "lastTriedAt" | "remainingNumberOfTries" | "numberOfTried"> & {
|
|
45
37
|
expires?: never;
|
|
46
38
|
} & {
|
|
@@ -149,22 +149,6 @@ class AdminTaskRepo {
|
|
|
149
149
|
.exec();
|
|
150
150
|
return { count };
|
|
151
151
|
}
|
|
152
|
-
/**
|
|
153
|
-
* 不要なタスクを削除する
|
|
154
|
-
*/
|
|
155
|
-
async deleteRunsAtPassedCertainPeriod(params) {
|
|
156
|
-
return this.taskModel.deleteMany({
|
|
157
|
-
runsAt: { $lt: params.runsAt.$lt },
|
|
158
|
-
status: {
|
|
159
|
-
$in: [
|
|
160
|
-
factory_1.factory.taskStatus.Aborted,
|
|
161
|
-
factory_1.factory.taskStatus.Executed,
|
|
162
|
-
// factory.taskStatus.Expired // discontinue(2026-08-06~)
|
|
163
|
-
]
|
|
164
|
-
}
|
|
165
|
-
})
|
|
166
|
-
.exec();
|
|
167
|
-
}
|
|
168
152
|
getCursor(conditions, projection) {
|
|
169
153
|
return this.taskModel.find(conditions, projection)
|
|
170
154
|
.sort({ runsAt: factory_1.factory.sortType.Ascending })
|
|
@@ -22,14 +22,6 @@ export declare class AggregationRepo {
|
|
|
22
22
|
$lte?: Date;
|
|
23
23
|
};
|
|
24
24
|
}): Promise<IAggregation[]>;
|
|
25
|
-
/**
|
|
26
|
-
* 不要な集計を削除する
|
|
27
|
-
*/
|
|
28
|
-
deleteAggregateStartPassedCertainPeriod(params: {
|
|
29
|
-
aggregateStart: {
|
|
30
|
-
$lt: Date;
|
|
31
|
-
};
|
|
32
|
-
}): Promise<import("mongodb").DeleteResult>;
|
|
33
25
|
unsetUnnecessaryFields(params: {
|
|
34
26
|
filter: any;
|
|
35
27
|
$unset: any;
|
|
@@ -47,16 +47,6 @@ class AggregationRepo {
|
|
|
47
47
|
.sort({ aggregateStart: factory_1.factory.sortType.Ascending })
|
|
48
48
|
.exec();
|
|
49
49
|
}
|
|
50
|
-
/**
|
|
51
|
-
* 不要な集計を削除する
|
|
52
|
-
*/
|
|
53
|
-
async deleteAggregateStartPassedCertainPeriod(params) {
|
|
54
|
-
const filter = {
|
|
55
|
-
aggregateStart: { $lt: params.aggregateStart.$lt }
|
|
56
|
-
};
|
|
57
|
-
return this.aggregationModel.deleteMany(filter)
|
|
58
|
-
.exec();
|
|
59
|
-
}
|
|
60
50
|
async unsetUnnecessaryFields(params) {
|
|
61
51
|
return this.aggregationModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
|
|
62
52
|
.exec();
|
|
@@ -41,12 +41,6 @@ export declare class AuthorizationRepo {
|
|
|
41
41
|
projectFields(params: factory.authorization.ISearchConditions, inclusion: IKeyOfProjection[]): Promise<(factory.authorization.IAuthorization & {
|
|
42
42
|
id: string;
|
|
43
43
|
})[]>;
|
|
44
|
-
/**
|
|
45
|
-
* 有効期限を一定期間過ぎた承認を削除する
|
|
46
|
-
*/
|
|
47
|
-
deleteValidUntilPassedCertainPeriod(params: {
|
|
48
|
-
$lt: Date;
|
|
49
|
-
}): Promise<void>;
|
|
50
44
|
unsetUnnecessaryFields(params: {
|
|
51
45
|
filter: FilterQuery<factory.authorization.IAuthorization>;
|
|
52
46
|
$unset: any;
|
|
@@ -177,18 +177,6 @@ class AuthorizationRepo {
|
|
|
177
177
|
.lean()
|
|
178
178
|
.exec();
|
|
179
179
|
}
|
|
180
|
-
/**
|
|
181
|
-
* 有効期限を一定期間過ぎた承認を削除する
|
|
182
|
-
*/
|
|
183
|
-
async deleteValidUntilPassedCertainPeriod(params) {
|
|
184
|
-
await this.authorizationModel.deleteMany({
|
|
185
|
-
validUntil: {
|
|
186
|
-
$exists: true,
|
|
187
|
-
$lt: params.$lt
|
|
188
|
-
}
|
|
189
|
-
})
|
|
190
|
-
.exec();
|
|
191
|
-
}
|
|
192
180
|
async unsetUnnecessaryFields(params) {
|
|
193
181
|
return this.authorizationModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
|
|
194
182
|
.exec();
|
|
@@ -59,13 +59,6 @@ export declare class MessageRepo {
|
|
|
59
59
|
id: string;
|
|
60
60
|
};
|
|
61
61
|
}): Promise<IFindByIdentifierResult>;
|
|
62
|
-
/**
|
|
63
|
-
* 発行日時を基準に複数削除
|
|
64
|
-
* 2026-06-28~
|
|
65
|
-
*/
|
|
66
|
-
deleteDatePublishedPassedCertainPeriod(params: {
|
|
67
|
-
$lt: Date;
|
|
68
|
-
}): Promise<void>;
|
|
69
62
|
unsetUnnecessaryFields(params: {
|
|
70
63
|
filter: any;
|
|
71
64
|
$unset: any;
|
|
@@ -160,44 +160,6 @@ class MessageRepo {
|
|
|
160
160
|
}
|
|
161
161
|
return doc;
|
|
162
162
|
}
|
|
163
|
-
/**
|
|
164
|
-
* 発行日時を基準に複数削除
|
|
165
|
-
* 2026-06-28~
|
|
166
|
-
*/
|
|
167
|
-
async deleteDatePublishedPassedCertainPeriod(params) {
|
|
168
|
-
const { $lt } = params;
|
|
169
|
-
if ($lt instanceof Date) {
|
|
170
|
-
await this.messageModel.deleteMany({
|
|
171
|
-
datePublished: { $lt }
|
|
172
|
-
})
|
|
173
|
-
.exec();
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
// public async deleteByMainEntityOrderNumber(params: {
|
|
177
|
-
// project: { id: string };
|
|
178
|
-
// mainEntity: { orderNumber: string };
|
|
179
|
-
// }): Promise<{
|
|
180
|
-
// n?: number;
|
|
181
|
-
// // opTime: result.opTime,
|
|
182
|
-
// ok?: number;
|
|
183
|
-
// // operationTime,
|
|
184
|
-
// deletedCount?: number;
|
|
185
|
-
// } | null> {
|
|
186
|
-
// return this.messageModel.deleteMany({
|
|
187
|
-
// 'project.id': { $eq: params.project.id },
|
|
188
|
-
// 'mainEntity.orderNumber': { $exists: true, $eq: params.mainEntity.orderNumber }
|
|
189
|
-
// })
|
|
190
|
-
// .exec()
|
|
191
|
-
// .then((result) => {
|
|
192
|
-
// return {
|
|
193
|
-
// // n: result?.n,
|
|
194
|
-
// // opTime: result.opTime,
|
|
195
|
-
// // ok: result?.ok,
|
|
196
|
-
// // operationTime,
|
|
197
|
-
// deletedCount: result?.deletedCount
|
|
198
|
-
// };
|
|
199
|
-
// });
|
|
200
|
-
// }
|
|
201
163
|
async unsetUnnecessaryFields(params) {
|
|
202
164
|
return this.messageModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
|
|
203
165
|
.exec();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
|
|
2
2
|
import { IVirtuals } from '../virtuals';
|
|
3
3
|
import { factory } from '../../../factory';
|
|
4
|
-
type IDocType = Omit<factory.action.IAction<factory.action.IAttributes<factory.actionType, any, any>>, 'id'> & {
|
|
4
|
+
type IDocType = Omit<factory.action.IAction<factory.action.IAttributes<factory.actionType, any, any>>, 'id' | 'replacer'> & {
|
|
5
5
|
identifier?: string;
|
|
6
6
|
};
|
|
7
7
|
type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
|
|
@@ -26,7 +26,7 @@ const schemaDefinition = {
|
|
|
26
26
|
// toLocation: SchemaTypes.Mixed, // discontinue(2026-07-08~)
|
|
27
27
|
instrument: mongoose_1.SchemaTypes.Mixed,
|
|
28
28
|
location: mongoose_1.SchemaTypes.Mixed, // add location(2022-11-11~)
|
|
29
|
-
replacer:
|
|
29
|
+
// replacer: SchemaTypes.Mixed, // add replacer(2024-03-19~)
|
|
30
30
|
targetCollection: mongoose_1.SchemaTypes.Mixed, // add targetCollection(2024-03-19~)
|
|
31
31
|
sameAs: mongoose_1.SchemaTypes.Mixed, // タスク関連付けのために追加(2024-04-20~)
|
|
32
32
|
cancelAction: mongoose_1.SchemaTypes.Mixed, // add(2024-05-26~)
|