@chevre/domain 21.2.0-alpha.7 → 21.2.0-alpha.71
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/example/src/chevre/aggregation/aggregateSystem.ts +58 -31
- package/example/src/chevre/countDelayedTasks.ts +17 -0
- package/example/src/chevre/countDelayedTransactions.ts +60 -0
- package/example/src/chevre/countMoneyTransferTransaction.ts +36 -0
- package/example/src/chevre/createManyEventsIfNotExist.ts +4 -1
- package/example/src/chevre/deleteTasksByName.ts +10 -2
- package/example/src/chevre/importEventsFromCOA.ts +3 -4
- package/example/src/chevre/migrateOrderAdditionalProperties.ts +85 -0
- package/example/src/chevre/saveTasks.ts +13 -10
- package/example/src/chevre/searchAbortedTasks.ts +36 -0
- package/example/src/chevre/searchReservationNumbersByOrderNumbers.ts +37 -1
- package/example/src/chevre/searchSellers.ts +22 -0
- package/example/src/chevre/searchSendEmailActions.ts +44 -0
- package/example/src/chevre/task/executeTasks.ts +26 -0
- package/example/src/chevre/transaction/findCreditCard.ts +1 -1
- package/example/src/chevre/transaction/orderMembershipService.ts +1 -1
- package/example/src/chevre/transaction/processReturnOrder.ts +40 -0
- package/example/src/chevre/transaction/startExportTasks.ts +20 -0
- package/example/src/chevre/updateTransaction.ts +1 -1
- package/example/src/playOnMoment.ts +24 -0
- package/lib/chevre/credentials.d.ts +1 -0
- package/lib/chevre/credentials.js +2 -1
- package/lib/chevre/eventEmitter/assetTransaction.d.ts +21 -0
- package/lib/chevre/eventEmitter/assetTransaction.js +25 -0
- package/lib/chevre/eventEmitter/task.d.ts +18 -0
- package/lib/chevre/eventEmitter/task.js +25 -0
- package/lib/chevre/eventEmitter/transaction.d.ts +21 -0
- package/lib/chevre/eventEmitter/transaction.js +25 -0
- package/lib/chevre/eventEmitter.d.ts +4 -0
- package/lib/chevre/eventEmitter.js +9 -0
- package/lib/chevre/index.d.ts +3 -2
- package/lib/chevre/index.js +5 -3
- package/lib/chevre/repo/accountTransaction.d.ts +3 -11
- package/lib/chevre/repo/accountTransaction.js +1 -54
- package/lib/chevre/repo/action.d.ts +29 -1
- package/lib/chevre/repo/action.js +32 -25
- package/lib/chevre/repo/assetTransaction.d.ts +24 -9
- package/lib/chevre/repo/assetTransaction.js +207 -64
- package/lib/chevre/repo/comment.d.ts +4 -1
- package/lib/chevre/repo/comment.js +20 -5
- package/lib/chevre/repo/confirmationNumber.d.ts +0 -1
- package/lib/chevre/repo/confirmationNumber.js +3 -15
- package/lib/chevre/repo/creativeWork.d.ts +1 -3
- package/lib/chevre/repo/emailMessage.d.ts +1 -27
- package/lib/chevre/repo/event.d.ts +5 -1
- package/lib/chevre/repo/merchantReturnPolicy.d.ts +1 -3
- package/lib/chevre/repo/mongoose/schemas/account.d.ts +5 -2
- package/lib/chevre/repo/mongoose/schemas/account.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/accountTitle.d.ts +30 -3
- package/lib/chevre/repo/mongoose/schemas/accountTitle.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/accountTransaction.d.ts +32 -3
- package/lib/chevre/repo/mongoose/schemas/accountTransaction.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/accountingReport.d.ts +14 -3
- package/lib/chevre/repo/mongoose/schemas/accountingReport.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/action.d.ts +44 -3
- package/lib/chevre/repo/mongoose/schemas/action.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/additionalProperty.d.ts +18 -3
- package/lib/chevre/repo/mongoose/schemas/additionalProperty.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/aggregation.d.ts +5 -2
- package/lib/chevre/repo/mongoose/schemas/aggregation.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +45 -3
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.js +3 -1
- package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +20 -3
- package/lib/chevre/repo/mongoose/schemas/authorization.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/categoryCode.d.ts +26 -3
- package/lib/chevre/repo/mongoose/schemas/categoryCode.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/comments.d.ts +28 -3
- package/lib/chevre/repo/mongoose/schemas/comments.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +44 -3
- package/lib/chevre/repo/mongoose/schemas/creativeWork.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/customer.d.ts +26 -3
- package/lib/chevre/repo/mongoose/schemas/customer.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +22 -3
- package/lib/chevre/repo/mongoose/schemas/emailMessages.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/event.d.ts +72 -3
- package/lib/chevre/repo/mongoose/schemas/event.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/member.d.ts +14 -3
- package/lib/chevre/repo/mongoose/schemas/member.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.d.ts +22 -3
- package/lib/chevre/repo/mongoose/schemas/merchantReturnPolicy.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/offer.d.ts +66 -3
- package/lib/chevre/repo/mongoose/schemas/offer.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +28 -3
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/offerItemCondition.d.ts +74 -0
- package/lib/chevre/repo/mongoose/schemas/offerItemCondition.js +45 -0
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +52 -3
- package/lib/chevre/repo/mongoose/schemas/order.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/ownershipInfo.d.ts +26 -3
- package/lib/chevre/repo/mongoose/schemas/ownershipInfo.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/place.d.ts +50 -3
- package/lib/chevre/repo/mongoose/schemas/place.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +30 -3
- package/lib/chevre/repo/mongoose/schemas/priceSpecification.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/product.d.ts +32 -3
- package/lib/chevre/repo/mongoose/schemas/product.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/project.d.ts +24 -3
- package/lib/chevre/repo/mongoose/schemas/project.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +62 -3
- package/lib/chevre/repo/mongoose/schemas/reservation.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/role.d.ts +12 -3
- package/lib/chevre/repo/mongoose/schemas/role.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/seller.d.ts +32 -3
- package/lib/chevre/repo/mongoose/schemas/seller.js +7 -0
- package/lib/chevre/repo/mongoose/schemas/serviceOutput.d.ts +12 -3
- package/lib/chevre/repo/mongoose/schemas/serviceOutput.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/task.d.ts +31 -3
- package/lib/chevre/repo/mongoose/schemas/task.js +3 -1
- package/lib/chevre/repo/mongoose/schemas/telemetry.d.ts +22 -3
- package/lib/chevre/repo/mongoose/schemas/telemetry.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +41 -3
- package/lib/chevre/repo/mongoose/schemas/transaction.js +3 -1
- package/lib/chevre/repo/mongoose/schemas/trip.d.ts +12 -3
- package/lib/chevre/repo/mongoose/schemas/trip.js +1 -0
- package/lib/chevre/repo/offerItemCondition.d.ts +22 -0
- package/lib/chevre/repo/offerItemCondition.js +120 -0
- package/lib/chevre/repo/order.d.ts +49 -1
- package/lib/chevre/repo/order.js +44 -3
- package/lib/chevre/repo/reservation.d.ts +3 -1
- package/lib/chevre/repo/seller.js +19 -19
- package/lib/chevre/repo/task.d.ts +45 -2
- package/lib/chevre/repo/task.js +101 -8
- package/lib/chevre/repo/transaction.d.ts +23 -3
- package/lib/chevre/repo/transaction.js +174 -54
- package/lib/chevre/repository.d.ts +5 -2
- package/lib/chevre/repository.js +8 -4
- package/lib/chevre/service/aggregation/system.d.ts +67 -22
- package/lib/chevre/service/aggregation/system.js +101 -89
- package/lib/chevre/service/assetTransaction/cancelReservation.js +1 -28
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +1 -23
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +17 -1
- package/lib/chevre/service/assetTransaction/pay.js +10 -25
- package/lib/chevre/service/assetTransaction/refund.js +1 -23
- package/lib/chevre/service/assetTransaction/registerService.js +1 -25
- package/lib/chevre/service/assetTransaction/reserve/factory.js +15 -15
- package/lib/chevre/service/assetTransaction/reserve.d.ts +5 -1
- package/lib/chevre/service/assetTransaction/reserve.js +8 -28
- package/lib/chevre/service/assetTransaction.d.ts +6 -2
- package/lib/chevre/service/assetTransaction.js +9 -5
- package/lib/chevre/service/event.js +3 -1
- package/lib/chevre/service/notification/factory.js +2 -2
- package/lib/chevre/service/notification.d.ts +3 -1
- package/lib/chevre/service/notification.js +41 -7
- package/lib/chevre/service/offer/event/authorize.js +3 -1
- package/lib/chevre/service/offer/event/factory.d.ts +2 -0
- package/lib/chevre/service/offer/event/factory.js +2 -2
- package/lib/chevre/service/offer/event/voidTransaction.d.ts +2 -0
- package/lib/chevre/service/offer/event/voidTransaction.js +17 -1
- package/lib/chevre/service/offer.js +1 -1
- package/lib/chevre/service/order/deleteOrder.d.ts +3 -1
- package/lib/chevre/service/order/deleteOrder.js +8 -8
- package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +0 -1
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +1 -48
- package/lib/chevre/service/order/onOrderStatusChanged.js +1 -3
- package/lib/chevre/service/order/placeOrder.js +1 -1
- package/lib/chevre/service/order/returnOrder.js +1 -5
- package/lib/chevre/service/order/sendOrder.js +1 -1
- package/lib/chevre/service/payment/any/onPaid.js +1 -1
- package/lib/chevre/service/payment/any/onRefund.js +1 -1
- package/lib/chevre/service/payment/any.js +60 -10
- package/lib/chevre/service/payment/movieTicket/validation.d.ts +3 -2
- package/lib/chevre/service/payment/movieTicket/validation.js +12 -25
- package/lib/chevre/service/payment/movieTicket.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket.js +4 -3
- package/lib/chevre/service/product.js +1 -5
- package/lib/chevre/service/report/telemetry.d.ts +0 -11
- package/lib/chevre/service/report/telemetry.js +21 -24
- package/lib/chevre/service/reserve/cancelReservation.js +2 -4
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +0 -3
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +20 -20
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +2 -3
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -31
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +2 -3
- package/lib/chevre/service/reserve/useReservation.js +1 -8
- package/lib/chevre/service/task/confirmRegisterServiceTransaction.js +1 -1
- package/lib/chevre/service/task/deleteTransaction.js +10 -8
- package/lib/chevre/service/task/importOffersFromCOA.js +4 -0
- package/lib/chevre/service/task/returnPayTransaction.js +2 -12
- package/lib/chevre/service/task/voidReserveTransaction.js +3 -1
- package/lib/chevre/service/task.d.ts +9 -0
- package/lib/chevre/service/task.js +43 -4
- package/lib/chevre/service/transaction/deleteTransaction.d.ts +21 -0
- package/lib/chevre/service/transaction/deleteTransaction.js +232 -0
- package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.js +11 -1
- package/lib/chevre/service/transaction/moneyTransfer/factory.js +3 -1
- package/lib/chevre/service/transaction/moneyTransfer/potentialActions.d.ts +1 -0
- package/lib/chevre/service/transaction/moneyTransfer/potentialActions.js +1 -1
- package/lib/chevre/service/transaction/moneyTransfer.js +9 -12
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +42 -30
- package/lib/chevre/service/transaction/placeOrder.js +1 -5
- package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.d.ts +1 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.d.ts +1 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.d.ts +1 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.d.ts +3 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +7 -3
- package/lib/chevre/service/transaction/placeOrderInProgress/result.d.ts +1 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/result.js +2 -2
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js +2 -2
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.d.ts +2 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +23 -17
- package/lib/chevre/service/transaction/placeOrderInProgress.d.ts +0 -3
- package/lib/chevre/service/transaction/placeOrderInProgress.js +22 -11
- package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +10 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +25 -17
- package/lib/chevre/service/transaction/returnOrder.d.ts +4 -0
- package/lib/chevre/service/transaction/returnOrder.js +225 -35
- package/lib/chevre/service/transaction.d.ts +8 -13
- package/lib/chevre/service/transaction.js +12 -145
- package/lib/chevre/settings.d.ts +4 -1
- package/lib/chevre/settings.js +15 -5
- package/package.json +5 -5
- package/example/src/chevre/migrateMoneyTransferPendingTransactionIdentifier.ts +0 -96
- package/example/src/chevre/migrateMovieAdditionalProperties.ts +0 -98
- package/lib/chevre/service/task/deleteAssetTransaction.d.ts +0 -12
- package/lib/chevre/service/task/deleteAssetTransaction.js +0 -65
- package/lib/chevre/service/task/deleteOrder.d.ts +0 -6
- package/lib/chevre/service/task/deleteOrder.js +0 -35
|
@@ -13,6 +13,7 @@ exports.MongoRepository = void 0;
|
|
|
13
13
|
const moment = require("moment");
|
|
14
14
|
const assetTransaction_1 = require("./mongoose/schemas/assetTransaction");
|
|
15
15
|
const factory = require("../factory");
|
|
16
|
+
const assetTransaction_2 = require("../eventEmitter/assetTransaction");
|
|
16
17
|
/**
|
|
17
18
|
* 資産取引リポジトリ
|
|
18
19
|
*/
|
|
@@ -22,7 +23,7 @@ class MongoRepository {
|
|
|
22
23
|
}
|
|
23
24
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
24
25
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
25
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
|
|
26
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5;
|
|
26
27
|
const andConditions = [
|
|
27
28
|
{
|
|
28
29
|
typeOf: params.typeOf
|
|
@@ -102,6 +103,11 @@ class MongoRepository {
|
|
|
102
103
|
}
|
|
103
104
|
});
|
|
104
105
|
}
|
|
106
|
+
if (Array.isArray(params.tasksExportationStatuses)) {
|
|
107
|
+
andConditions.push({
|
|
108
|
+
tasksExportationStatus: { $in: params.tasksExportationStatuses }
|
|
109
|
+
});
|
|
110
|
+
}
|
|
105
111
|
switch (params.typeOf) {
|
|
106
112
|
case factory.assetTransactionType.Pay:
|
|
107
113
|
const objectAccountIdEq = (_e = (_d = params.object) === null || _d === void 0 ? void 0 : _d.accountId) === null || _e === void 0 ? void 0 : _e.$eq;
|
|
@@ -127,15 +133,18 @@ class MongoRepository {
|
|
|
127
133
|
const objectPaymentMethodIdEq4refund = (_j = (_h = params.object) === null || _h === void 0 ? void 0 : _h.paymentMethodId) === null || _j === void 0 ? void 0 : _j.$eq;
|
|
128
134
|
if (typeof objectPaymentMethodIdEq4refund === 'string') {
|
|
129
135
|
andConditions.push({
|
|
130
|
-
'object.paymentMethodId': {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
136
|
+
'object.paymentMethodId': { $exists: true, $eq: objectPaymentMethodIdEq4refund }
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
const objectPaymentMethodIdIn4refund = (_l = (_k = params.object) === null || _k === void 0 ? void 0 : _k.paymentMethodId) === null || _l === void 0 ? void 0 : _l.$in;
|
|
140
|
+
if (Array.isArray(objectPaymentMethodIdIn4refund)) {
|
|
141
|
+
andConditions.push({
|
|
142
|
+
'object.paymentMethodId': { $exists: true, $in: objectPaymentMethodIdIn4refund }
|
|
134
143
|
});
|
|
135
144
|
}
|
|
136
145
|
break;
|
|
137
146
|
case factory.assetTransactionType.MoneyTransfer:
|
|
138
|
-
const fromLocationIdentifierEq = (
|
|
147
|
+
const fromLocationIdentifierEq = (_p = (_o = (_m = params.object) === null || _m === void 0 ? void 0 : _m.fromLocation) === null || _o === void 0 ? void 0 : _o.identifier) === null || _p === void 0 ? void 0 : _p.$eq;
|
|
139
148
|
if (typeof fromLocationIdentifierEq === 'string') {
|
|
140
149
|
andConditions.push({
|
|
141
150
|
'object.fromLocation.identifier': {
|
|
@@ -144,7 +153,7 @@ class MongoRepository {
|
|
|
144
153
|
}
|
|
145
154
|
});
|
|
146
155
|
}
|
|
147
|
-
const toLocationIdentifierEq = (
|
|
156
|
+
const toLocationIdentifierEq = (_s = (_r = (_q = params.object) === null || _q === void 0 ? void 0 : _q.toLocation) === null || _r === void 0 ? void 0 : _r.identifier) === null || _s === void 0 ? void 0 : _s.$eq;
|
|
148
157
|
if (typeof toLocationIdentifierEq === 'string') {
|
|
149
158
|
andConditions.push({
|
|
150
159
|
'object.toLocation.identifier': {
|
|
@@ -153,7 +162,7 @@ class MongoRepository {
|
|
|
153
162
|
}
|
|
154
163
|
});
|
|
155
164
|
}
|
|
156
|
-
const pendingTransactionIdentifierEq = (
|
|
165
|
+
const pendingTransactionIdentifierEq = (_v = (_u = (_t = params.object) === null || _t === void 0 ? void 0 : _t.pendingTransaction) === null || _u === void 0 ? void 0 : _u.identifier) === null || _v === void 0 ? void 0 : _v.$eq;
|
|
157
166
|
if (typeof pendingTransactionIdentifierEq === 'string') {
|
|
158
167
|
andConditions.push({
|
|
159
168
|
'object.pendingTransaction.identifier': {
|
|
@@ -166,7 +175,7 @@ class MongoRepository {
|
|
|
166
175
|
case factory.assetTransactionType.CancelReservation:
|
|
167
176
|
break;
|
|
168
177
|
case factory.assetTransactionType.Reserve:
|
|
169
|
-
const objectReservationNumberEq = (
|
|
178
|
+
const objectReservationNumberEq = (_x = (_w = params.object) === null || _w === void 0 ? void 0 : _w.reservationNumber) === null || _x === void 0 ? void 0 : _x.$eq;
|
|
170
179
|
if (typeof objectReservationNumberEq === 'string') {
|
|
171
180
|
andConditions.push({
|
|
172
181
|
'object.reservationNumber': {
|
|
@@ -214,7 +223,7 @@ class MongoRepository {
|
|
|
214
223
|
}
|
|
215
224
|
break;
|
|
216
225
|
case factory.assetTransactionType.RegisterService:
|
|
217
|
-
const objectItemOfferedServiceOutputIdentifierEq = (
|
|
226
|
+
const objectItemOfferedServiceOutputIdentifierEq = (_1 = (_0 = (_z = (_y = params.object) === null || _y === void 0 ? void 0 : _y.itemOffered) === null || _z === void 0 ? void 0 : _z.serviceOutput) === null || _0 === void 0 ? void 0 : _0.identifier) === null || _1 === void 0 ? void 0 : _1.$eq;
|
|
218
227
|
if (typeof objectItemOfferedServiceOutputIdentifierEq === 'string') {
|
|
219
228
|
andConditions.push({
|
|
220
229
|
'object.itemOffered.serviceOutput.identifier': {
|
|
@@ -223,7 +232,7 @@ class MongoRepository {
|
|
|
223
232
|
}
|
|
224
233
|
});
|
|
225
234
|
}
|
|
226
|
-
const objectItemOfferedServiceOutputIdentifierIn = (
|
|
235
|
+
const objectItemOfferedServiceOutputIdentifierIn = (_5 = (_4 = (_3 = (_2 = params.object) === null || _2 === void 0 ? void 0 : _2.itemOffered) === null || _3 === void 0 ? void 0 : _3.serviceOutput) === null || _4 === void 0 ? void 0 : _4.identifier) === null || _5 === void 0 ? void 0 : _5.$in;
|
|
227
236
|
if (Array.isArray(objectItemOfferedServiceOutputIdentifierIn)) {
|
|
228
237
|
andConditions.push({
|
|
229
238
|
'object.itemOffered.serviceOutput.identifier': {
|
|
@@ -242,7 +251,9 @@ class MongoRepository {
|
|
|
242
251
|
*/
|
|
243
252
|
start(params) {
|
|
244
253
|
return __awaiter(this, void 0, void 0, function* () {
|
|
245
|
-
return this.transactionModel.create(Object.assign(Object.assign({}, params), { typeOf: params.typeOf, status: factory.transactionStatusType.InProgress, startDate: new Date(), endDate: undefined,
|
|
254
|
+
return this.transactionModel.create(Object.assign(Object.assign({}, params), { typeOf: params.typeOf, status: factory.transactionStatusType.InProgress, startDate: new Date(), endDate: undefined, tasksExportAction: {
|
|
255
|
+
actionStatus: factory.actionStatusType.PotentialActionStatus
|
|
256
|
+
}, tasksExportationStatus: factory.transactionTasksExportationStatus.Unexported }))
|
|
246
257
|
.then((doc) => doc.toObject());
|
|
247
258
|
});
|
|
248
259
|
}
|
|
@@ -272,15 +283,12 @@ class MongoRepository {
|
|
|
272
283
|
return doc.toObject();
|
|
273
284
|
});
|
|
274
285
|
}
|
|
275
|
-
/**
|
|
276
|
-
* 取引を確定する
|
|
277
|
-
*/
|
|
278
286
|
addReservations(params) {
|
|
279
287
|
return __awaiter(this, void 0, void 0, function* () {
|
|
280
288
|
const doc = yield this.transactionModel.findOneAndUpdate({
|
|
281
|
-
_id: params.id,
|
|
282
|
-
typeOf: params.typeOf,
|
|
283
|
-
status: factory.transactionStatusType.InProgress
|
|
289
|
+
_id: { $eq: params.id },
|
|
290
|
+
typeOf: { $eq: params.typeOf },
|
|
291
|
+
status: { $eq: factory.transactionStatusType.InProgress }
|
|
284
292
|
}, {
|
|
285
293
|
'object.acceptedOffer': params.object.acceptedOffer,
|
|
286
294
|
// 念のため残す(2021/10/14)が、そのうち削除
|
|
@@ -305,34 +313,40 @@ class MongoRepository {
|
|
|
305
313
|
confirm(params) {
|
|
306
314
|
return __awaiter(this, void 0, void 0, function* () {
|
|
307
315
|
const doc = yield this.transactionModel.findOneAndUpdate({
|
|
308
|
-
_id: params.id,
|
|
309
|
-
typeOf: params.typeOf,
|
|
310
|
-
status: factory.transactionStatusType.InProgress
|
|
316
|
+
_id: { $eq: params.id },
|
|
317
|
+
typeOf: { $eq: params.typeOf },
|
|
318
|
+
status: { $eq: factory.transactionStatusType.InProgress }
|
|
311
319
|
}, {
|
|
312
320
|
status: factory.transactionStatusType.Confirmed,
|
|
313
321
|
endDate: new Date(),
|
|
314
322
|
result: params.result,
|
|
315
323
|
potentialActions: params.potentialActions // resultを更新
|
|
316
|
-
}, {
|
|
324
|
+
}, {
|
|
325
|
+
new: true,
|
|
326
|
+
projection: { _id: 1 }
|
|
327
|
+
})
|
|
317
328
|
.exec();
|
|
318
329
|
// NotFoundであれば取引状態確認
|
|
319
330
|
if (doc === null) {
|
|
320
331
|
const transaction = yield this.findById({ typeOf: params.typeOf, id: params.id });
|
|
321
332
|
if (transaction.status === factory.transactionStatusType.Confirmed) {
|
|
322
|
-
//
|
|
323
|
-
return transaction;
|
|
333
|
+
// すでに確定済の場合スルー
|
|
324
334
|
}
|
|
325
335
|
else if (transaction.status === factory.transactionStatusType.Expired) {
|
|
326
|
-
throw new factory.errors.Argument('Transaction id',
|
|
336
|
+
throw new factory.errors.Argument('Transaction id', `Transaction ${transaction.typeOf} ${transaction.transactionNumber} already expired`);
|
|
327
337
|
}
|
|
328
338
|
else if (transaction.status === factory.transactionStatusType.Canceled) {
|
|
329
|
-
throw new factory.errors.Argument('Transaction id',
|
|
339
|
+
throw new factory.errors.Argument('Transaction id', `Transaction ${transaction.typeOf} ${transaction.transactionNumber} already canceled`);
|
|
330
340
|
}
|
|
331
341
|
else {
|
|
332
342
|
throw new factory.errors.NotFound(this.transactionModel.modelName);
|
|
333
343
|
}
|
|
334
344
|
}
|
|
335
|
-
|
|
345
|
+
assetTransaction_2.assetTransactionEventEmitter.emitAssetTransactionStatusChanged({
|
|
346
|
+
id: params.id,
|
|
347
|
+
typeOf: params.typeOf,
|
|
348
|
+
status: factory.transactionStatusType.Confirmed
|
|
349
|
+
});
|
|
336
350
|
});
|
|
337
351
|
}
|
|
338
352
|
/**
|
|
@@ -340,23 +354,42 @@ class MongoRepository {
|
|
|
340
354
|
*/
|
|
341
355
|
startAndConfirm(params) {
|
|
342
356
|
return __awaiter(this, void 0, void 0, function* () {
|
|
343
|
-
|
|
357
|
+
const startDate = new Date();
|
|
358
|
+
const confirmedTransaction = yield this.transactionModel.create(Object.assign(Object.assign({}, params), { _id: params.id, typeOf: params.typeOf, startDate, status: factory.transactionStatusType.Confirmed, tasksExportAction: {
|
|
359
|
+
actionStatus: factory.actionStatusType.PotentialActionStatus
|
|
360
|
+
}, tasksExportationStatus: factory.transactionTasksExportationStatus.Unexported, endDate: startDate, result: params.result, potentialActions: params.potentialActions }))
|
|
344
361
|
.then((doc) => doc.toObject());
|
|
362
|
+
assetTransaction_2.assetTransactionEventEmitter.emitAssetTransactionStatusChanged({
|
|
363
|
+
id: params.id,
|
|
364
|
+
typeOf: params.typeOf,
|
|
365
|
+
status: factory.transactionStatusType.Confirmed
|
|
366
|
+
});
|
|
367
|
+
return confirmedTransaction;
|
|
345
368
|
});
|
|
346
369
|
}
|
|
347
370
|
/**
|
|
348
371
|
* タスク未エクスポートの取引をひとつ取得してエクスポートを開始する
|
|
349
372
|
*/
|
|
350
373
|
startExportTasks(params) {
|
|
351
|
-
var _a, _b
|
|
374
|
+
var _a, _b;
|
|
352
375
|
return __awaiter(this, void 0, void 0, function* () {
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
376
|
+
switch (params.status) {
|
|
377
|
+
case factory.transactionStatusType.InProgress:
|
|
378
|
+
throw new factory.errors.NotImplemented(`status "${params.status}" not implemented on startExportTasks`);
|
|
379
|
+
default:
|
|
380
|
+
// no op
|
|
381
|
+
}
|
|
382
|
+
const typeOfIn = (_a = params.typeOf) === null || _a === void 0 ? void 0 : _a.$in;
|
|
383
|
+
return this.transactionModel.findOneAndUpdate(Object.assign(Object.assign(Object.assign(Object.assign({}, (typeof ((_b = params.project) === null || _b === void 0 ? void 0 : _b.id) === 'string') ? { 'project.id': { $eq: params.project.id } } : undefined), (Array.isArray(typeOfIn)) ? { typeOf: { $in: typeOfIn } } : undefined), { status: { $eq: params.status }, tasksExportationStatus: { $eq: factory.transactionTasksExportationStatus.Unexported } }), (typeof params.id === 'string') ? { _id: { $eq: params.id } } : undefined), {
|
|
384
|
+
'tasksExportAction.actionStatus': factory.actionStatusType.ActiveActionStatus,
|
|
385
|
+
'tasksExportAction.agent': { name: params.tasksExportAction.agent.name },
|
|
386
|
+
'tasksExportAction.startDate': new Date(),
|
|
387
|
+
tasksExportationStatus: factory.transactionTasksExportationStatus.Exporting
|
|
388
|
+
}, { new: true })
|
|
389
|
+
.select({
|
|
390
|
+
_id: 1,
|
|
391
|
+
typeOf: 1
|
|
392
|
+
})
|
|
360
393
|
.exec()
|
|
361
394
|
// tslint:disable-next-line:no-null-keyword
|
|
362
395
|
.then((doc) => (doc === null) ? null : doc.toObject());
|
|
@@ -369,17 +402,74 @@ class MongoRepository {
|
|
|
369
402
|
*/
|
|
370
403
|
reexportTasks(params) {
|
|
371
404
|
return __awaiter(this, void 0, void 0, function* () {
|
|
372
|
-
yield this.transactionModel.
|
|
373
|
-
tasksExportationStatus: factory.transactionTasksExportationStatus.Exporting,
|
|
405
|
+
const reexportingTransactions = yield this.transactionModel.find({
|
|
406
|
+
tasksExportationStatus: { $eq: factory.transactionTasksExportationStatus.Exporting },
|
|
374
407
|
updatedAt: {
|
|
375
408
|
$lt: moment()
|
|
376
409
|
.add(-params.intervalInMinutes, 'minutes')
|
|
377
410
|
.toDate()
|
|
378
411
|
}
|
|
379
|
-
}, {
|
|
380
|
-
tasksExportationStatus: factory.transactionTasksExportationStatus.Unexported
|
|
381
412
|
})
|
|
413
|
+
.select({
|
|
414
|
+
_id: 1,
|
|
415
|
+
typeOf: 1,
|
|
416
|
+
status: 1
|
|
417
|
+
})
|
|
418
|
+
.setOptions({ maxTimeMS: 10000 })
|
|
382
419
|
.exec();
|
|
420
|
+
if (reexportingTransactions.length > 0) {
|
|
421
|
+
for (const reexportingTransaction of reexportingTransactions) {
|
|
422
|
+
yield this.transactionModel.updateOne({
|
|
423
|
+
_id: { $eq: reexportingTransaction.id },
|
|
424
|
+
tasksExportationStatus: { $eq: factory.transactionTasksExportationStatus.Exporting }
|
|
425
|
+
}, {
|
|
426
|
+
tasksExportAction: {
|
|
427
|
+
actionStatus: factory.actionStatusType.PotentialActionStatus
|
|
428
|
+
},
|
|
429
|
+
tasksExportationStatus: factory.transactionTasksExportationStatus.Unexported
|
|
430
|
+
})
|
|
431
|
+
.exec();
|
|
432
|
+
assetTransaction_2.assetTransactionEventEmitter.emitAssetTransactionStatusChanged({
|
|
433
|
+
id: reexportingTransaction.id,
|
|
434
|
+
typeOf: reexportingTransaction.typeOf,
|
|
435
|
+
status: reexportingTransaction.status
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* タスクエクスポートの遅延している取引について明示的にemitTransactionStatusChangedを実行する
|
|
443
|
+
*/
|
|
444
|
+
exportTasks(params) {
|
|
445
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
446
|
+
const delayedTransactions = yield this.transactionModel.find({
|
|
447
|
+
status: { $in: params.status.$in },
|
|
448
|
+
tasksExportationStatus: { $eq: factory.transactionTasksExportationStatus.Unexported },
|
|
449
|
+
endDate: {
|
|
450
|
+
$exists: true,
|
|
451
|
+
$lt: moment(params.now)
|
|
452
|
+
.add(-params.delayInSeconds, 'seconds')
|
|
453
|
+
.toDate()
|
|
454
|
+
}
|
|
455
|
+
})
|
|
456
|
+
.select({
|
|
457
|
+
_id: 1,
|
|
458
|
+
typeOf: 1,
|
|
459
|
+
status: 1
|
|
460
|
+
})
|
|
461
|
+
.setOptions({ maxTimeMS: 10000 })
|
|
462
|
+
.exec();
|
|
463
|
+
if (delayedTransactions.length > 0) {
|
|
464
|
+
delayedTransactions.forEach((delayedTransaction) => {
|
|
465
|
+
assetTransaction_2.assetTransactionEventEmitter.emitAssetTransactionStatusChanged({
|
|
466
|
+
id: delayedTransaction.id,
|
|
467
|
+
typeOf: delayedTransaction.typeOf,
|
|
468
|
+
status: delayedTransaction.status
|
|
469
|
+
});
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
return delayedTransactions;
|
|
383
473
|
});
|
|
384
474
|
}
|
|
385
475
|
/**
|
|
@@ -388,10 +478,15 @@ class MongoRepository {
|
|
|
388
478
|
*/
|
|
389
479
|
setTasksExportedById(params) {
|
|
390
480
|
return __awaiter(this, void 0, void 0, function* () {
|
|
391
|
-
|
|
481
|
+
const endDate = new Date();
|
|
482
|
+
yield this.transactionModel.updateOne({
|
|
483
|
+
_id: { $eq: params.id },
|
|
484
|
+
tasksExportationStatus: { $eq: factory.transactionTasksExportationStatus.Exporting }
|
|
485
|
+
}, {
|
|
392
486
|
tasksExportationStatus: factory.transactionTasksExportationStatus.Exported,
|
|
393
|
-
tasksExportedAt:
|
|
394
|
-
|
|
487
|
+
tasksExportedAt: endDate,
|
|
488
|
+
'tasksExportAction.actionStatus': factory.actionStatusType.CompletedActionStatus,
|
|
489
|
+
'tasksExportAction.endDate': endDate
|
|
395
490
|
})
|
|
396
491
|
.exec();
|
|
397
492
|
});
|
|
@@ -401,15 +496,36 @@ class MongoRepository {
|
|
|
401
496
|
*/
|
|
402
497
|
makeExpired(params) {
|
|
403
498
|
return __awaiter(this, void 0, void 0, function* () {
|
|
404
|
-
//
|
|
405
|
-
yield this.transactionModel.
|
|
406
|
-
status: factory.transactionStatusType.InProgress,
|
|
407
|
-
expires: { $lt: params.expires }
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
|
|
499
|
+
// IDをemitしたいのでまずリスト検索(2023-04-27~)
|
|
500
|
+
const expiringTransactions = yield this.transactionModel.find({
|
|
501
|
+
status: { $eq: factory.transactionStatusType.InProgress },
|
|
502
|
+
expires: { $lt: params.expires.$lt }
|
|
503
|
+
})
|
|
504
|
+
.select({
|
|
505
|
+
_id: 1,
|
|
506
|
+
typeOf: 1
|
|
411
507
|
})
|
|
508
|
+
.setOptions({ maxTimeMS: 10000 })
|
|
412
509
|
.exec();
|
|
510
|
+
if (expiringTransactions.length > 0) {
|
|
511
|
+
// ステータスと期限を見て更新
|
|
512
|
+
yield this.transactionModel.updateMany({
|
|
513
|
+
_id: { $in: expiringTransactions.map((t) => t.id) },
|
|
514
|
+
status: { $eq: factory.transactionStatusType.InProgress },
|
|
515
|
+
expires: { $lt: params.expires.$lt }
|
|
516
|
+
}, {
|
|
517
|
+
status: factory.transactionStatusType.Expired,
|
|
518
|
+
endDate: new Date()
|
|
519
|
+
})
|
|
520
|
+
.exec();
|
|
521
|
+
expiringTransactions.forEach((expiringTransaction) => {
|
|
522
|
+
assetTransaction_2.assetTransactionEventEmitter.emitAssetTransactionStatusChanged({
|
|
523
|
+
id: expiringTransaction.id,
|
|
524
|
+
typeOf: expiringTransaction.typeOf,
|
|
525
|
+
status: factory.transactionStatusType.Expired
|
|
526
|
+
});
|
|
527
|
+
});
|
|
528
|
+
}
|
|
413
529
|
});
|
|
414
530
|
}
|
|
415
531
|
/**
|
|
@@ -417,19 +533,18 @@ class MongoRepository {
|
|
|
417
533
|
*/
|
|
418
534
|
cancel(params) {
|
|
419
535
|
return __awaiter(this, void 0, void 0, function* () {
|
|
420
|
-
const endDate =
|
|
421
|
-
.toDate();
|
|
536
|
+
const endDate = new Date();
|
|
422
537
|
// 進行中ステータスの取引を中止する
|
|
423
|
-
const doc = yield this.transactionModel.findOneAndUpdate(Object.assign(Object.assign(Object.assign({ typeOf: params.typeOf }, (typeof params.id === 'string') ? { _id: params.id } : undefined), (typeof params.transactionNumber === 'string')
|
|
538
|
+
const doc = yield this.transactionModel.findOneAndUpdate(Object.assign(Object.assign(Object.assign({ typeOf: { $eq: params.typeOf } }, (typeof params.id === 'string') ? { _id: { $eq: params.id } } : undefined), (typeof params.transactionNumber === 'string')
|
|
424
539
|
? { transactionNumber: { $exists: true, $eq: params.transactionNumber } }
|
|
425
|
-
: undefined), { status: factory.transactionStatusType.InProgress }), {
|
|
540
|
+
: undefined), { status: { $eq: factory.transactionStatusType.InProgress } }), {
|
|
426
541
|
status: factory.transactionStatusType.Canceled,
|
|
427
542
|
endDate: endDate
|
|
428
543
|
}, { new: true })
|
|
429
544
|
.exec();
|
|
545
|
+
let transaction;
|
|
430
546
|
// NotFoundであれば取引状態確認
|
|
431
547
|
if (doc === null) {
|
|
432
|
-
let transaction;
|
|
433
548
|
if (typeof params.id === 'string') {
|
|
434
549
|
transaction = yield this.findById({ typeOf: params.typeOf, id: params.id });
|
|
435
550
|
}
|
|
@@ -443,20 +558,27 @@ class MongoRepository {
|
|
|
443
558
|
throw new factory.errors.ArgumentNull('Transaction ID or Transaction Number');
|
|
444
559
|
}
|
|
445
560
|
if (transaction.status === factory.transactionStatusType.Canceled) {
|
|
446
|
-
//
|
|
447
|
-
return transaction;
|
|
561
|
+
// すでに中止済の場合スルー
|
|
448
562
|
}
|
|
449
563
|
else if (transaction.status === factory.transactionStatusType.Expired) {
|
|
450
|
-
throw new factory.errors.Argument('Transaction id',
|
|
564
|
+
throw new factory.errors.Argument('Transaction id', `Transaction ${transaction.typeOf} ${transaction.transactionNumber} already expired`);
|
|
451
565
|
}
|
|
452
566
|
else if (transaction.status === factory.transactionStatusType.Confirmed) {
|
|
453
|
-
throw new factory.errors.Argument('Transaction id',
|
|
567
|
+
throw new factory.errors.Argument('Transaction id', `Confirmed transaction ${transaction.typeOf} ${transaction.transactionNumber} unable to cancel`);
|
|
454
568
|
}
|
|
455
569
|
else {
|
|
456
570
|
throw new factory.errors.NotFound(this.transactionModel.modelName);
|
|
457
571
|
}
|
|
458
572
|
}
|
|
459
|
-
|
|
573
|
+
else {
|
|
574
|
+
transaction = doc.toObject();
|
|
575
|
+
}
|
|
576
|
+
assetTransaction_2.assetTransactionEventEmitter.emitAssetTransactionStatusChanged({
|
|
577
|
+
id: transaction.id,
|
|
578
|
+
typeOf: params.typeOf,
|
|
579
|
+
status: factory.transactionStatusType.Canceled
|
|
580
|
+
});
|
|
581
|
+
return transaction;
|
|
460
582
|
});
|
|
461
583
|
}
|
|
462
584
|
count(params) {
|
|
@@ -470,12 +592,30 @@ class MongoRepository {
|
|
|
470
592
|
/**
|
|
471
593
|
* 取引を検索する
|
|
472
594
|
*/
|
|
473
|
-
search(params,
|
|
595
|
+
search(params, inclusion, exclusion) {
|
|
474
596
|
var _a;
|
|
475
597
|
return __awaiter(this, void 0, void 0, function* () {
|
|
476
598
|
const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
|
|
599
|
+
let projection = {};
|
|
600
|
+
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
601
|
+
inclusion.forEach((field) => {
|
|
602
|
+
projection[field] = 1;
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
else {
|
|
606
|
+
projection = {
|
|
607
|
+
__v: 0,
|
|
608
|
+
createdAt: 0,
|
|
609
|
+
updatedAt: 0
|
|
610
|
+
};
|
|
611
|
+
if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
612
|
+
exclusion.forEach((field) => {
|
|
613
|
+
projection[field] = 0;
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
}
|
|
477
617
|
const query = this.transactionModel.find((conditions.length > 0) ? { $and: conditions } : {})
|
|
478
|
-
.select(
|
|
618
|
+
.select(projection);
|
|
479
619
|
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
480
620
|
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
481
621
|
query.limit(params.limit)
|
|
@@ -518,9 +658,12 @@ class MongoRepository {
|
|
|
518
658
|
/**
|
|
519
659
|
* 特定の取引を更新する(汎用)
|
|
520
660
|
*/
|
|
521
|
-
|
|
661
|
+
findByIdAndUpdateInProgress(params) {
|
|
522
662
|
return __awaiter(this, void 0, void 0, function* () {
|
|
523
|
-
return this.transactionModel.findOneAndUpdate({
|
|
663
|
+
return this.transactionModel.findOneAndUpdate({
|
|
664
|
+
_id: { $eq: params.id },
|
|
665
|
+
status: { $eq: factory.transactionStatusType.InProgress }
|
|
666
|
+
}, params.update, { new: true })
|
|
524
667
|
.exec()
|
|
525
668
|
.then((doc) => {
|
|
526
669
|
if (doc === null) {
|
|
@@ -34,7 +34,10 @@ export declare class MongoRepository {
|
|
|
34
34
|
/**
|
|
35
35
|
* 検索
|
|
36
36
|
*/
|
|
37
|
-
search(params: factory.creativeWork.comment.ISearchConditions
|
|
37
|
+
search(params: factory.creativeWork.comment.ISearchConditions & {
|
|
38
|
+
inclusion: string[];
|
|
39
|
+
exclusion: string[];
|
|
40
|
+
}): Promise<factory.creativeWork.comment.IComment[]>;
|
|
38
41
|
findById(params: {
|
|
39
42
|
id: string;
|
|
40
43
|
}): Promise<factory.creativeWork.comment.IComment>;
|
|
@@ -42,12 +42,27 @@ class MongoRepository {
|
|
|
42
42
|
search(params) {
|
|
43
43
|
var _a;
|
|
44
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
let projection = {};
|
|
46
|
+
if (Array.isArray(params.inclusion) && params.inclusion.length > 0) {
|
|
47
|
+
params.inclusion.forEach((field) => {
|
|
48
|
+
projection[field] = 1;
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
projection = {
|
|
53
|
+
__v: 0,
|
|
54
|
+
createdAt: 0,
|
|
55
|
+
updatedAt: 0
|
|
56
|
+
};
|
|
57
|
+
if (Array.isArray(params.exclusion) && params.exclusion.length > 0) {
|
|
58
|
+
params.exclusion.forEach((field) => {
|
|
59
|
+
projection[field] = 0;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
45
63
|
const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
|
|
46
|
-
const query = this.commentModel.find((conditions.length > 0) ? { $and: conditions } : {}
|
|
47
|
-
|
|
48
|
-
createdAt: 0,
|
|
49
|
-
updatedAt: 0
|
|
50
|
-
});
|
|
64
|
+
const query = this.commentModel.find((conditions.length > 0) ? { $and: conditions } : {})
|
|
65
|
+
.select(projection);
|
|
51
66
|
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
52
67
|
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
53
68
|
query.limit(params.limit)
|
|
@@ -4,7 +4,6 @@ import { RedisClientType } from 'redis';
|
|
|
4
4
|
*/
|
|
5
5
|
export declare class RedisRepository {
|
|
6
6
|
private static readonly REDIS_KEY_PREFIX_NEW;
|
|
7
|
-
private static readonly REDIS_KEY_PREFIX;
|
|
8
7
|
private readonly redisClient;
|
|
9
8
|
constructor(redisClient: RedisClientType);
|
|
10
9
|
private static alignDigits;
|
|
@@ -16,7 +16,6 @@ const util = require("util");
|
|
|
16
16
|
// tslint:disable-next-line:no-require-imports no-var-requires
|
|
17
17
|
const fpe = require('node-fpe');
|
|
18
18
|
const factory = require("../factory");
|
|
19
|
-
const settings_1 = require("../settings");
|
|
20
19
|
const CONFIRMATION_NUMBER_MIN_LENGH = 4;
|
|
21
20
|
/**
|
|
22
21
|
* 確認番号リポジトリ
|
|
@@ -34,19 +33,9 @@ class RedisRepository {
|
|
|
34
33
|
return aligndNumber;
|
|
35
34
|
}
|
|
36
35
|
static createKey(params) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (useNewKey) {
|
|
41
|
-
return util.format('%s:%s', RedisRepository.REDIS_KEY_PREFIX_NEW, moment(params.orderDate)
|
|
42
|
-
.tz('Asia/Tokyo')
|
|
43
|
-
.format('YYMM'));
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
46
|
-
return util.format('%s:%s', RedisRepository.REDIS_KEY_PREFIX, moment(params.orderDate)
|
|
47
|
-
.tz('Asia/Tokyo')
|
|
48
|
-
.format('YYMM'));
|
|
49
|
-
}
|
|
36
|
+
return util.format('%s:%s', RedisRepository.REDIS_KEY_PREFIX_NEW, moment(params.orderDate)
|
|
37
|
+
.tz('Asia/Tokyo')
|
|
38
|
+
.format('YYMM'));
|
|
50
39
|
}
|
|
51
40
|
/**
|
|
52
41
|
* 発行する
|
|
@@ -81,5 +70,4 @@ class RedisRepository {
|
|
|
81
70
|
}
|
|
82
71
|
}
|
|
83
72
|
RedisRepository.REDIS_KEY_PREFIX_NEW = 'confirmationNumber';
|
|
84
|
-
RedisRepository.REDIS_KEY_PREFIX = 'cinerino:confirmationNumber';
|
|
85
73
|
exports.RedisRepository = RedisRepository;
|
|
@@ -34,9 +34,7 @@ export declare class MongoRepository {
|
|
|
34
34
|
/**
|
|
35
35
|
* コンテンツを保管する
|
|
36
36
|
*/
|
|
37
|
-
saveMovie(params: factory.creativeWork.movie.ICreativeWork): Promise<
|
|
38
|
-
_id: unknown;
|
|
39
|
-
}>>;
|
|
37
|
+
saveMovie(params: factory.creativeWork.movie.ICreativeWork): Promise<any>;
|
|
40
38
|
findMovieById(params: {
|
|
41
39
|
id: string;
|
|
42
40
|
}): Promise<factory.creativeWork.movie.ICreativeWork>;
|
|
@@ -1,27 +1,3 @@
|
|
|
1
|
-
/// <reference types="mongoose/types/aggregate" />
|
|
2
|
-
/// <reference types="mongoose/types/callback" />
|
|
3
|
-
/// <reference types="mongoose/types/collection" />
|
|
4
|
-
/// <reference types="mongoose/types/connection" />
|
|
5
|
-
/// <reference types="mongoose/types/cursor" />
|
|
6
|
-
/// <reference types="mongoose/types/document" />
|
|
7
|
-
/// <reference types="mongoose/types/error" />
|
|
8
|
-
/// <reference types="mongoose/types/expressions" />
|
|
9
|
-
/// <reference types="mongoose/types/helpers" />
|
|
10
|
-
/// <reference types="mongoose/types/middlewares" />
|
|
11
|
-
/// <reference types="mongoose/types/indexes" />
|
|
12
|
-
/// <reference types="mongoose/types/models" />
|
|
13
|
-
/// <reference types="mongoose/types/mongooseoptions" />
|
|
14
|
-
/// <reference types="mongoose/types/pipelinestage" />
|
|
15
|
-
/// <reference types="mongoose/types/populate" />
|
|
16
|
-
/// <reference types="mongoose/types/query" />
|
|
17
|
-
/// <reference types="mongoose/types/schemaoptions" />
|
|
18
|
-
/// <reference types="mongoose/types/schematypes" />
|
|
19
|
-
/// <reference types="mongoose/types/session" />
|
|
20
|
-
/// <reference types="mongoose/types/types" />
|
|
21
|
-
/// <reference types="mongoose/types/utility" />
|
|
22
|
-
/// <reference types="mongoose/types/validation" />
|
|
23
|
-
/// <reference types="mongoose/types/virtuals" />
|
|
24
|
-
/// <reference types="mongoose/types/inferschematype" />
|
|
25
1
|
import { Connection } from 'mongoose';
|
|
26
2
|
import * as factory from '../factory';
|
|
27
3
|
export type IEmailMessage = factory.creativeWork.message.email.ICreativeWork;
|
|
@@ -50,9 +26,7 @@ export declare class MongoRepository {
|
|
|
50
26
|
private readonly emailMessageModel;
|
|
51
27
|
constructor(connection: Connection);
|
|
52
28
|
static CREATE_MONGO_CONDITIONS(params: ISearchConditions): any[];
|
|
53
|
-
save(params: IEmailMessage): Promise<
|
|
54
|
-
_id: unknown;
|
|
55
|
-
}>>;
|
|
29
|
+
save(params: IEmailMessage): Promise<any>;
|
|
56
30
|
findById(params: {
|
|
57
31
|
id: string;
|
|
58
32
|
}): Promise<IEmailMessage>;
|
|
@@ -169,7 +169,11 @@ export declare class MongoRepository {
|
|
|
169
169
|
updateAggregationById<T extends factory.eventType>(params: {
|
|
170
170
|
id: string;
|
|
171
171
|
}, update: IUpdateAggregateReservationParams | IUpdateAggregateUseActionsParams): Promise<factory.event.IEvent<T>>;
|
|
172
|
-
bulkWrite(bulkWriteOps: any[]): Promise<BulkWriteOpResultObject
|
|
172
|
+
bulkWrite(bulkWriteOps: any[]): Promise<BulkWriteOpResultObject & {
|
|
173
|
+
mongoose?: {
|
|
174
|
+
validationErrors: import("mongoose").Error[];
|
|
175
|
+
} | undefined;
|
|
176
|
+
}>;
|
|
173
177
|
getCursor(conditions: any, projection: any): import("mongoose").Cursor<any, import("mongoose").QueryOptions<any>>;
|
|
174
178
|
unsetUnnecessaryFields(params: {
|
|
175
179
|
filter: any;
|
|
@@ -31,9 +31,7 @@ export declare class MongoRepository {
|
|
|
31
31
|
private readonly merchantReturnPolicyModel;
|
|
32
32
|
constructor(connection: Connection);
|
|
33
33
|
static CREATE_MONGO_CONDITIONS(params: factory.unitPriceOffer.IOfferMerchantReturnPolicySearchConditions): any[];
|
|
34
|
-
save(params: factory.unitPriceOffer.IOfferMerchantReturnPolicy): Promise<
|
|
35
|
-
_id: unknown;
|
|
36
|
-
}>>;
|
|
34
|
+
save(params: factory.unitPriceOffer.IOfferMerchantReturnPolicy): Promise<any>;
|
|
37
35
|
findById(params: {
|
|
38
36
|
id: string;
|
|
39
37
|
}): Promise<factory.unitPriceOffer.IOfferMerchantReturnPolicy>;
|