@chevre/domain 26.0.0-alpha.28 → 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 -38
- 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/updateAction.d.ts +2 -5
- package/lib/chevre/repo/mongoose/schemas/updateAction.js +50 -8
- package/lib/chevre/repo/ticket.d.ts +0 -6
- package/lib/chevre/repo/ticket.js +0 -11
- package/lib/chevre/repo/updateAction.d.ts +14 -10
- package/lib/chevre/repo/updateAction.js +15 -271
- package/lib/chevre/service/task/deleteTransaction.js +4 -35
- 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 +16 -8
- 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 | factory.actionType.AddAction | factory.actionType.UpdateAction | factory.actionType.ReplaceAction>;
|
|
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,10 +1,6 @@
|
|
|
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
5
|
const actionProcess_1 = require("./action/actionProcess");
|
|
10
6
|
/**
|
|
@@ -114,40 +110,6 @@ class ActionRepo extends actionProcess_1.ActionProcessRepo {
|
|
|
114
110
|
})
|
|
115
111
|
.exec();
|
|
116
112
|
}
|
|
117
|
-
/**
|
|
118
|
-
* 開始日時を一定期間過ぎたアクションを削除する
|
|
119
|
-
*/
|
|
120
|
-
async deleteStartDatePassedCertainPeriod(params) {
|
|
121
|
-
return this.actionModel.deleteMany({
|
|
122
|
-
startDate: {
|
|
123
|
-
$lt: params.$lt
|
|
124
|
-
}
|
|
125
|
-
})
|
|
126
|
-
.exec();
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* 終了日時を一定期間過ぎたアクションを削除する
|
|
130
|
-
* 作成日時を一定期間過ぎたアクションレシピも削除する
|
|
131
|
-
*/
|
|
132
|
-
async deleteEndDatePassedCertainPeriod(params) {
|
|
133
|
-
const { $lt } = params;
|
|
134
|
-
if ($lt instanceof Date) {
|
|
135
|
-
const deleteActionsResult = await this.actionModel.deleteMany({
|
|
136
|
-
// 終了日時を一定期間過ぎたもの
|
|
137
|
-
endDate: { $exists: true, $lt }
|
|
138
|
-
})
|
|
139
|
-
.exec();
|
|
140
|
-
// clean actionRecipes(2025-01-10~)
|
|
141
|
-
const dateCreatedLt = (0, moment_1.default)($lt)
|
|
142
|
-
.add(-1, 'day') // レシピ作成とアクション終了の時間差を考慮
|
|
143
|
-
.toDate();
|
|
144
|
-
const deleteActionRecipesResult = await this.actionRecipeModel.deleteMany({
|
|
145
|
-
dateCreated: { $lt: dateCreatedLt }
|
|
146
|
-
})
|
|
147
|
-
.exec();
|
|
148
|
-
return { deleteActionRecipesResult, deleteActionsResult };
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
113
|
/**
|
|
152
114
|
* 取引からアクションを削除する
|
|
153
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~)
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
|
|
2
2
|
import { IVirtuals } from '../virtuals';
|
|
3
3
|
import { factory } from '../../../factory';
|
|
4
|
-
type
|
|
5
|
-
|
|
6
|
-
} | Omit<factory.action.update.replace.IAction, 'id' | 'potentialActions' | 'purpose'> | Omit<factory.action.update.update.IAction, 'id' | 'potentialActions' | 'purpose'> & {
|
|
7
|
-
replacer?: never;
|
|
8
|
-
};
|
|
4
|
+
type Keys = 'actionStatus' | 'agent' | 'endDate' | 'error' | 'instrument' | 'object' | 'project' | 'result' | 'sameAs' | 'startDate' | 'targetCollection' | 'typeOf';
|
|
5
|
+
type IDocType = Pick<factory.action.update.add.IAction, Keys> | Pick<factory.action.update.replace.IAction, Keys> | Pick<factory.action.update.update.IAction, Keys> | Pick<factory.action.update.deleteAction.IAction, Keys>;
|
|
9
6
|
type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
|
|
10
7
|
type ISchemaDefinition = SchemaDefinition<IDocType>;
|
|
11
8
|
type ISchema = Schema<IDocType, IModel, Record<string, never>, Record<string, never>, IVirtuals, Record<string, never>, ISchemaDefinition, IDocType>;
|
|
@@ -8,17 +8,16 @@ const settings_1 = require("../../../settings");
|
|
|
8
8
|
const modelName = 'UpdateAction';
|
|
9
9
|
exports.modelName = modelName;
|
|
10
10
|
const schemaDefinition = {
|
|
11
|
-
project: mongoose_1.SchemaTypes.Mixed,
|
|
12
|
-
actionStatus: String,
|
|
13
|
-
typeOf: String,
|
|
14
|
-
agent: mongoose_1.SchemaTypes.Mixed,
|
|
11
|
+
project: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
12
|
+
actionStatus: { type: String, required: true },
|
|
13
|
+
typeOf: { type: String, required: true },
|
|
14
|
+
agent: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
15
|
+
object: { type: mongoose_1.SchemaTypes.Mixed, required: true },
|
|
16
|
+
startDate: { type: Date, required: true },
|
|
15
17
|
result: mongoose_1.SchemaTypes.Mixed,
|
|
16
18
|
error: mongoose_1.SchemaTypes.Mixed,
|
|
17
|
-
object: mongoose_1.SchemaTypes.Mixed,
|
|
18
|
-
startDate: Date,
|
|
19
19
|
endDate: Date,
|
|
20
20
|
instrument: mongoose_1.SchemaTypes.Mixed,
|
|
21
|
-
replacer: mongoose_1.SchemaTypes.Mixed,
|
|
22
21
|
targetCollection: mongoose_1.SchemaTypes.Mixed,
|
|
23
22
|
sameAs: mongoose_1.SchemaTypes.Mixed,
|
|
24
23
|
};
|
|
@@ -46,7 +45,50 @@ const schemaOptions = {
|
|
|
46
45
|
versionKey: false
|
|
47
46
|
}
|
|
48
47
|
};
|
|
49
|
-
const indexes = [
|
|
48
|
+
const indexes = [
|
|
49
|
+
[
|
|
50
|
+
{ startDate: 1 },
|
|
51
|
+
{
|
|
52
|
+
name: 'ttlByStartDate',
|
|
53
|
+
expireAfterSeconds: 2592000 // 30 days
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
[
|
|
57
|
+
{ 'project.id': 1, startDate: 1 },
|
|
58
|
+
{ name: 'projectId' }
|
|
59
|
+
],
|
|
60
|
+
[
|
|
61
|
+
{ typeOf: 1, startDate: 1 },
|
|
62
|
+
{ name: 'typeOf' }
|
|
63
|
+
],
|
|
64
|
+
[
|
|
65
|
+
{ 'object.id': 1, startDate: 1 },
|
|
66
|
+
{
|
|
67
|
+
name: 'objectId',
|
|
68
|
+
partialFilterExpression: {
|
|
69
|
+
'object.id': { $exists: true }
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
[
|
|
74
|
+
{ 'result.id': 1, startDate: 1 },
|
|
75
|
+
{
|
|
76
|
+
name: 'resultId',
|
|
77
|
+
partialFilterExpression: {
|
|
78
|
+
'result.id': { $exists: true }
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
[
|
|
83
|
+
{ 'sameAs.id': 1, startDate: 1 },
|
|
84
|
+
{
|
|
85
|
+
name: 'sameAsId',
|
|
86
|
+
partialFilterExpression: {
|
|
87
|
+
'sameAs.id': { $exists: true }
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
];
|
|
50
92
|
exports.indexes = indexes;
|
|
51
93
|
/**
|
|
52
94
|
* 編集アクションスキーマ
|
|
@@ -39,10 +39,4 @@ export declare class TicketRepo {
|
|
|
39
39
|
*/
|
|
40
40
|
issueByTicketToken(params: IIssueParams): Promise<Pick<ITicket, 'id'>>;
|
|
41
41
|
findTickets(params: ISearchConditions, inclusion: IKeyOfProjection[]): Promise<ITicket[]>;
|
|
42
|
-
/**
|
|
43
|
-
* 発行日時を一定期間過ぎたチケットを削除する
|
|
44
|
-
*/
|
|
45
|
-
deleteTicketsByDateIssued(params: {
|
|
46
|
-
dateIssuedLt: Date;
|
|
47
|
-
}): Promise<void>;
|
|
48
42
|
}
|
|
@@ -81,16 +81,5 @@ class TicketRepo {
|
|
|
81
81
|
.lean() // 2024-08-20~
|
|
82
82
|
.exec();
|
|
83
83
|
}
|
|
84
|
-
/**
|
|
85
|
-
* 発行日時を一定期間過ぎたチケットを削除する
|
|
86
|
-
*/
|
|
87
|
-
async deleteTicketsByDateIssued(params) {
|
|
88
|
-
await this.ticketModel.deleteMany({
|
|
89
|
-
dateIssued: {
|
|
90
|
-
$lt: params.dateIssuedLt
|
|
91
|
-
}
|
|
92
|
-
})
|
|
93
|
-
.exec();
|
|
94
|
-
}
|
|
95
84
|
}
|
|
96
85
|
exports.TicketRepo = TicketRepo;
|
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
import { Connection, FilterQuery } from 'mongoose';
|
|
2
2
|
import { factory } from '../factory';
|
|
3
3
|
import { IDocType } from './mongoose/schemas/updateAction';
|
|
4
|
-
type StartableActionType = factory.actionType.AddAction | factory.actionType.UpdateAction | factory.actionType.ReplaceAction;
|
|
5
|
-
|
|
4
|
+
type StartableActionType = factory.actionType.AddAction | factory.actionType.UpdateAction | factory.actionType.ReplaceAction | factory.actionType.DeleteAction;
|
|
5
|
+
type IAction<T extends StartableActionType> = T extends factory.actionType.AddAction ? factory.action.update.add.IAction : T extends factory.actionType.ReplaceAction ? factory.action.update.replace.IAction : T extends factory.actionType.UpdateAction ? factory.action.update.update.IAction : T extends factory.actionType.DeleteAction ? factory.action.update.deleteAction.IAction : never;
|
|
6
6
|
type IKeyOfProjection = keyof IDocType;
|
|
7
|
-
type IFindParams = Pick<factory.action.ISearchConditions, '
|
|
7
|
+
type IFindParams = Pick<factory.action.ISearchConditions, 'limit' | 'page' | 'project' | 'sort' | 'startFrom' | 'startThrough'> & {
|
|
8
|
+
id?: string;
|
|
9
|
+
typeOf?: StartableActionType;
|
|
10
|
+
object?: {
|
|
11
|
+
id?: string;
|
|
12
|
+
};
|
|
13
|
+
result?: {
|
|
14
|
+
id?: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
8
17
|
/**
|
|
9
18
|
* リソース編集アクションリポジトリ
|
|
10
19
|
*/
|
|
@@ -30,23 +39,18 @@ export declare class UpdateActionRepo {
|
|
|
30
39
|
error: Error | Error[] | unknown;
|
|
31
40
|
}): Promise<void>;
|
|
32
41
|
findUpdateActions(params: IFindParams, inclusion: IKeyOfProjection[]): Promise<IAction<StartableActionType>[]>;
|
|
33
|
-
|
|
42
|
+
findUpdateActionsBySameAs(params: {
|
|
34
43
|
sameAs: {
|
|
35
44
|
id: {
|
|
36
45
|
$eq: string;
|
|
37
46
|
};
|
|
38
47
|
};
|
|
39
|
-
purpose?: {
|
|
40
|
-
id: {
|
|
41
|
-
$eq: string;
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
48
|
/**
|
|
45
49
|
* 1taskから複数actionが発生する可能性があるので、typeOf指定が必須
|
|
46
50
|
*/
|
|
47
51
|
typeOf: {
|
|
48
52
|
$eq: StartableActionType;
|
|
49
53
|
};
|
|
50
|
-
}): Promise<Pick<IAction<StartableActionType>, 'id' | 'actionStatus' | 'error'
|
|
54
|
+
}): Promise<Pick<IAction<StartableActionType>, 'id' | 'actionStatus' | 'error'>[]>;
|
|
51
55
|
}
|
|
52
56
|
export {};
|