@chevre/domain 26.0.0-alpha.27 → 26.0.0-alpha.28
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 +1 -1
- package/lib/chevre/repo/action.js +0 -260
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +85 -76
- package/lib/chevre/repo/mongoose/schemas/updateAction.d.ts +15 -0
- package/lib/chevre/repo/mongoose/schemas/updateAction.js +65 -0
- package/lib/chevre/repo/updateAction.d.ts +52 -0
- package/lib/chevre/repo/updateAction.js +429 -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/importEventsFromCOA.js +2 -2
- package/lib/chevre/service/task/syncResourcesFromCOA.js +11 -11
- package/package.json +1 -1
|
@@ -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>;
|
|
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;
|
|
@@ -6,277 +6,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.ActionRepo = void 0;
|
|
7
7
|
const moment_1 = __importDefault(require("moment"));
|
|
8
8
|
const factory_1 = require("../factory");
|
|
9
|
-
// import { createSchema as createRecipeSchema, IModel as IActionRecipeModel, modelName as recipeModelName } from './mongoose/schemas/actionRecipe';
|
|
10
9
|
const actionProcess_1 = require("./action/actionProcess");
|
|
11
10
|
/**
|
|
12
11
|
* アクションリポジトリ
|
|
13
12
|
*/
|
|
14
13
|
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
14
|
/**
|
|
22
15
|
* 汎用アクション検索
|
|
23
16
|
*/
|
|
24
17
|
async findActionsByType(params, inclusion) {
|
|
25
18
|
return (this.findAnyActions(params, inclusion));
|
|
26
19
|
}
|
|
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
20
|
/**
|
|
281
21
|
* 取引に対するアクションを検索する
|
|
282
22
|
*/
|
|
@@ -71,10 +71,11 @@ const indexes = [
|
|
|
71
71
|
name: 'uniqueTransactionNumber'
|
|
72
72
|
}
|
|
73
73
|
],
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
// discontinue(2026-08-12~)
|
|
75
|
+
// [
|
|
76
|
+
// { transactionNumber: 1, startDate: -1 },
|
|
77
|
+
// { name: 'searchByTransactionNumber' }
|
|
78
|
+
// ],
|
|
78
79
|
[
|
|
79
80
|
{ 'project.id': 1, startDate: -1 },
|
|
80
81
|
{
|
|
@@ -124,15 +125,16 @@ const indexes = [
|
|
|
124
125
|
}
|
|
125
126
|
}
|
|
126
127
|
],
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
128
|
+
// discontinue(2026-08-12~)
|
|
129
|
+
// [
|
|
130
|
+
// { 'object.provider.id': 1, startDate: -1 },
|
|
131
|
+
// {
|
|
132
|
+
// name: 'searchByObjectProviderId',
|
|
133
|
+
// partialFilterExpression: {
|
|
134
|
+
// 'object.provider.id': { $exists: true }
|
|
135
|
+
// }
|
|
136
|
+
// }
|
|
137
|
+
// ],
|
|
136
138
|
[
|
|
137
139
|
{ 'object.subReservation.id': 1, startDate: -1 },
|
|
138
140
|
{
|
|
@@ -142,24 +144,26 @@ const indexes = [
|
|
|
142
144
|
}
|
|
143
145
|
}
|
|
144
146
|
],
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
147
|
+
// discontinue(2026-08-12~)
|
|
148
|
+
// [
|
|
149
|
+
// { 'object.subReservation.reservationNumber': 1, startDate: -1 },
|
|
150
|
+
// {
|
|
151
|
+
// name: 'searchByObjectSubReservationsReservationNumber',
|
|
152
|
+
// partialFilterExpression: {
|
|
153
|
+
// 'object.subReservation.reservationNumber': { $exists: true }
|
|
154
|
+
// }
|
|
155
|
+
// }
|
|
156
|
+
// ],
|
|
157
|
+
// discontinue(2026-08-12~)
|
|
158
|
+
// [
|
|
159
|
+
// { 'object.subReservation.reservationFor.id': 1, startDate: -1 },
|
|
160
|
+
// {
|
|
161
|
+
// name: 'searchByObjectSubReservationsReservationForId',
|
|
162
|
+
// partialFilterExpression: {
|
|
163
|
+
// 'object.subReservation.reservationFor.id': { $exists: true }
|
|
164
|
+
// }
|
|
165
|
+
// }
|
|
166
|
+
// ],
|
|
163
167
|
[
|
|
164
168
|
{ 'object.subReservation.reservedTicket.ticketedSeat.seatNumber': 1, startDate: -1 },
|
|
165
169
|
{
|
|
@@ -178,15 +182,16 @@ const indexes = [
|
|
|
178
182
|
}
|
|
179
183
|
}
|
|
180
184
|
],
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
185
|
+
// discontinue(2026-08-12~)
|
|
186
|
+
// [
|
|
187
|
+
// { 'object.underName.id': 1, startDate: -1 },
|
|
188
|
+
// {
|
|
189
|
+
// name: 'searchByObjectUnderNameId',
|
|
190
|
+
// partialFilterExpression: {
|
|
191
|
+
// 'object.underName.id': { $exists: true }
|
|
192
|
+
// }
|
|
193
|
+
// }
|
|
194
|
+
// ],
|
|
190
195
|
[
|
|
191
196
|
{ 'object.reservationNumber': 1, startDate: -1 },
|
|
192
197
|
{
|
|
@@ -217,42 +222,46 @@ const indexes = [
|
|
|
217
222
|
partialFilterExpression: { 'object.reservations.reservationFor.id': { $exists: true } }
|
|
218
223
|
}
|
|
219
224
|
],
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
225
|
+
// discontinue(2026-08-12~)
|
|
226
|
+
// [
|
|
227
|
+
// { 'object.fromLocation.identifier': 1, startDate: -1 },
|
|
228
|
+
// {
|
|
229
|
+
// name: 'searchByObjectFromLocationIdentifier',
|
|
230
|
+
// partialFilterExpression: {
|
|
231
|
+
// 'object.fromLocation.identifier': { $exists: true }
|
|
232
|
+
// }
|
|
233
|
+
// }
|
|
234
|
+
// ],
|
|
235
|
+
// discontinue(2026-08-12~)
|
|
236
|
+
// [
|
|
237
|
+
// { 'object.toLocation.identifier': 1, startDate: -1 },
|
|
238
|
+
// {
|
|
239
|
+
// name: 'searchByObjectToLocationIdentifier',
|
|
240
|
+
// partialFilterExpression: {
|
|
241
|
+
// 'object.toLocation.identifier': { $exists: true }
|
|
242
|
+
// }
|
|
243
|
+
// }
|
|
244
|
+
// ],
|
|
245
|
+
// discontinue(2026-08-12~)
|
|
246
|
+
// [
|
|
247
|
+
// { 'object.pendingTransaction.identifier': 1, startDate: -1 },
|
|
248
|
+
// {
|
|
249
|
+
// name: 'searchByObjectPendingTransactionIdentifier',
|
|
250
|
+
// partialFilterExpression: {
|
|
251
|
+
// 'object.pendingTransaction.identifier': { $exists: true }
|
|
252
|
+
// }
|
|
253
|
+
// }
|
|
254
|
+
// ],
|
|
255
|
+
// discontinue(2026-08-12~)
|
|
256
|
+
// [
|
|
257
|
+
// { 'object.itemOffered.serviceOutput.identifier': 1, startDate: -1 },
|
|
258
|
+
// {
|
|
259
|
+
// name: 'searchByObjectItemOfferedServiceOutputIdentifier',
|
|
260
|
+
// partialFilterExpression: {
|
|
261
|
+
// 'object.itemOffered.serviceOutput.identifier': { $exists: true }
|
|
262
|
+
// }
|
|
263
|
+
// }
|
|
264
|
+
// ],
|
|
256
265
|
[
|
|
257
266
|
{ 'object.typeOf': 1, startDate: -1 },
|
|
258
267
|
{
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
|
|
2
|
+
import { IVirtuals } from '../virtuals';
|
|
3
|
+
import { factory } from '../../../factory';
|
|
4
|
+
type IDocType = Omit<factory.action.update.add.IAction, 'id' | 'potentialActions' | 'purpose'> & {
|
|
5
|
+
replacer?: never;
|
|
6
|
+
} | Omit<factory.action.update.replace.IAction, 'id' | 'potentialActions' | 'purpose'> | Omit<factory.action.update.update.IAction, 'id' | 'potentialActions' | 'purpose'> & {
|
|
7
|
+
replacer?: never;
|
|
8
|
+
};
|
|
9
|
+
type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
|
|
10
|
+
type ISchemaDefinition = SchemaDefinition<IDocType>;
|
|
11
|
+
type ISchema = Schema<IDocType, IModel, Record<string, never>, Record<string, never>, IVirtuals, Record<string, never>, ISchemaDefinition, IDocType>;
|
|
12
|
+
declare const modelName = "UpdateAction";
|
|
13
|
+
declare const indexes: [d: IndexDefinition, o: IndexOptions][];
|
|
14
|
+
declare function createSchema(): ISchema;
|
|
15
|
+
export { createSchema, IDocType, IModel, indexes, modelName };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.modelName = exports.indexes = void 0;
|
|
4
|
+
exports.createSchema = createSchema;
|
|
5
|
+
const mongoose_1 = require("mongoose");
|
|
6
|
+
const writeConcern_1 = require("../writeConcern");
|
|
7
|
+
const settings_1 = require("../../../settings");
|
|
8
|
+
const modelName = 'UpdateAction';
|
|
9
|
+
exports.modelName = modelName;
|
|
10
|
+
const schemaDefinition = {
|
|
11
|
+
project: mongoose_1.SchemaTypes.Mixed,
|
|
12
|
+
actionStatus: String,
|
|
13
|
+
typeOf: String,
|
|
14
|
+
agent: mongoose_1.SchemaTypes.Mixed,
|
|
15
|
+
result: mongoose_1.SchemaTypes.Mixed,
|
|
16
|
+
error: mongoose_1.SchemaTypes.Mixed,
|
|
17
|
+
object: mongoose_1.SchemaTypes.Mixed,
|
|
18
|
+
startDate: Date,
|
|
19
|
+
endDate: Date,
|
|
20
|
+
instrument: mongoose_1.SchemaTypes.Mixed,
|
|
21
|
+
replacer: mongoose_1.SchemaTypes.Mixed,
|
|
22
|
+
targetCollection: mongoose_1.SchemaTypes.Mixed,
|
|
23
|
+
sameAs: mongoose_1.SchemaTypes.Mixed,
|
|
24
|
+
};
|
|
25
|
+
const schemaOptions = {
|
|
26
|
+
autoIndex: settings_1.MONGO_AUTO_INDEX,
|
|
27
|
+
autoCreate: false,
|
|
28
|
+
collection: 'updateActions',
|
|
29
|
+
id: true,
|
|
30
|
+
read: 'primary',
|
|
31
|
+
writeConcern: writeConcern_1.writeConcern,
|
|
32
|
+
strict: true,
|
|
33
|
+
strictQuery: false,
|
|
34
|
+
timestamps: false,
|
|
35
|
+
versionKey: false,
|
|
36
|
+
toJSON: {
|
|
37
|
+
getters: false,
|
|
38
|
+
virtuals: false,
|
|
39
|
+
minimize: false,
|
|
40
|
+
versionKey: false
|
|
41
|
+
},
|
|
42
|
+
toObject: {
|
|
43
|
+
getters: false,
|
|
44
|
+
virtuals: true,
|
|
45
|
+
minimize: false,
|
|
46
|
+
versionKey: false
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const indexes = [];
|
|
50
|
+
exports.indexes = indexes;
|
|
51
|
+
/**
|
|
52
|
+
* 編集アクションスキーマ
|
|
53
|
+
*/
|
|
54
|
+
let schema;
|
|
55
|
+
function createSchema() {
|
|
56
|
+
if (schema === undefined) {
|
|
57
|
+
schema = new mongoose_1.Schema(schemaDefinition, schemaOptions);
|
|
58
|
+
}
|
|
59
|
+
if (settings_1.MONGO_AUTO_INDEX) {
|
|
60
|
+
indexes.forEach((indexParams) => {
|
|
61
|
+
schema?.index(...indexParams);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return schema;
|
|
65
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Connection, FilterQuery } from 'mongoose';
|
|
2
|
+
import { factory } from '../factory';
|
|
3
|
+
import { IDocType } from './mongoose/schemas/updateAction';
|
|
4
|
+
type StartableActionType = factory.actionType.AddAction | factory.actionType.UpdateAction | factory.actionType.ReplaceAction;
|
|
5
|
+
export 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 : never;
|
|
6
|
+
type IKeyOfProjection = keyof IDocType;
|
|
7
|
+
type IFindParams = Pick<factory.action.ISearchConditions, 'actionStatus' | 'actionStatusTypes' | 'agent' | 'id' | 'instrument' | 'limit' | 'object' | 'page' | 'project' | 'result' | 'sameAs' | 'sort' | 'startFrom' | 'startThrough' | 'typeOf'>;
|
|
8
|
+
/**
|
|
9
|
+
* リソース編集アクションリポジトリ
|
|
10
|
+
*/
|
|
11
|
+
export declare class UpdateActionRepo {
|
|
12
|
+
private readonly updateActionModel;
|
|
13
|
+
constructor(connection: Connection);
|
|
14
|
+
static CREATE_MONGO_CONDITIONS(params: IFindParams): FilterQuery<IDocType>[];
|
|
15
|
+
/**
|
|
16
|
+
* アクション開始
|
|
17
|
+
*/
|
|
18
|
+
startUpdateAction<T extends StartableActionType>(attributes: factory.action.IAttributes<T, any, any>): Promise<Pick<IAction<T>, 'id' | 'typeOf' | 'startDate'>>;
|
|
19
|
+
completeUpdateAction(params: {
|
|
20
|
+
typeOf: StartableActionType;
|
|
21
|
+
id: string;
|
|
22
|
+
result: any;
|
|
23
|
+
}): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* アクション失敗
|
|
26
|
+
*/
|
|
27
|
+
giveUpUpdateAction(params: {
|
|
28
|
+
typeOf: StartableActionType;
|
|
29
|
+
id: string;
|
|
30
|
+
error: Error | Error[] | unknown;
|
|
31
|
+
}): Promise<void>;
|
|
32
|
+
findUpdateActions(params: IFindParams, inclusion: IKeyOfProjection[]): Promise<IAction<StartableActionType>[]>;
|
|
33
|
+
searchBySameAs(params: {
|
|
34
|
+
sameAs: {
|
|
35
|
+
id: {
|
|
36
|
+
$eq: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
purpose?: {
|
|
40
|
+
id: {
|
|
41
|
+
$eq: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* 1taskから複数actionが発生する可能性があるので、typeOf指定が必須
|
|
46
|
+
*/
|
|
47
|
+
typeOf: {
|
|
48
|
+
$eq: StartableActionType;
|
|
49
|
+
};
|
|
50
|
+
}): Promise<Pick<IAction<StartableActionType>, 'id' | 'actionStatus' | 'error' | 'purpose'>[]>;
|
|
51
|
+
}
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateActionRepo = void 0;
|
|
4
|
+
const factory_1 = require("../factory");
|
|
5
|
+
const settings_1 = require("../settings");
|
|
6
|
+
const updateAction_1 = require("./mongoose/schemas/updateAction");
|
|
7
|
+
const AVAILABLE_PROJECT_FIELDS = [
|
|
8
|
+
'project',
|
|
9
|
+
'actionStatus',
|
|
10
|
+
'typeOf',
|
|
11
|
+
'agent',
|
|
12
|
+
'result',
|
|
13
|
+
'error',
|
|
14
|
+
'object',
|
|
15
|
+
'startDate',
|
|
16
|
+
'endDate',
|
|
17
|
+
'instrument',
|
|
18
|
+
'targetCollection',
|
|
19
|
+
'sameAs',
|
|
20
|
+
'replacer',
|
|
21
|
+
];
|
|
22
|
+
// 内部で正規化関数を定義(または外部ヘルパーを呼び出す)
|
|
23
|
+
function unknown2actionError(e) {
|
|
24
|
+
if (e instanceof Error) {
|
|
25
|
+
// Errorオブジェクトの場合は、既存のロジック通り展開
|
|
26
|
+
return { ...e, name: e.name, message: e.message };
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
// Error以外(文字列など)が投げられた場合のハンドリング
|
|
30
|
+
return { name: 'UnknownError', message: String(e) };
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
;
|
|
34
|
+
/**
|
|
35
|
+
* リソース編集アクションリポジトリ
|
|
36
|
+
*/
|
|
37
|
+
class UpdateActionRepo {
|
|
38
|
+
updateActionModel;
|
|
39
|
+
constructor(connection) {
|
|
40
|
+
this.updateActionModel = connection.model(updateAction_1.modelName, (0, updateAction_1.createSchema)());
|
|
41
|
+
}
|
|
42
|
+
static CREATE_MONGO_CONDITIONS(params) {
|
|
43
|
+
const andConditions = [];
|
|
44
|
+
const idIn = params.id?.$in;
|
|
45
|
+
if (Array.isArray(idIn)) {
|
|
46
|
+
andConditions.push({ _id: { $in: idIn } });
|
|
47
|
+
}
|
|
48
|
+
const idNin = params.id?.$nin;
|
|
49
|
+
if (Array.isArray(idNin)) {
|
|
50
|
+
andConditions.push({ _id: { $nin: idNin } });
|
|
51
|
+
}
|
|
52
|
+
const projectIdEq = params.project?.id?.$eq;
|
|
53
|
+
if (typeof projectIdEq === 'string') {
|
|
54
|
+
andConditions.push({
|
|
55
|
+
'project.id': {
|
|
56
|
+
$eq: projectIdEq
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
const agentTypeOfIn = params.agent?.typeOf?.$in;
|
|
61
|
+
if (Array.isArray(agentTypeOfIn)) {
|
|
62
|
+
andConditions.push({
|
|
63
|
+
'agent.typeOf': {
|
|
64
|
+
$exists: true,
|
|
65
|
+
$in: agentTypeOfIn
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
const agentIdIn = params.agent?.id?.$in;
|
|
70
|
+
if (Array.isArray(agentIdIn)) {
|
|
71
|
+
andConditions.push({
|
|
72
|
+
'agent.id': {
|
|
73
|
+
$exists: true,
|
|
74
|
+
$in: agentIdIn
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
const instrumentTransactionNumberEq = params.instrument?.transactionNumber?.$eq;
|
|
79
|
+
if (typeof instrumentTransactionNumberEq === 'string') {
|
|
80
|
+
andConditions.push({ 'instrument.transactionNumber': { $exists: true, $eq: instrumentTransactionNumberEq } });
|
|
81
|
+
}
|
|
82
|
+
const instrumentTypeOfEq = params.instrument?.typeOf?.$eq;
|
|
83
|
+
if (typeof instrumentTypeOfEq === 'string') {
|
|
84
|
+
andConditions.push({ 'instrument.typeOf': { $exists: true, $eq: instrumentTypeOfEq } });
|
|
85
|
+
}
|
|
86
|
+
const instrumentIdentifierEq = params.instrument?.identifier?.$eq;
|
|
87
|
+
if (typeof instrumentIdentifierEq === 'string') {
|
|
88
|
+
andConditions.push({ 'instrument.identifier': { $exists: true, $eq: instrumentIdentifierEq } });
|
|
89
|
+
}
|
|
90
|
+
const instrumentIdEq = params.instrument?.id?.$eq;
|
|
91
|
+
if (typeof instrumentIdEq === 'string') {
|
|
92
|
+
andConditions.push({ 'instrument.id': { $exists: true, $eq: instrumentIdEq } });
|
|
93
|
+
}
|
|
94
|
+
const instrumentOrderNumberEq = params.instrument?.orderNumber?.$eq;
|
|
95
|
+
if (typeof instrumentOrderNumberEq === 'string') {
|
|
96
|
+
andConditions.push({ 'instrument.orderNumber': { $exists: true, $eq: instrumentOrderNumberEq } });
|
|
97
|
+
}
|
|
98
|
+
const objectMovieTicketsIdentifierEq = params.object?.movieTickets?.identifier?.$eq;
|
|
99
|
+
if (typeof objectMovieTicketsIdentifierEq === 'string') {
|
|
100
|
+
andConditions.push({
|
|
101
|
+
'object.movieTickets.identifier': {
|
|
102
|
+
$exists: true,
|
|
103
|
+
$eq: objectMovieTicketsIdentifierEq
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
const objectMovieTicketsServiceOutputReservationForIdEq = params.object?.movieTickets?.serviceOutput?.reservationFor?.id?.$eq;
|
|
108
|
+
if (typeof objectMovieTicketsServiceOutputReservationForIdEq === 'string') {
|
|
109
|
+
andConditions.push({
|
|
110
|
+
'object.movieTickets.serviceOutput.reservationFor.id': {
|
|
111
|
+
$exists: true,
|
|
112
|
+
$eq: objectMovieTicketsServiceOutputReservationForIdEq
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
const objectPaymentMethodIdEq = params.object?.paymentMethodId?.$eq;
|
|
117
|
+
if (typeof objectPaymentMethodIdEq === 'string') {
|
|
118
|
+
andConditions.push({
|
|
119
|
+
'object.paymentMethodId': {
|
|
120
|
+
$exists: true,
|
|
121
|
+
$eq: objectPaymentMethodIdEq
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
const objectObjectPaymentMethodIdEq = params.object?.object?.paymentMethodId?.$eq;
|
|
126
|
+
if (typeof objectObjectPaymentMethodIdEq === 'string') {
|
|
127
|
+
andConditions.push({
|
|
128
|
+
'object.object.paymentMethodId': {
|
|
129
|
+
$exists: true,
|
|
130
|
+
$eq: objectObjectPaymentMethodIdEq
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
const objectReservationForIdEq = params.object?.reservationFor?.id?.$eq;
|
|
135
|
+
if (typeof objectReservationForIdEq === 'string') {
|
|
136
|
+
andConditions.push({
|
|
137
|
+
'object.reservationFor.id': {
|
|
138
|
+
$exists: true,
|
|
139
|
+
$eq: objectReservationForIdEq
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
const objectReservationNumberEq = params.object?.reservationNumber?.$eq;
|
|
144
|
+
if (typeof objectReservationNumberEq === 'string') {
|
|
145
|
+
andConditions.push({
|
|
146
|
+
'object.reservationNumber': {
|
|
147
|
+
$exists: true,
|
|
148
|
+
$eq: objectReservationNumberEq
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
const objectReservationNumberIn = params.object?.reservationNumber?.$in;
|
|
153
|
+
if (Array.isArray(objectReservationNumberIn)) {
|
|
154
|
+
andConditions.push({
|
|
155
|
+
'object.reservationNumber': {
|
|
156
|
+
$exists: true,
|
|
157
|
+
$in: objectReservationNumberIn
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
const objectPaymentMethodAccountIdEq = params.object?.paymentMethod?.accountId?.$eq;
|
|
162
|
+
if (typeof objectPaymentMethodAccountIdEq === 'string') {
|
|
163
|
+
andConditions.push({
|
|
164
|
+
'object.paymentMethod.accountId': {
|
|
165
|
+
$exists: true,
|
|
166
|
+
$eq: objectPaymentMethodAccountIdEq
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
const objectPaymentMethodPaymentMethodIdEq = params.object?.paymentMethod?.paymentMethodId?.$eq;
|
|
171
|
+
if (typeof objectPaymentMethodPaymentMethodIdEq === 'string') {
|
|
172
|
+
andConditions.push({
|
|
173
|
+
'object.paymentMethod.paymentMethodId': {
|
|
174
|
+
$exists: true,
|
|
175
|
+
$eq: objectPaymentMethodPaymentMethodIdEq
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
const objectPaymentMethodPaymentMethodIdIn = params.object?.paymentMethod?.paymentMethodId?.$in;
|
|
180
|
+
if (Array.isArray(objectPaymentMethodPaymentMethodIdIn)) {
|
|
181
|
+
andConditions.push({
|
|
182
|
+
'object.paymentMethod.paymentMethodId': {
|
|
183
|
+
$exists: true,
|
|
184
|
+
$in: objectPaymentMethodPaymentMethodIdIn
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
const objectPaymentMethodTypeOfEq = params.object?.paymentMethod?.typeOf?.$eq;
|
|
189
|
+
if (typeof objectPaymentMethodTypeOfEq === 'string') {
|
|
190
|
+
andConditions.push({
|
|
191
|
+
'object.paymentMethod.typeOf': {
|
|
192
|
+
$exists: true,
|
|
193
|
+
$eq: objectPaymentMethodTypeOfEq
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
const objectTypeOfEq = params.object?.typeOf?.$eq;
|
|
198
|
+
if (typeof objectTypeOfEq === 'string') {
|
|
199
|
+
andConditions.push({
|
|
200
|
+
'object.typeOf': {
|
|
201
|
+
$exists: true,
|
|
202
|
+
$eq: objectTypeOfEq
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
const objectTypeOfIn = params.object?.typeOf?.$in;
|
|
207
|
+
if (Array.isArray(objectTypeOfIn)) {
|
|
208
|
+
andConditions.push({
|
|
209
|
+
'object.typeOf': {
|
|
210
|
+
$exists: true,
|
|
211
|
+
$in: objectTypeOfIn
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
const objectIdEq = params.object?.id?.$eq;
|
|
216
|
+
if (typeof objectIdEq === 'string') {
|
|
217
|
+
andConditions.push({
|
|
218
|
+
'object.id': {
|
|
219
|
+
$exists: true,
|
|
220
|
+
$eq: objectIdEq
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
const objectIdIn = params.object?.id?.$in;
|
|
225
|
+
if (Array.isArray(objectIdIn)) {
|
|
226
|
+
andConditions.push({
|
|
227
|
+
'object.id': {
|
|
228
|
+
$exists: true,
|
|
229
|
+
$in: objectIdIn
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
const objectOrderNumberIn = params.object?.orderNumber?.$in;
|
|
234
|
+
if (Array.isArray(objectOrderNumberIn)) {
|
|
235
|
+
andConditions.push({
|
|
236
|
+
'object.orderNumber': {
|
|
237
|
+
$exists: true,
|
|
238
|
+
$in: objectOrderNumberIn
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
const objectTransactionNumberEq = params.object?.transactionNumber?.$eq;
|
|
243
|
+
if (typeof objectTransactionNumberEq === 'string') {
|
|
244
|
+
andConditions.push({ 'object.transactionNumber': { $exists: true, $eq: objectTransactionNumberEq } });
|
|
245
|
+
}
|
|
246
|
+
if (typeof params.typeOf === 'string') {
|
|
247
|
+
andConditions.push({
|
|
248
|
+
typeOf: params.typeOf
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
else {
|
|
252
|
+
const typeOfEq = params.typeOf?.$eq;
|
|
253
|
+
if (typeof typeOfEq === 'string') {
|
|
254
|
+
andConditions.push({
|
|
255
|
+
typeOf: { $eq: typeOfEq }
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
const actionStatusIn = params.actionStatus?.$in;
|
|
260
|
+
if (Array.isArray(actionStatusIn)) {
|
|
261
|
+
andConditions.push({
|
|
262
|
+
actionStatus: { $in: actionStatusIn }
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
if (Array.isArray(params.actionStatusTypes)) {
|
|
266
|
+
andConditions.push({
|
|
267
|
+
actionStatus: { $in: params.actionStatusTypes }
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
const startDateGte = params.startFrom;
|
|
271
|
+
if (startDateGte instanceof Date) {
|
|
272
|
+
andConditions.push({
|
|
273
|
+
startDate: { $gte: startDateGte }
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
const startDateLte = params.startThrough;
|
|
277
|
+
if (startDateLte instanceof Date) {
|
|
278
|
+
andConditions.push({
|
|
279
|
+
startDate: { $lte: startDateLte }
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
const resultTypeOfIn = params.result?.typeOf?.$in;
|
|
283
|
+
if (Array.isArray(resultTypeOfIn)) {
|
|
284
|
+
andConditions.push({
|
|
285
|
+
'result.typeOf': {
|
|
286
|
+
$exists: true,
|
|
287
|
+
$in: resultTypeOfIn
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
const resultIdIn = params.result?.id?.$in;
|
|
292
|
+
if (Array.isArray(resultIdIn)) {
|
|
293
|
+
andConditions.push({
|
|
294
|
+
'result.id': {
|
|
295
|
+
$exists: true,
|
|
296
|
+
$in: resultIdIn
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
const resultOrderNumberIn = params.result?.orderNumber?.$in;
|
|
301
|
+
if (Array.isArray(resultOrderNumberIn)) {
|
|
302
|
+
andConditions.push({
|
|
303
|
+
'result.orderNumber': {
|
|
304
|
+
$exists: true,
|
|
305
|
+
$in: resultOrderNumberIn
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
const resultCodeIn = params.result?.code?.$in;
|
|
310
|
+
if (Array.isArray(resultCodeIn)) {
|
|
311
|
+
andConditions.push({
|
|
312
|
+
'result.code': {
|
|
313
|
+
$exists: true,
|
|
314
|
+
$in: resultCodeIn
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
const sameAsIdEq = params.sameAs?.id?.$eq;
|
|
319
|
+
if (typeof sameAsIdEq === 'string') {
|
|
320
|
+
andConditions.push({ 'sameAs.id': { $exists: true, $eq: sameAsIdEq } });
|
|
321
|
+
}
|
|
322
|
+
return andConditions;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* アクション開始
|
|
326
|
+
*/
|
|
327
|
+
async startUpdateAction(attributes) {
|
|
328
|
+
const startDate = new Date();
|
|
329
|
+
const creatingAction = {
|
|
330
|
+
...attributes,
|
|
331
|
+
actionStatus: factory_1.factory.actionStatusType.ActiveActionStatus,
|
|
332
|
+
startDate
|
|
333
|
+
};
|
|
334
|
+
const result = await this.updateActionModel.insertMany(creatingAction, { rawResult: true });
|
|
335
|
+
const id = result.insertedIds?.[0]?.toHexString();
|
|
336
|
+
if (typeof id !== 'string') {
|
|
337
|
+
throw new factory_1.factory.errors.Internal('action not saved');
|
|
338
|
+
}
|
|
339
|
+
return { id, startDate, typeOf: creatingAction.typeOf };
|
|
340
|
+
}
|
|
341
|
+
async completeUpdateAction(params) {
|
|
342
|
+
const doc = await this.updateActionModel.findOneAndUpdate({
|
|
343
|
+
_id: { $eq: params.id },
|
|
344
|
+
typeOf: { $eq: params.typeOf }
|
|
345
|
+
}, {
|
|
346
|
+
$set: {
|
|
347
|
+
actionStatus: factory_1.factory.actionStatusType.CompletedActionStatus,
|
|
348
|
+
result: params.result,
|
|
349
|
+
endDate: new Date()
|
|
350
|
+
}
|
|
351
|
+
}, { new: false, projection: { _id: 1 } })
|
|
352
|
+
.lean()
|
|
353
|
+
.exec();
|
|
354
|
+
if (doc === null) {
|
|
355
|
+
throw new factory_1.factory.errors.NotFound(this.updateActionModel.modelName);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* アクション失敗
|
|
360
|
+
*/
|
|
361
|
+
async giveUpUpdateAction(params) {
|
|
362
|
+
const actionError = Array.isArray(params.error)
|
|
363
|
+
? params.error.map(unknown2actionError)
|
|
364
|
+
: unknown2actionError(params.error);
|
|
365
|
+
const doc = await this.updateActionModel.findOneAndUpdate({
|
|
366
|
+
typeOf: { $eq: params.typeOf },
|
|
367
|
+
_id: { $eq: params.id }
|
|
368
|
+
}, {
|
|
369
|
+
$set: {
|
|
370
|
+
actionStatus: factory_1.factory.actionStatusType.FailedActionStatus,
|
|
371
|
+
error: actionError,
|
|
372
|
+
endDate: new Date()
|
|
373
|
+
}
|
|
374
|
+
}, { new: true, projection: { _id: 1 } })
|
|
375
|
+
.lean()
|
|
376
|
+
.exec();
|
|
377
|
+
if (doc === null) {
|
|
378
|
+
throw new factory_1.factory.errors.NotFound(this.updateActionModel.modelName);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
async findUpdateActions(params, inclusion) {
|
|
382
|
+
const conditions = UpdateActionRepo.CREATE_MONGO_CONDITIONS(params);
|
|
383
|
+
let positiveProjectionFields = AVAILABLE_PROJECT_FIELDS;
|
|
384
|
+
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
385
|
+
positiveProjectionFields = inclusion.filter((key) => AVAILABLE_PROJECT_FIELDS.includes(key));
|
|
386
|
+
}
|
|
387
|
+
const projection = {
|
|
388
|
+
_id: 0,
|
|
389
|
+
id: { $toString: '$_id' },
|
|
390
|
+
...Object.fromEntries(positiveProjectionFields.map((key) => ([key, 1])))
|
|
391
|
+
};
|
|
392
|
+
const query = this.updateActionModel.find((conditions.length > 0) ? { $and: conditions } : {}, projection);
|
|
393
|
+
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
394
|
+
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
395
|
+
query.limit(params.limit)
|
|
396
|
+
.skip(params.limit * (page - 1));
|
|
397
|
+
}
|
|
398
|
+
/* istanbul ignore else */
|
|
399
|
+
if (params.sort?.startDate !== undefined) {
|
|
400
|
+
query.sort({ startDate: params.sort.startDate });
|
|
401
|
+
}
|
|
402
|
+
// const explainResult = await (<any>query).explain();
|
|
403
|
+
// console.log(explainResult[0].executionStats.allPlansExecution.map((e: any) => e.executionStages.inputStage));
|
|
404
|
+
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
405
|
+
.lean() // 2024-08-26~
|
|
406
|
+
.exec();
|
|
407
|
+
}
|
|
408
|
+
async searchBySameAs(params) {
|
|
409
|
+
const projection = {
|
|
410
|
+
_id: 0,
|
|
411
|
+
id: { $toString: '$_id' },
|
|
412
|
+
actionStatus: 1,
|
|
413
|
+
error: 1,
|
|
414
|
+
purpose: 1
|
|
415
|
+
};
|
|
416
|
+
const query = this.updateActionModel.find({
|
|
417
|
+
typeOf: { $eq: params.typeOf.$eq },
|
|
418
|
+
'sameAs.id': { $exists: true, $eq: params.sameAs.id.$eq },
|
|
419
|
+
...(typeof params.purpose?.id.$eq === 'string')
|
|
420
|
+
? { 'purpose.id': { $exists: true, $eq: params.purpose.id.$eq } }
|
|
421
|
+
: undefined
|
|
422
|
+
}, projection)
|
|
423
|
+
.limit(1);
|
|
424
|
+
return query
|
|
425
|
+
.lean()
|
|
426
|
+
.exec();
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
exports.UpdateActionRepo = UpdateActionRepo;
|
|
@@ -103,6 +103,7 @@ import type { PlaceOrderRepo } from './repo/transaction/placeOrder';
|
|
|
103
103
|
import type { ReturnOrderRepo } from './repo/transaction/returnOrder';
|
|
104
104
|
import type { TransactionNumberRepo } from './repo/transactionNumber';
|
|
105
105
|
import type { TransactionProcessRepo } from './repo/transactionProcess';
|
|
106
|
+
import type { UpdateActionRepo } from './repo/updateAction';
|
|
106
107
|
import type { WebSiteRepo } from './repo/webSite';
|
|
107
108
|
import type { ConfirmationNumberRepo } from './repo/confirmationNumber';
|
|
108
109
|
import type { OrderNumberRepo } from './repo/orderNumber';
|
|
@@ -557,6 +558,10 @@ export declare namespace rateLimit {
|
|
|
557
558
|
function createInstance(...params: ConstructorParameters<typeof OfferRateLimitRepo>): Promise<OfferRateLimitRepo>;
|
|
558
559
|
}
|
|
559
560
|
}
|
|
561
|
+
export type UpdateAction = UpdateActionRepo;
|
|
562
|
+
export declare namespace UpdateAction {
|
|
563
|
+
function createInstance(...params: ConstructorParameters<typeof UpdateActionRepo>): Promise<UpdateActionRepo>;
|
|
564
|
+
}
|
|
560
565
|
export type WebSite = WebSiteRepo;
|
|
561
566
|
export declare namespace WebSite {
|
|
562
567
|
function createInstance(...params: ConstructorParameters<typeof WebSiteRepo>): Promise<WebSiteRepo>;
|
package/lib/chevre/repository.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OrderInTransaction = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalogItem = exports.OfferCatalog = exports.NoteAboutOrder = exports.Note = exports.MovieTicketType = exports.Message = exports.MerchantReturnPolicy = exports.MemberProgram = exports.Member = exports.Issuer = exports.IdentityProvider = exports.Identity = exports.EventSeries = exports.EventSellerMakesOffer = exports.EventOffer = exports.Event = exports.EmailMessage = exports.CustomerType = exports.Customer = exports.Credentials = exports.CreativeWork = exports.ConfirmationNumber = exports.Authorization = exports.CategoryCode = exports.assetTransaction = exports.AssetTransaction = exports.Aggregation = exports.AggregateReservation = exports.AggregateOrder = exports.AggregateOffer = exports.AggregateAssetTransaction = exports.AggregateTransaction = exports.AggregateTask = exports.AggregateScheduledTask = exports.AggregateAction = exports.AdminTransaction = exports.AdminTask = exports.AdminScheduledTask = exports.AdminAsyncAction = exports.AdminAssetTransaction = exports.AdditionalProperty = exports.action = exports.Action = exports.AccountTitle = exports.AccountingReport = exports.AcceptedOffer = void 0;
|
|
4
|
-
exports.WebSite = exports.rateLimit = exports.TransactionProcess = exports.TransactionNumber = exports.transaction = exports.Transaction = exports.Ticket = exports.AsyncAction = exports.TaskDelayed = exports.Task = exports.ScheduledTask = exports.StockHolder = exports.setting = exports.Setting = exports.ServiceAvailableHour = exports.SellerReturnPolicy = exports.SellerPaymentAccepted = exports.SellerMakesOffer = exports.Seller = exports.Schedule = exports.Role = exports.ReserveInterface = exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductHasOfferCatalog = exports.Product = exports.PriceSpecification = exports.PotentialAction = exports.place = exports.Person = exports.PendingReservation = exports.PaymentServiceProvider = exports.PaymentServiceChannel = exports.PaymentService = exports.Passport = exports.OrderNumber = void 0;
|
|
4
|
+
exports.WebSite = exports.UpdateAction = exports.rateLimit = exports.TransactionProcess = exports.TransactionNumber = exports.transaction = exports.Transaction = exports.Ticket = exports.AsyncAction = exports.TaskDelayed = exports.Task = exports.ScheduledTask = exports.StockHolder = exports.setting = exports.Setting = exports.ServiceAvailableHour = exports.SellerReturnPolicy = exports.SellerPaymentAccepted = exports.SellerMakesOffer = exports.Seller = exports.Schedule = exports.Role = exports.ReserveInterface = exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductHasOfferCatalog = exports.Product = exports.PriceSpecification = exports.PotentialAction = exports.place = exports.Person = exports.PendingReservation = exports.PaymentServiceProvider = exports.PaymentServiceChannel = exports.PaymentService = exports.Passport = exports.OrderNumber = void 0;
|
|
5
5
|
var AcceptedOffer;
|
|
6
6
|
(function (AcceptedOffer) {
|
|
7
7
|
let repo;
|
|
@@ -1193,6 +1193,17 @@ var rateLimit;
|
|
|
1193
1193
|
Offer.createInstance = createInstance;
|
|
1194
1194
|
})(Offer = rateLimit.Offer || (rateLimit.Offer = {}));
|
|
1195
1195
|
})(rateLimit || (exports.rateLimit = rateLimit = {}));
|
|
1196
|
+
var UpdateAction;
|
|
1197
|
+
(function (UpdateAction) {
|
|
1198
|
+
let repo;
|
|
1199
|
+
async function createInstance(...params) {
|
|
1200
|
+
if (repo === undefined) {
|
|
1201
|
+
repo = (await import('./repo/updateAction.js')).UpdateActionRepo;
|
|
1202
|
+
}
|
|
1203
|
+
return new repo(...params);
|
|
1204
|
+
}
|
|
1205
|
+
UpdateAction.createInstance = createInstance;
|
|
1206
|
+
})(UpdateAction || (exports.UpdateAction = UpdateAction = {}));
|
|
1196
1207
|
var WebSite;
|
|
1197
1208
|
(function (WebSite) {
|
|
1198
1209
|
let repo;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { COA } from '@motionpicture/coa-service';
|
|
2
|
-
import type {
|
|
2
|
+
import type { UpdateActionRepo } from '../../repo/updateAction';
|
|
3
3
|
import type { CategoryCodeRepo } from '../../repo/categoryCode';
|
|
4
4
|
import type { MovieTheaterRepo } from '../../repo/place/movieTheater';
|
|
5
5
|
import type { ScreeningRoomRepo } from '../../repo/place/screeningRoom';
|
|
@@ -9,7 +9,7 @@ import { IImportFromCOAParams } from './factory';
|
|
|
9
9
|
type IMovieTheater = Pick<factory.place.movieTheater.IPlace, 'id' | 'typeOf' | 'branchCode' | 'name' | 'kanaName'>;
|
|
10
10
|
declare function processUpdateMovieTheater(params: IImportFromCOAParams): (repos: {
|
|
11
11
|
masterService: COA.service.Master;
|
|
12
|
-
|
|
12
|
+
updateAction: UpdateActionRepo;
|
|
13
13
|
categoryCode: CategoryCodeRepo;
|
|
14
14
|
movieTheater: MovieTheaterRepo;
|
|
15
15
|
screeningRoom: ScreeningRoomRepo;
|
|
@@ -20,7 +20,7 @@ function processUpdateMovieTheater(params) {
|
|
|
20
20
|
},
|
|
21
21
|
targetCollection: { typeOf: factory_1.factory.placeType.MovieTheater }
|
|
22
22
|
};
|
|
23
|
-
const action = await repos.
|
|
23
|
+
const action = await repos.updateAction.startUpdateAction(actionAttributes);
|
|
24
24
|
let seller;
|
|
25
25
|
let movieTheater;
|
|
26
26
|
let screeningRooms;
|
|
@@ -66,7 +66,7 @@ function processUpdateMovieTheater(params) {
|
|
|
66
66
|
}
|
|
67
67
|
catch (error) {
|
|
68
68
|
try {
|
|
69
|
-
await repos.
|
|
69
|
+
await repos.updateAction.giveUpUpdateAction({ typeOf: action.typeOf, id: action.id, error });
|
|
70
70
|
}
|
|
71
71
|
catch (__) {
|
|
72
72
|
// 失敗したら仕方ない
|
|
@@ -77,7 +77,7 @@ function processUpdateMovieTheater(params) {
|
|
|
77
77
|
screeningRoomsCount: screeningRooms.length,
|
|
78
78
|
...(processTime !== undefined) ? { processTime } : undefined
|
|
79
79
|
};
|
|
80
|
-
await repos.
|
|
80
|
+
await repos.updateAction.completeUpdateAction({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
81
81
|
return { seller, movieTheater, screeningRooms };
|
|
82
82
|
};
|
|
83
83
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* マスターデータ同期サービス
|
|
3
3
|
*/
|
|
4
4
|
import type { COA } from '@motionpicture/coa-service';
|
|
5
|
-
import type {
|
|
5
|
+
import type { UpdateActionRepo } from '../repo/updateAction';
|
|
6
6
|
import type { CategoryCodeRepo } from '../repo/categoryCode';
|
|
7
7
|
import type { CreativeWorkRepo } from '../repo/creativeWork';
|
|
8
8
|
import type { EventRepo } from '../repo/event';
|
|
@@ -17,7 +17,7 @@ import { saveScreeningEventSeries } from './event/saveScreeningEventSeries';
|
|
|
17
17
|
* イベントをインポートする
|
|
18
18
|
*/
|
|
19
19
|
declare function importFromCOA(params: IImportFromCOAParams): (repos: {
|
|
20
|
-
|
|
20
|
+
updateAction: UpdateActionRepo;
|
|
21
21
|
categoryCode: CategoryCodeRepo;
|
|
22
22
|
creativeWork: CreativeWorkRepo;
|
|
23
23
|
event: EventRepo;
|
|
@@ -70,7 +70,7 @@ function importFromCOA(params) {
|
|
|
70
70
|
instrument,
|
|
71
71
|
targetCollection: { typeOf: factory_1.factory.eventType.ScreeningEvent }
|
|
72
72
|
};
|
|
73
|
-
const action = await repos.
|
|
73
|
+
const action = await repos.updateAction.startUpdateAction(actionAttributes);
|
|
74
74
|
let savedScreeningEventsCount = 0;
|
|
75
75
|
let savedScreeningEventSeriesCount = 0;
|
|
76
76
|
let cancelledIds = [];
|
|
@@ -131,7 +131,7 @@ function importFromCOA(params) {
|
|
|
131
131
|
}
|
|
132
132
|
catch (error) {
|
|
133
133
|
try {
|
|
134
|
-
await repos.
|
|
134
|
+
await repos.updateAction.giveUpUpdateAction({ typeOf: action.typeOf, id: action.id, error });
|
|
135
135
|
}
|
|
136
136
|
catch (__) {
|
|
137
137
|
// 失敗したら仕方ない
|
|
@@ -144,7 +144,7 @@ function importFromCOA(params) {
|
|
|
144
144
|
savedScreeningEventSeriesCount,
|
|
145
145
|
...(processTime !== undefined) ? { processTime } : undefined
|
|
146
146
|
};
|
|
147
|
-
await repos.
|
|
147
|
+
await repos.updateAction.completeUpdateAction({ typeOf: action.typeOf, id: action.id, result: actionResult });
|
|
148
148
|
};
|
|
149
149
|
}
|
|
150
150
|
function cancelDeletedEvents(params) {
|
|
@@ -35,7 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.call = call;
|
|
37
37
|
const coa_service_1 = require("@motionpicture/coa-service");
|
|
38
|
-
const
|
|
38
|
+
const updateAction_1 = require("../../repo/updateAction");
|
|
39
39
|
const categoryCode_1 = require("../../repo/categoryCode");
|
|
40
40
|
const creativeWork_1 = require("../../repo/creativeWork");
|
|
41
41
|
const event_1 = require("../../repo/event");
|
|
@@ -71,7 +71,7 @@ function call(params) {
|
|
|
71
71
|
...params.data,
|
|
72
72
|
project: { id: params.project.id, typeOf: factory_1.factory.organizationType.Project }
|
|
73
73
|
})({
|
|
74
|
-
|
|
74
|
+
updateAction: new updateAction_1.UpdateActionRepo(connection),
|
|
75
75
|
categoryCode: new categoryCode_1.CategoryCodeRepo(connection),
|
|
76
76
|
creativeWork: new creativeWork_1.CreativeWorkRepo(connection),
|
|
77
77
|
event: new event_1.EventRepo(connection),
|
|
@@ -7,7 +7,7 @@ exports.call = call;
|
|
|
7
7
|
const coa_service_1 = require("@motionpicture/coa-service");
|
|
8
8
|
const moment_timezone_1 = __importDefault(require("moment-timezone"));
|
|
9
9
|
const factory_1 = require("../../factory");
|
|
10
|
-
const
|
|
10
|
+
const updateAction_1 = require("../../repo/updateAction");
|
|
11
11
|
const categoryCode_1 = require("../../repo/categoryCode");
|
|
12
12
|
const creativeWork_1 = require("../../repo/creativeWork");
|
|
13
13
|
const credentials_1 = require("../../repo/credentials");
|
|
@@ -53,7 +53,7 @@ function call(params) {
|
|
|
53
53
|
...(credentialsRepo !== undefined) ? { credentialsRepo } : undefined
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
-
const
|
|
56
|
+
const updateActionRepo = new updateAction_1.UpdateActionRepo(connection);
|
|
57
57
|
try {
|
|
58
58
|
const masterService = new coa_service_1.COA.service.Master({
|
|
59
59
|
endpoint: coaAuthClient.options.endpoint, // same as authClient(2024-07-17~)
|
|
@@ -67,7 +67,7 @@ function call(params) {
|
|
|
67
67
|
object,
|
|
68
68
|
sameAs: { id: params.id }
|
|
69
69
|
})({
|
|
70
|
-
|
|
70
|
+
updateAction: updateActionRepo,
|
|
71
71
|
categoryCode: new categoryCode_1.CategoryCodeRepo(connection),
|
|
72
72
|
creativeWork: new creativeWork_1.CreativeWorkRepo(connection),
|
|
73
73
|
eventSeries: new eventSeries_1.EventSeriesRepo(connection),
|
|
@@ -82,7 +82,7 @@ function call(params) {
|
|
|
82
82
|
object,
|
|
83
83
|
sameAs: { id: params.id }
|
|
84
84
|
})({
|
|
85
|
-
|
|
85
|
+
updateAction: updateActionRepo,
|
|
86
86
|
categoryCode: new categoryCode_1.CategoryCodeRepo(connection),
|
|
87
87
|
creativeWork: new creativeWork_1.CreativeWorkRepo(connection),
|
|
88
88
|
event: new event_1.EventRepo(connection),
|
|
@@ -96,7 +96,7 @@ function call(params) {
|
|
|
96
96
|
catch (error) {
|
|
97
97
|
let throwsError = true;
|
|
98
98
|
// アクションが存在すればタスクを実行済扱いにする
|
|
99
|
-
const action = (await
|
|
99
|
+
const action = (await updateActionRepo.searchBySameAs({
|
|
100
100
|
sameAs: { id: { $eq: params.id } },
|
|
101
101
|
typeOf: { $eq: factory_1.factory.actionType.ReplaceAction }
|
|
102
102
|
})).shift();
|
|
@@ -129,7 +129,7 @@ function syncEventSeries(params) {
|
|
|
129
129
|
targetCollection: { typeOf: factory_1.factory.eventType.ScreeningEventSeries },
|
|
130
130
|
sameAs: { id: params.sameAs.id, typeOf: 'Task' }
|
|
131
131
|
};
|
|
132
|
-
const action = await repos.
|
|
132
|
+
const action = await repos.updateAction.startUpdateAction(actionAttributes);
|
|
133
133
|
let saveResult;
|
|
134
134
|
try {
|
|
135
135
|
const movieTheater = (await repos.movieTheater.projectFields({
|
|
@@ -165,7 +165,7 @@ function syncEventSeries(params) {
|
|
|
165
165
|
}
|
|
166
166
|
catch (error) {
|
|
167
167
|
try {
|
|
168
|
-
await repos.
|
|
168
|
+
await repos.updateAction.giveUpUpdateAction({ typeOf: action.typeOf, id: action.id, error });
|
|
169
169
|
}
|
|
170
170
|
catch (__) {
|
|
171
171
|
// no op
|
|
@@ -178,7 +178,7 @@ function syncEventSeries(params) {
|
|
|
178
178
|
typeOf: eventSeries.typeOf
|
|
179
179
|
};
|
|
180
180
|
});
|
|
181
|
-
await repos.
|
|
181
|
+
await repos.updateAction.completeUpdateAction({ typeOf: action.typeOf, id: action.id, result });
|
|
182
182
|
};
|
|
183
183
|
}
|
|
184
184
|
function syncEvents(params) {
|
|
@@ -198,7 +198,7 @@ function syncEvents(params) {
|
|
|
198
198
|
targetCollection: { typeOf: factory_1.factory.eventType.ScreeningEvent },
|
|
199
199
|
sameAs: { id: params.sameAs.id, typeOf: 'Task' }
|
|
200
200
|
};
|
|
201
|
-
const action = await repos.
|
|
201
|
+
const action = await repos.updateAction.startUpdateAction(actionAttributes);
|
|
202
202
|
let saveResult;
|
|
203
203
|
try {
|
|
204
204
|
const movieTheater = (await repos.movieTheater.projectFields({
|
|
@@ -280,7 +280,7 @@ function syncEvents(params) {
|
|
|
280
280
|
}
|
|
281
281
|
catch (error) {
|
|
282
282
|
try {
|
|
283
|
-
await repos.
|
|
283
|
+
await repos.updateAction.giveUpUpdateAction({ typeOf: action.typeOf, id: action.id, error });
|
|
284
284
|
}
|
|
285
285
|
catch (__) {
|
|
286
286
|
// no op
|
|
@@ -293,6 +293,6 @@ function syncEvents(params) {
|
|
|
293
293
|
typeOf: event.typeOf
|
|
294
294
|
};
|
|
295
295
|
});
|
|
296
|
-
await repos.
|
|
296
|
+
await repos.updateAction.completeUpdateAction({ typeOf: action.typeOf, id: action.id, result });
|
|
297
297
|
};
|
|
298
298
|
}
|
package/package.json
CHANGED