@chevre/domain 28.0.0-alpha.0 → 28.0.0-alpha.10
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/eventEmitter/transaction.d.ts +2 -2
- package/lib/chevre/eventEmitter/transaction.js +1 -1
- package/lib/chevre/repo/adminEvent.d.ts +0 -6
- package/lib/chevre/repo/adminEvent.js +3 -9
- package/lib/chevre/repo/adminEventSeries.d.ts +89 -0
- package/lib/chevre/repo/adminEventSeries.js +174 -0
- package/lib/chevre/repo/adminTransaction.d.ts +35 -39
- package/lib/chevre/repo/adminTransaction.js +0 -98
- package/lib/chevre/repo/aggregateEvent.js +0 -1
- package/lib/chevre/repo/aggregateTransaction.d.ts +0 -1
- package/lib/chevre/repo/aggregateTransaction.js +0 -1
- package/lib/chevre/repo/event.d.ts +2 -2
- package/lib/chevre/repo/event.js +71 -110
- package/lib/chevre/repo/eventSeries.d.ts +3 -82
- package/lib/chevre/repo/eventSeries.js +3 -201
- package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +2 -3
- package/lib/chevre/repo/mongoose/schemas/transaction.js +81 -70
- package/lib/chevre/repo/order.js +3 -1
- package/lib/chevre/repo/orderInTransaction.js +0 -6
- package/lib/chevre/repo/place/{hasPOS.d.ts → pos.d.ts} +3 -7
- package/lib/chevre/repo/place/{hasPOS.js → pos.js} +14 -13
- package/lib/chevre/repo/place/screeningRoom.d.ts +22 -1
- package/lib/chevre/repo/place/screeningRoom.js +28 -17
- package/lib/chevre/repo/transaction/placeOrder.d.ts +6 -12
- package/lib/chevre/repo/transaction/placeOrder.js +53 -146
- package/lib/chevre/repo/transaction/returnOrderInProgress.d.ts +7 -6
- package/lib/chevre/repo/transaction/returnOrderInProgress.js +8 -12
- package/lib/chevre/repo/transaction.d.ts +1 -1
- package/lib/chevre/repo/transaction.js +0 -1
- package/lib/chevre/repository.d.ts +10 -5
- package/lib/chevre/repository.js +19 -8
- package/lib/chevre/service/aggregation/event/aggregateOffers.js +1 -2
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +0 -1
- package/lib/chevre/service/aggregation/system.js +1 -3
- package/lib/chevre/service/assetTransaction/pay/start/preStart/validateAcceptedPaymentMethodIfNeeded.js +1 -2
- package/lib/chevre/service/event/saveScreeningEventSeries.d.ts +2 -2
- package/lib/chevre/service/event/saveScreeningEventSeries.js +1 -1
- package/lib/chevre/service/event/saveScreeningEvents.d.ts +2 -0
- package/lib/chevre/service/event.d.ts +2 -0
- package/lib/chevre/service/event.js +0 -1
- package/lib/chevre/service/offer/event/authorize/factory.d.ts +2 -2
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +1 -1
- package/lib/chevre/service/offer/event/authorize.js +1 -4
- package/lib/chevre/service/offer/event/issueEventOfferTicket.js +1 -1
- package/lib/chevre/service/offer/event/voidTransaction.js +2 -5
- package/lib/chevre/service/offer/event/voidTransactionByActionId.js +1 -4
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +2 -9
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.d.ts +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +1 -4
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +1 -4
- package/lib/chevre/service/offer/onEventChanged.js +2 -4
- package/lib/chevre/service/offer.js +1 -2
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/onPayTransactionCanceled.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +1 -1
- package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +1 -1
- package/lib/chevre/service/payment/any/authorize.js +1 -1
- package/lib/chevre/service/payment/any/factory.d.ts +2 -2
- package/lib/chevre/service/payment/any/invalidatePaymentUrl.js +1 -4
- package/lib/chevre/service/payment/any/processVoidPayTransaction.js +2 -2
- package/lib/chevre/service/payment/any/publishPaymentUrl.js +1 -1
- package/lib/chevre/service/task/confirmReturnOrder.js +4 -1
- package/lib/chevre/service/task/importEventsFromCOA.js +2 -0
- package/lib/chevre/service/task/onResourceDeleted.js +2 -2
- package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.d.ts +2 -2
- package/lib/chevre/service/task/onResourceUpdated/onHasPOSUpdated.js +3 -4
- package/lib/chevre/service/task/onResourceUpdated.js +2 -2
- package/lib/chevre/service/task/syncResourcesFromCOA.js +3 -1
- package/lib/chevre/service/transaction/deleteTransaction.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/confirm.js +1 -2
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.d.ts +2 -2
- package/lib/chevre/service/transaction/placeOrder/exportTasksById.js +1 -4
- package/lib/chevre/service/transaction/placeOrder/start.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/updateAgent.js +1 -4
- package/lib/chevre/service/transaction/returnOrder/potentialActions.js +1 -3
- package/lib/chevre/service/transaction/returnOrder/preStart.d.ts +13 -1
- package/lib/chevre/service/transaction/returnOrder/preStart.js +1 -2
- package/lib/chevre/service/transaction/returnOrder.d.ts +15 -4
- package/lib/chevre/service/transaction/returnOrder.js +5 -15
- package/lib/chevre/service/transaction.d.ts +1 -1
- package/package.json +2 -2
|
@@ -5,12 +5,12 @@ interface IListenArgsOnTransactionStatusChanged {
|
|
|
5
5
|
* 取引ID
|
|
6
6
|
*/
|
|
7
7
|
id: string;
|
|
8
|
-
typeOf: factory.transactionType;
|
|
8
|
+
typeOf: factory.transactionType.PlaceOrder;
|
|
9
9
|
status: factory.transactionStatusType;
|
|
10
10
|
}
|
|
11
11
|
type IOnTransactionStatusChangedListener = (listenArgs: IListenArgsOnTransactionStatusChanged) => void;
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* 注文取引イベントエミッター
|
|
14
14
|
*/
|
|
15
15
|
declare class TransactionEventEmitter extends EventEmitter {
|
|
16
16
|
onTransactionStatusChanged(listner: IOnTransactionStatusChangedListener): void;
|
|
@@ -7,7 +7,7 @@ var EventName;
|
|
|
7
7
|
EventName["OnTransactionStatusChanged"] = "OnTransactionStatusChanged";
|
|
8
8
|
})(EventName || (EventName = {}));
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* 注文取引イベントエミッター
|
|
11
11
|
*/
|
|
12
12
|
class TransactionEventEmitter extends events_1.EventEmitter {
|
|
13
13
|
onTransactionStatusChanged(listner) {
|
|
@@ -170,9 +170,6 @@ export declare class AdminEventRepo {
|
|
|
170
170
|
};
|
|
171
171
|
}): Promise<mongo.DeleteResult>;
|
|
172
172
|
deleteManyEventsEndedByProject(params: {
|
|
173
|
-
typeOf: {
|
|
174
|
-
$in: factory.eventType.ScreeningEvent[];
|
|
175
|
-
};
|
|
176
173
|
project: {
|
|
177
174
|
id: string;
|
|
178
175
|
};
|
|
@@ -181,9 +178,6 @@ export declare class AdminEventRepo {
|
|
|
181
178
|
};
|
|
182
179
|
}): Promise<mongo.DeleteResult>;
|
|
183
180
|
deleteManyEventsEnded(params: {
|
|
184
|
-
typeOf: {
|
|
185
|
-
$eq: factory.eventType.ScreeningEvent;
|
|
186
|
-
};
|
|
187
181
|
endDate: {
|
|
188
182
|
$lte: Date;
|
|
189
183
|
};
|
|
@@ -155,8 +155,7 @@ class AdminEventRepo {
|
|
|
155
155
|
}
|
|
156
156
|
const doc = await this.eventModel.findOneAndUpdate({
|
|
157
157
|
_id: { $eq: params.id },
|
|
158
|
-
'project.id': { $eq: params.project.id }
|
|
159
|
-
typeOf: { $eq: typeOf }
|
|
158
|
+
'project.id': { $eq: params.project.id }
|
|
160
159
|
}, {
|
|
161
160
|
$set: updateFields
|
|
162
161
|
}, { upsert: false, new: false, projection: { _id: 1 } })
|
|
@@ -187,8 +186,7 @@ class AdminEventRepo {
|
|
|
187
186
|
}
|
|
188
187
|
try {
|
|
189
188
|
doc = await this.eventModel.findOneAndUpdate({
|
|
190
|
-
_id: { $eq: params.id }
|
|
191
|
-
typeOf: { $eq: typeOf }
|
|
189
|
+
_id: { $eq: params.id }
|
|
192
190
|
}, {
|
|
193
191
|
// 編集のためのみのメソッドになったので、setOnInsertは廃止(2025-10-27~)
|
|
194
192
|
// 上書き禁止属性を除外(2022-08-24~)
|
|
@@ -231,8 +229,7 @@ class AdminEventRepo {
|
|
|
231
229
|
bulkWriteOps.push({
|
|
232
230
|
updateOne: {
|
|
233
231
|
filter: {
|
|
234
|
-
_id: p.id
|
|
235
|
-
typeOf: p.attributes.typeOf
|
|
232
|
+
_id: p.id
|
|
236
233
|
},
|
|
237
234
|
update: {
|
|
238
235
|
$setOnInsert: {
|
|
@@ -279,7 +276,6 @@ class AdminEventRepo {
|
|
|
279
276
|
async syncScreeningEventSeries2screeningEvents(params) {
|
|
280
277
|
const superEvent = EventFactory.minimizeSuperEvent({ superEventFromDB: params.superEventFromDB });
|
|
281
278
|
await this.eventModel.updateMany({
|
|
282
|
-
typeOf: { $eq: factory_1.factory.eventType.ScreeningEvent },
|
|
283
279
|
'project.id': { $eq: params.project.id },
|
|
284
280
|
'superEvent.id': { $exists: true, $eq: params.superEventFromDB.id },
|
|
285
281
|
startDate: { $gte: params.startDate.$gte }
|
|
@@ -338,7 +334,6 @@ class AdminEventRepo {
|
|
|
338
334
|
}
|
|
339
335
|
async deleteManyEventsEndedByProject(params) {
|
|
340
336
|
return this.eventModel.deleteMany({
|
|
341
|
-
typeOf: { $in: params.typeOf.$in },
|
|
342
337
|
'project.id': { $eq: params.project.id },
|
|
343
338
|
endDate: { $lte: params.endDate.$lte }
|
|
344
339
|
})
|
|
@@ -346,7 +341,6 @@ class AdminEventRepo {
|
|
|
346
341
|
}
|
|
347
342
|
async deleteManyEventsEnded(params) {
|
|
348
343
|
return this.eventModel.deleteMany({
|
|
349
|
-
typeOf: { $eq: params.typeOf.$eq },
|
|
350
344
|
endDate: { $lte: params.endDate.$lte }
|
|
351
345
|
})
|
|
352
346
|
.exec();
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { Connection, FilterQuery, mongo } from 'mongoose';
|
|
2
|
+
import { factory } from '../factory';
|
|
3
|
+
type IUnset = {
|
|
4
|
+
[key in keyof factory.eventSeries.IEvent]?: 1;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* 施設コンテンツ管理リポジトリ
|
|
8
|
+
*/
|
|
9
|
+
export declare class AdminEventSeriesRepo {
|
|
10
|
+
private readonly eventSeriesModel;
|
|
11
|
+
constructor(connection: Connection);
|
|
12
|
+
/**
|
|
13
|
+
* 施設+コンテンツ+バージョンをキーにして冪等置換
|
|
14
|
+
*/
|
|
15
|
+
upsertByVersion(params: {
|
|
16
|
+
$set: factory.eventSeries.IAttributes;
|
|
17
|
+
$unset?: IUnset;
|
|
18
|
+
}[], options: {
|
|
19
|
+
/**
|
|
20
|
+
* falseの場合setOnInsertのみ
|
|
21
|
+
* trueの場合setOnInsert+setのみ
|
|
22
|
+
*/
|
|
23
|
+
upsert: boolean;
|
|
24
|
+
}): Promise<{
|
|
25
|
+
bulkWriteResult?: mongo.BulkWriteResult;
|
|
26
|
+
modifiedEvents: {
|
|
27
|
+
id: string;
|
|
28
|
+
}[];
|
|
29
|
+
}>;
|
|
30
|
+
/**
|
|
31
|
+
* sskts施設コンテンツ保管
|
|
32
|
+
*/
|
|
33
|
+
upsertManyEventSeriesById4sskts(params: {
|
|
34
|
+
id: string;
|
|
35
|
+
attributes: factory.eventSeries.IAttributes;
|
|
36
|
+
}[]): Promise<void>;
|
|
37
|
+
deleteEventSeriesById(params: {
|
|
38
|
+
project: {
|
|
39
|
+
id: string;
|
|
40
|
+
};
|
|
41
|
+
id: string;
|
|
42
|
+
}): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* 既存施設コンテンツの最大バージョンを集計する
|
|
45
|
+
*/
|
|
46
|
+
aggregateMaxVersion(params: {
|
|
47
|
+
project: {
|
|
48
|
+
id: {
|
|
49
|
+
$eq: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
workPerformed: {
|
|
53
|
+
identifier: {
|
|
54
|
+
$eq: string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
location: {
|
|
58
|
+
branchCode: {
|
|
59
|
+
$in: string[];
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
}): Promise<{
|
|
63
|
+
maxVersion: string;
|
|
64
|
+
}>;
|
|
65
|
+
getCursor(conditions: FilterQuery<any>, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, factory.eventSeries.IAttributes & {
|
|
66
|
+
_id: string;
|
|
67
|
+
}, import("./mongoose/virtuals").IVirtuals, {}> & factory.eventSeries.IAttributes & {
|
|
68
|
+
_id: string;
|
|
69
|
+
} & Required<{
|
|
70
|
+
_id: string;
|
|
71
|
+
}> & {
|
|
72
|
+
__v: number;
|
|
73
|
+
}, import("mongoose").QueryOptions<factory.eventSeries.IAttributes & {
|
|
74
|
+
_id: string;
|
|
75
|
+
}>, (import("mongoose").Document<unknown, Record<string, never>, factory.eventSeries.IAttributes & {
|
|
76
|
+
_id: string;
|
|
77
|
+
}, import("./mongoose/virtuals").IVirtuals, {}> & factory.eventSeries.IAttributes & {
|
|
78
|
+
_id: string;
|
|
79
|
+
} & Required<{
|
|
80
|
+
_id: string;
|
|
81
|
+
}> & {
|
|
82
|
+
__v: number;
|
|
83
|
+
}) | null>;
|
|
84
|
+
unsetUnnecessaryFields(params: {
|
|
85
|
+
filter: FilterQuery<factory.eventSeries.IEvent>;
|
|
86
|
+
$unset: IUnset;
|
|
87
|
+
}): Promise<import("mongoose").UpdateWriteOpResult>;
|
|
88
|
+
}
|
|
89
|
+
export {};
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AdminEventSeriesRepo = void 0;
|
|
4
|
+
const factory_1 = require("../factory");
|
|
5
|
+
const eventSeries_1 = require("./mongoose/schemas/eventSeries");
|
|
6
|
+
/**
|
|
7
|
+
* 施設コンテンツ管理リポジトリ
|
|
8
|
+
*/
|
|
9
|
+
class AdminEventSeriesRepo {
|
|
10
|
+
eventSeriesModel;
|
|
11
|
+
constructor(connection) {
|
|
12
|
+
this.eventSeriesModel = connection.model(eventSeries_1.modelName, (0, eventSeries_1.createSchema)());
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* 施設+コンテンツ+バージョンをキーにして冪等置換
|
|
16
|
+
*/
|
|
17
|
+
async upsertByVersion(params, options) {
|
|
18
|
+
const { upsert } = options;
|
|
19
|
+
const { default: uniqid } = await import('uniqid');
|
|
20
|
+
const bulkWriteOps = [];
|
|
21
|
+
const queryFilters = [];
|
|
22
|
+
if (Array.isArray(params)) {
|
|
23
|
+
params.forEach(({ $set, $unset }) => {
|
|
24
|
+
const version = $set.workPerformed.version;
|
|
25
|
+
if (typeof version !== 'string' || version.length === 0) {
|
|
26
|
+
throw new factory_1.factory.errors.ArgumentNull('workPerformed.version');
|
|
27
|
+
}
|
|
28
|
+
// リソースのユニークネスを保証するfilter
|
|
29
|
+
const filter = {
|
|
30
|
+
'project.id': { $eq: $set.project.id },
|
|
31
|
+
'location.branchCode': { $exists: true, $eq: $set.location.branchCode },
|
|
32
|
+
'workPerformed.identifier': { $exists: true, $eq: $set.workPerformed.identifier },
|
|
33
|
+
'workPerformed.version': { $exists: true, $eq: version }
|
|
34
|
+
};
|
|
35
|
+
queryFilters.push({
|
|
36
|
+
'project.id': { $eq: $set.project.id },
|
|
37
|
+
'location.branchCode': { $exists: true, $eq: $set.location.branchCode },
|
|
38
|
+
'workPerformed.identifier': { $exists: true, $eq: $set.workPerformed.identifier },
|
|
39
|
+
'workPerformed.version': { $exists: true, $eq: version }
|
|
40
|
+
});
|
|
41
|
+
const { identifier, project, typeOf, ...setFields } = $set; // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
42
|
+
const setOnInsert = {
|
|
43
|
+
project,
|
|
44
|
+
typeOf,
|
|
45
|
+
_id: uniqid()
|
|
46
|
+
};
|
|
47
|
+
let updateOne;
|
|
48
|
+
if (upsert === true) {
|
|
49
|
+
updateOne = {
|
|
50
|
+
filter,
|
|
51
|
+
update: {
|
|
52
|
+
$setOnInsert: setOnInsert,
|
|
53
|
+
$set: setFields,
|
|
54
|
+
...($unset !== undefined) ? { $unset } : undefined
|
|
55
|
+
},
|
|
56
|
+
upsert: true
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
updateOne = {
|
|
61
|
+
filter,
|
|
62
|
+
update: {
|
|
63
|
+
$setOnInsert: {
|
|
64
|
+
...setOnInsert,
|
|
65
|
+
...setFields
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
upsert: true
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
bulkWriteOps.push({ updateOne });
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
if (bulkWriteOps.length > 0) {
|
|
75
|
+
const bulkWriteResult = await this.eventSeriesModel.bulkWrite(bulkWriteOps, { ordered: false });
|
|
76
|
+
// upsert:falseの場合、upsertedIdsのみmodifiedEventsとして返せばよい(2026-01-27~)
|
|
77
|
+
if (!upsert) {
|
|
78
|
+
// BulkWriteResult -> upsertedIds: { '0': '7iri6p4m54k0r3g' }
|
|
79
|
+
return {
|
|
80
|
+
bulkWriteResult,
|
|
81
|
+
modifiedEvents: Object.values(bulkWriteResult.upsertedIds)
|
|
82
|
+
.map((id) => ({ id: String(id) }))
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
// modifiedの場合upsertedIdsに含まれないので、idを検索する
|
|
87
|
+
const modifiedEvents = await this.eventSeriesModel.find({ $or: queryFilters }, { _id: 1 })
|
|
88
|
+
.exec();
|
|
89
|
+
return { bulkWriteResult, modifiedEvents };
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return { modifiedEvents: [] };
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* sskts施設コンテンツ保管
|
|
96
|
+
*/
|
|
97
|
+
async upsertManyEventSeriesById4sskts(params) {
|
|
98
|
+
const bulkWriteOps = [];
|
|
99
|
+
if (Array.isArray(params)) {
|
|
100
|
+
params.forEach((p) => {
|
|
101
|
+
// 上書き禁止属性を除外(2022-08-24~)
|
|
102
|
+
const { identifier, project, typeOf, ...updateFields } = p.attributes; // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
103
|
+
bulkWriteOps.push({
|
|
104
|
+
updateOne: {
|
|
105
|
+
filter: { _id: { $eq: p.id } },
|
|
106
|
+
update: {
|
|
107
|
+
$setOnInsert: {
|
|
108
|
+
typeOf: factory_1.factory.eventType.ScreeningEventSeries,
|
|
109
|
+
project: p.attributes.project,
|
|
110
|
+
...(typeof p.attributes.identifier === 'string')
|
|
111
|
+
? { identifier: p.attributes.identifier } : undefined
|
|
112
|
+
},
|
|
113
|
+
$set: updateFields
|
|
114
|
+
// $unsetに対応(2022-08-31~)
|
|
115
|
+
// ...(p.$unset !== undefined) ? { $unset: p.$unset } : undefined
|
|
116
|
+
},
|
|
117
|
+
upsert: true
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
if (bulkWriteOps.length > 0) {
|
|
123
|
+
await this.eventSeriesModel.bulkWrite(bulkWriteOps, { ordered: false });
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
async deleteEventSeriesById(params) {
|
|
127
|
+
await this.eventSeriesModel.findOneAndDelete({
|
|
128
|
+
_id: { $eq: params.id },
|
|
129
|
+
'project.id': { $eq: params.project.id }
|
|
130
|
+
}, { projection: { _id: 1 } })
|
|
131
|
+
.exec();
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* 既存施設コンテンツの最大バージョンを集計する
|
|
135
|
+
*/
|
|
136
|
+
async aggregateMaxVersion(params) {
|
|
137
|
+
const aggregations = await this.eventSeriesModel.aggregate([
|
|
138
|
+
{
|
|
139
|
+
$match: {
|
|
140
|
+
'project.id': { $eq: params.project.id.$eq },
|
|
141
|
+
'workPerformed.identifier': { $exists: true, $eq: params.workPerformed.identifier.$eq },
|
|
142
|
+
'workPerformed.version': { $exists: true },
|
|
143
|
+
'location.branchCode': { $exists: true, $in: params.location.branchCode.$in }
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
$project: {
|
|
148
|
+
// workPerformed: '$workPerformed',
|
|
149
|
+
version: { $toLong: '$workPerformed.version' } // support YYYYMMDDHHmmss
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
$group: {
|
|
154
|
+
_id: null,
|
|
155
|
+
maxVersion: { $max: '$version' }
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
])
|
|
159
|
+
.exec();
|
|
160
|
+
const firstMaxVersion = aggregations.at(0)?.maxVersion;
|
|
161
|
+
const maxVersion = (typeof firstMaxVersion === 'number') ? String(firstMaxVersion) : '0';
|
|
162
|
+
return { maxVersion };
|
|
163
|
+
}
|
|
164
|
+
getCursor(conditions, projection) {
|
|
165
|
+
return this.eventSeriesModel.find(conditions, projection)
|
|
166
|
+
.sort({ startDate: factory_1.factory.sortType.Descending })
|
|
167
|
+
.cursor();
|
|
168
|
+
}
|
|
169
|
+
async unsetUnnecessaryFields(params) {
|
|
170
|
+
return this.eventSeriesModel.updateMany(params.filter, { $unset: params.$unset }, { timestamps: false })
|
|
171
|
+
.exec();
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
exports.AdminEventSeriesRepo = AdminEventSeriesRepo;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Connection } from 'mongoose';
|
|
2
2
|
import { factory } from '../factory';
|
|
3
|
-
import { IDocType } from './mongoose/schemas/transaction';
|
|
4
3
|
/**
|
|
5
4
|
* 取引管理リポジトリ
|
|
6
5
|
*/
|
|
@@ -43,7 +42,7 @@ export declare class AdminTransactionRepo {
|
|
|
43
42
|
expires: {
|
|
44
43
|
$lt: Date;
|
|
45
44
|
};
|
|
46
|
-
}): Promise<Pick<factory.transaction.ITransaction
|
|
45
|
+
}): Promise<Pick<factory.transaction.placeOrder.ITransaction, 'id' | 'typeOf'> | undefined>;
|
|
47
46
|
findByIdAndDelete(params: {
|
|
48
47
|
id: string;
|
|
49
48
|
}): Promise<void>;
|
|
@@ -51,9 +50,8 @@ export declare class AdminTransactionRepo {
|
|
|
51
50
|
filter: any;
|
|
52
51
|
$unset: any;
|
|
53
52
|
}): Promise<import("mongoose").UpdateWriteOpResult>;
|
|
54
|
-
getCursor(conditions: any, projection: any, sort?: factory.sortType): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>,
|
|
53
|
+
getCursor(conditions: any, projection: any, sort?: factory.sortType): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, {
|
|
55
54
|
object: import("@chevre/factory/lib/chevre/transaction/placeOrder").IObject;
|
|
56
|
-
error?: any;
|
|
57
55
|
project: import("@chevre/factory/lib/chevre/transaction").IProject;
|
|
58
56
|
seller: import("@chevre/factory/lib/chevre/transaction/placeOrder").ISeller;
|
|
59
57
|
typeOf: factory.transactionType.PlaceOrder;
|
|
@@ -64,34 +62,26 @@ export declare class AdminTransactionRepo {
|
|
|
64
62
|
instrument?: import("@chevre/factory/lib/chevre/transaction/placeOrder").IInstrument | undefined;
|
|
65
63
|
agent: import("@chevre/factory/lib/chevre/transaction/placeOrder").IAgent;
|
|
66
64
|
status: factory.transactionStatusType;
|
|
67
|
-
tasksExportAction?: import("@chevre/factory/lib/chevre/transaction").ITasksExportAction | undefined;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
_id: import("mongoose").Types.ObjectId;
|
|
71
|
-
} & {
|
|
72
|
-
__v: number;
|
|
73
|
-
}) | ({
|
|
74
|
-
object: import("@chevre/factory/lib/chevre/transaction/returnOrder").IObject;
|
|
75
|
-
error?: any;
|
|
65
|
+
tasksExportAction?: import("@chevre/factory/lib/chevre/transaction/placeOrder").ITasksExportAction | undefined;
|
|
66
|
+
}, import("./mongoose/virtuals").IVirtuals, {}> & {
|
|
67
|
+
object: import("@chevre/factory/lib/chevre/transaction/placeOrder").IObject;
|
|
76
68
|
project: import("@chevre/factory/lib/chevre/transaction").IProject;
|
|
77
|
-
seller: import("@chevre/factory/lib/chevre/transaction").ISeller;
|
|
78
|
-
typeOf: factory.transactionType.
|
|
69
|
+
seller: import("@chevre/factory/lib/chevre/transaction/placeOrder").ISeller;
|
|
70
|
+
typeOf: factory.transactionType.PlaceOrder;
|
|
79
71
|
expires: Date;
|
|
80
|
-
result?: import("@chevre/factory/lib/chevre/transaction/
|
|
72
|
+
result?: import("@chevre/factory/lib/chevre/transaction/placeOrder").IResult | undefined;
|
|
81
73
|
startDate: Date;
|
|
82
74
|
endDate?: Date | undefined;
|
|
83
|
-
|
|
84
|
-
|
|
75
|
+
instrument?: import("@chevre/factory/lib/chevre/transaction/placeOrder").IInstrument | undefined;
|
|
76
|
+
agent: import("@chevre/factory/lib/chevre/transaction/placeOrder").IAgent;
|
|
85
77
|
status: factory.transactionStatusType;
|
|
86
|
-
tasksExportAction?: import("@chevre/factory/lib/chevre/transaction").ITasksExportAction | undefined;
|
|
87
|
-
potentialActions?: import("@chevre/factory/lib/chevre/transaction/returnOrder").IPotentialActions | undefined;
|
|
78
|
+
tasksExportAction?: import("@chevre/factory/lib/chevre/transaction/placeOrder").ITasksExportAction | undefined;
|
|
88
79
|
} & {
|
|
89
80
|
_id: import("mongoose").Types.ObjectId;
|
|
90
81
|
} & {
|
|
91
82
|
__v: number;
|
|
92
|
-
}
|
|
83
|
+
}, import("mongoose").QueryOptions<{
|
|
93
84
|
object: import("@chevre/factory/lib/chevre/transaction/placeOrder").IObject;
|
|
94
|
-
error?: any;
|
|
95
85
|
project: import("@chevre/factory/lib/chevre/transaction").IProject;
|
|
96
86
|
seller: import("@chevre/factory/lib/chevre/transaction/placeOrder").ISeller;
|
|
97
87
|
typeOf: factory.transactionType.PlaceOrder;
|
|
@@ -102,30 +92,36 @@ export declare class AdminTransactionRepo {
|
|
|
102
92
|
instrument?: import("@chevre/factory/lib/chevre/transaction/placeOrder").IInstrument | undefined;
|
|
103
93
|
agent: import("@chevre/factory/lib/chevre/transaction/placeOrder").IAgent;
|
|
104
94
|
status: factory.transactionStatusType;
|
|
105
|
-
tasksExportAction?: import("@chevre/factory/lib/chevre/transaction").ITasksExportAction | undefined;
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
_id: import("mongoose").Types.ObjectId;
|
|
109
|
-
} & {
|
|
110
|
-
__v: number;
|
|
111
|
-
}) | ({
|
|
112
|
-
object: import("@chevre/factory/lib/chevre/transaction/returnOrder").IObject;
|
|
113
|
-
error?: any;
|
|
95
|
+
tasksExportAction?: import("@chevre/factory/lib/chevre/transaction/placeOrder").ITasksExportAction | undefined;
|
|
96
|
+
}>, (import("mongoose").Document<unknown, Record<string, never>, {
|
|
97
|
+
object: import("@chevre/factory/lib/chevre/transaction/placeOrder").IObject;
|
|
114
98
|
project: import("@chevre/factory/lib/chevre/transaction").IProject;
|
|
115
|
-
seller: import("@chevre/factory/lib/chevre/transaction").ISeller;
|
|
116
|
-
typeOf: factory.transactionType.
|
|
99
|
+
seller: import("@chevre/factory/lib/chevre/transaction/placeOrder").ISeller;
|
|
100
|
+
typeOf: factory.transactionType.PlaceOrder;
|
|
117
101
|
expires: Date;
|
|
118
|
-
result?: import("@chevre/factory/lib/chevre/transaction/
|
|
102
|
+
result?: import("@chevre/factory/lib/chevre/transaction/placeOrder").IResult | undefined;
|
|
119
103
|
startDate: Date;
|
|
120
104
|
endDate?: Date | undefined;
|
|
121
|
-
|
|
122
|
-
|
|
105
|
+
instrument?: import("@chevre/factory/lib/chevre/transaction/placeOrder").IInstrument | undefined;
|
|
106
|
+
agent: import("@chevre/factory/lib/chevre/transaction/placeOrder").IAgent;
|
|
107
|
+
status: factory.transactionStatusType;
|
|
108
|
+
tasksExportAction?: import("@chevre/factory/lib/chevre/transaction/placeOrder").ITasksExportAction | undefined;
|
|
109
|
+
}, import("./mongoose/virtuals").IVirtuals, {}> & {
|
|
110
|
+
object: import("@chevre/factory/lib/chevre/transaction/placeOrder").IObject;
|
|
111
|
+
project: import("@chevre/factory/lib/chevre/transaction").IProject;
|
|
112
|
+
seller: import("@chevre/factory/lib/chevre/transaction/placeOrder").ISeller;
|
|
113
|
+
typeOf: factory.transactionType.PlaceOrder;
|
|
114
|
+
expires: Date;
|
|
115
|
+
result?: import("@chevre/factory/lib/chevre/transaction/placeOrder").IResult | undefined;
|
|
116
|
+
startDate: Date;
|
|
117
|
+
endDate?: Date | undefined;
|
|
118
|
+
instrument?: import("@chevre/factory/lib/chevre/transaction/placeOrder").IInstrument | undefined;
|
|
119
|
+
agent: import("@chevre/factory/lib/chevre/transaction/placeOrder").IAgent;
|
|
123
120
|
status: factory.transactionStatusType;
|
|
124
|
-
tasksExportAction?: import("@chevre/factory/lib/chevre/transaction").ITasksExportAction | undefined;
|
|
125
|
-
potentialActions?: import("@chevre/factory/lib/chevre/transaction/returnOrder").IPotentialActions | undefined;
|
|
121
|
+
tasksExportAction?: import("@chevre/factory/lib/chevre/transaction/placeOrder").ITasksExportAction | undefined;
|
|
126
122
|
} & {
|
|
127
123
|
_id: import("mongoose").Types.ObjectId;
|
|
128
124
|
} & {
|
|
129
125
|
__v: number;
|
|
130
|
-
})
|
|
126
|
+
}) | null>;
|
|
131
127
|
}
|
|
@@ -68,51 +68,6 @@ class AdminTransactionRepo {
|
|
|
68
68
|
})
|
|
69
69
|
.exec();
|
|
70
70
|
}
|
|
71
|
-
// /**
|
|
72
|
-
// * タスクエクスポートの遅延している取引について明示的にemitTransactionStatusChangedを実行する
|
|
73
|
-
// */
|
|
74
|
-
// public async exportTasksMany(params: {
|
|
75
|
-
// now: Date;
|
|
76
|
-
// delayInSeconds: number;
|
|
77
|
-
// status: {
|
|
78
|
-
// $in: factory.transactionStatusType[];
|
|
79
|
-
// };
|
|
80
|
-
// limit: number;
|
|
81
|
-
// }) {
|
|
82
|
-
// const delayedTransactions = await this.transactionModel.find({
|
|
83
|
-
// status: { $in: params.status.$in },
|
|
84
|
-
// 'tasksExportAction.actionStatus': {
|
|
85
|
-
// $exists: true,
|
|
86
|
-
// $eq: factory.actionStatusType.PotentialActionStatus
|
|
87
|
-
// },
|
|
88
|
-
// endDate: {
|
|
89
|
-
// $exists: true,
|
|
90
|
-
// $lt: moment(params.now)
|
|
91
|
-
// .add(-params.delayInSeconds, 'seconds')
|
|
92
|
-
// .toDate()
|
|
93
|
-
// }
|
|
94
|
-
// })
|
|
95
|
-
// .select({
|
|
96
|
-
// _id: 0,
|
|
97
|
-
// id: { $toString: '$_id' },
|
|
98
|
-
// typeOf: 1,
|
|
99
|
-
// status: 1
|
|
100
|
-
// })
|
|
101
|
-
// .limit(params.limit)
|
|
102
|
-
// .setOptions({ maxTimeMS: MONGO_MAX_TIME_MS })
|
|
103
|
-
// .lean<Pick<factory.transaction.ITransaction<factory.transactionType>, 'id' | 'status' | 'typeOf'>[]>()
|
|
104
|
-
// .exec();
|
|
105
|
-
// if (delayedTransactions.length > 0) {
|
|
106
|
-
// delayedTransactions.forEach((delayedTransaction) => {
|
|
107
|
-
// transactionEventEmitter.emitTransactionStatusChanged({
|
|
108
|
-
// id: delayedTransaction.id,
|
|
109
|
-
// typeOf: delayedTransaction.typeOf,
|
|
110
|
-
// status: delayedTransaction.status
|
|
111
|
-
// });
|
|
112
|
-
// });
|
|
113
|
-
// }
|
|
114
|
-
// return delayedTransactions;
|
|
115
|
-
// }
|
|
116
71
|
/**
|
|
117
72
|
* add(2025-03-13~)
|
|
118
73
|
*/
|
|
@@ -167,59 +122,6 @@ class AdminTransactionRepo {
|
|
|
167
122
|
return doc;
|
|
168
123
|
}
|
|
169
124
|
}
|
|
170
|
-
// /**
|
|
171
|
-
// * 取引を期限切れにする
|
|
172
|
-
// */
|
|
173
|
-
// public async makeExpired(params: {
|
|
174
|
-
// expires: { $lt: Date };
|
|
175
|
-
// limit: number; // add limit(2025-02-27~)
|
|
176
|
-
// }): Promise<Pick<factory.transaction.ITransaction<factory.transactionType>, 'id' | 'typeOf'>[]> {
|
|
177
|
-
// if (typeof params.limit !== 'number' || params.limit === 0) {
|
|
178
|
-
// throw new factory.errors.ArgumentNull('limit');
|
|
179
|
-
// }
|
|
180
|
-
// const sort: { [key in keyof factory.transaction.ITransaction<factory.transactionType>]?: factory.sortType } = {
|
|
181
|
-
// expires: factory.sortType.Ascending
|
|
182
|
-
// };
|
|
183
|
-
// // IDをemitしたいのでまずリスト検索(2023-04-27~)
|
|
184
|
-
// const expiringTransactions =
|
|
185
|
-
// await this.transactionModel.find({
|
|
186
|
-
// status: { $eq: factory.transactionStatusType.InProgress },
|
|
187
|
-
// expires: { $lt: params.expires.$lt }
|
|
188
|
-
// })
|
|
189
|
-
// .select({
|
|
190
|
-
// _id: 0,
|
|
191
|
-
// id: { $toString: '$_id' },
|
|
192
|
-
// typeOf: 1
|
|
193
|
-
// })
|
|
194
|
-
// .limit(params.limit)
|
|
195
|
-
// .sort(sort) // sort(2025-03-03~)
|
|
196
|
-
// .setOptions({ maxTimeMS: MONGO_MAX_TIME_MS })
|
|
197
|
-
// .lean<Pick<factory.transaction.ITransaction<factory.transactionType>, 'id' | 'typeOf'>[]>()
|
|
198
|
-
// .exec();
|
|
199
|
-
// if (expiringTransactions.length > 0) {
|
|
200
|
-
// // ステータスと期限を見て更新
|
|
201
|
-
// await this.transactionModel.updateMany(
|
|
202
|
-
// {
|
|
203
|
-
// _id: { $in: expiringTransactions.map((t) => t.id) },
|
|
204
|
-
// status: { $eq: factory.transactionStatusType.InProgress },
|
|
205
|
-
// expires: { $lt: params.expires.$lt }
|
|
206
|
-
// },
|
|
207
|
-
// {
|
|
208
|
-
// status: factory.transactionStatusType.Expired,
|
|
209
|
-
// endDate: new Date()
|
|
210
|
-
// }
|
|
211
|
-
// )
|
|
212
|
-
// .exec();
|
|
213
|
-
// expiringTransactions.forEach((expiringTransaction) => {
|
|
214
|
-
// transactionEventEmitter.emitTransactionStatusChanged({
|
|
215
|
-
// id: expiringTransaction.id,
|
|
216
|
-
// typeOf: expiringTransaction.typeOf,
|
|
217
|
-
// status: factory.transactionStatusType.Expired
|
|
218
|
-
// });
|
|
219
|
-
// });
|
|
220
|
-
// }
|
|
221
|
-
// return expiringTransactions;
|
|
222
|
-
// }
|
|
223
125
|
async findByIdAndDelete(params) {
|
|
224
126
|
await this.transactionModel.findByIdAndDelete(params.id)
|
|
225
127
|
.exec();
|
|
@@ -22,7 +22,6 @@ class AggregateEventRepo {
|
|
|
22
22
|
$gte: params.startFrom,
|
|
23
23
|
$lte: params.startThrough
|
|
24
24
|
},
|
|
25
|
-
typeOf: { $eq: params.typeOf },
|
|
26
25
|
eventStatus: { $eq: eventStatus },
|
|
27
26
|
...(typeof params.project?.id?.$ne === 'string')
|
|
28
27
|
? { 'project.id': { $ne: params.project.id.$ne } }
|
|
@@ -22,7 +22,6 @@ class AggregateTransactionRepo {
|
|
|
22
22
|
$gte: params.startFrom,
|
|
23
23
|
$lte: params.startThrough
|
|
24
24
|
},
|
|
25
|
-
typeOf: { $eq: params.typeOf },
|
|
26
25
|
status: { $eq: transactionStatus },
|
|
27
26
|
...(typeof params.project?.id?.$ne === 'string')
|
|
28
27
|
? { 'project.id': { $ne: params.project.id.$ne } }
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Connection, FilterQuery } from 'mongoose';
|
|
2
2
|
import { factory } from '../factory';
|
|
3
3
|
import * as EventFactory from '../factory/event';
|
|
4
|
-
export type ISearchConditions = factory.event.screeningEvent.ISearchConditions;
|
|
4
|
+
export type ISearchConditions = Pick<factory.event.screeningEvent.ISearchConditions, 'additionalProperty' | 'endFrom' | 'endThrough' | 'eventStatuses' | 'id' | 'identifiers' | 'inSessionFrom' | 'inSessionThrough' | 'limit' | 'location' | 'offers' | 'organizer' | 'page' | 'project' | 'sort' | 'startFrom' | 'startThrough' | 'superEvent'> & {};
|
|
5
5
|
export import IMinimizedIndividualEvent = EventFactory.IMinimizedIndividualEvent;
|
|
6
6
|
type IKeyOfProjection = Exclude<keyof factory.event.screeningEvent.IEvent, 'id'> | 'aggregateOffer' | 'superEvent.location.id' | 'offers.itemOffered' | 'offers.itemOffered.id' | 'offers.typeOf';
|
|
7
7
|
type IKeyOfProjection4publicFields = Exclude<keyof factory.event.screeningEvent.IEvent, 'id' | 'offers'>;
|
|
@@ -60,7 +60,7 @@ export declare class EventRepo {
|
|
|
60
60
|
/**
|
|
61
61
|
* COAイベントキャンセル時に使用
|
|
62
62
|
*/
|
|
63
|
-
searchEventIds(params: Pick<ISearchConditions, 'project' | '
|
|
63
|
+
searchEventIds(params: Pick<ISearchConditions, 'project' | 'superEvent' | 'startFrom' | 'startThrough'>): Promise<string[]>;
|
|
64
64
|
/**
|
|
65
65
|
* 特定イベントから指定フィールドのみ取得する
|
|
66
66
|
* イベント IDは必ず返ります
|