@chevre/domain 21.2.0-alpha.99 → 21.2.0
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/aggregateEventReservation.ts +1 -1
- package/example/src/chevre/aggregateSellerPaymentAccepted.ts +27 -0
- package/example/src/chevre/aggregation/aggregateSystem.ts +53 -22
- package/example/src/chevre/countDelayedTasks.ts +7 -2
- package/example/src/chevre/createManyEventsIfNotExist.ts +199 -46
- package/example/src/chevre/findScreeningRoomsByBranchCode.ts +4 -3
- package/example/src/chevre/giveUpStartDatePassedCertainPeriod.ts +56 -0
- package/example/src/chevre/lockStockHolder.ts +5 -2
- package/example/src/chevre/migrateCategoryCodeAdditionalProperties.ts +116 -0
- package/example/src/chevre/migrateScreeningEventSeriesVersion.ts +79 -0
- package/example/src/chevre/processRegisterMembership.ts +8 -4
- package/example/src/chevre/processRegisterPaymentCard.ts +8 -4
- package/example/src/chevre/processReserve.ts +1 -1
- package/example/src/chevre/searchAbortedTasks.ts +4 -6
- package/example/src/chevre/searchEventSeats.ts +5 -2
- package/example/src/chevre/searchHoldReservations.ts +38 -0
- package/example/src/chevre/searchPermissions.ts +54 -0
- package/example/src/chevre/searchScreeningRooms.ts +35 -0
- package/example/src/chevre/sendEmailMessage.ts +1 -2
- package/example/src/chevre/syncScreeningRooms.ts +22 -0
- package/example/src/chevre/syncScreeningRoomsAll.ts +44 -0
- package/example/src/chevre/unsetContainsInPlaceFromMovieTheater.ts +41 -0
- package/lib/chevre/factory/order.d.ts +4 -1
- package/lib/chevre/factory/order.js +19 -6
- package/lib/chevre/repo/account.js +3 -2
- package/lib/chevre/repo/accountTransaction.js +2 -1
- package/lib/chevre/repo/accountingReport.d.ts +1 -3
- package/lib/chevre/repo/action.d.ts +50 -1
- package/lib/chevre/repo/action.js +53 -2
- package/lib/chevre/repo/additionalProperty.js +2 -1
- package/lib/chevre/repo/aggregation.d.ts +3 -0
- package/lib/chevre/repo/aggregation.js +3 -0
- package/lib/chevre/repo/assetTransaction.js +6 -5
- package/lib/chevre/repo/categoryCode.d.ts +1 -1
- package/lib/chevre/repo/categoryCode.js +37 -25
- package/lib/chevre/repo/code.js +3 -2
- package/lib/chevre/repo/comment.js +2 -1
- package/lib/chevre/repo/creativeWork.d.ts +1 -1
- package/lib/chevre/repo/creativeWork.js +35 -12
- package/lib/chevre/repo/customer.js +2 -1
- package/lib/chevre/repo/emailMessage.js +2 -1
- package/lib/chevre/repo/event.d.ts +30 -2
- package/lib/chevre/repo/event.js +87 -36
- package/lib/chevre/repo/member.d.ts +14 -0
- package/lib/chevre/repo/member.js +31 -3
- package/lib/chevre/repo/merchantReturnPolicy.js +2 -1
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/holdReservation.d.ts +75 -0
- package/lib/chevre/repo/mongoose/schemas/holdReservation.js +93 -0
- package/lib/chevre/repo/mongoose/schemas/offer.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +21 -21
- package/lib/chevre/repo/mongoose/schemas/place.d.ts +6 -0
- package/lib/chevre/repo/mongoose/schemas/place.js +16 -1
- package/lib/chevre/repo/mongoose/schemas/product.js +6 -0
- package/lib/chevre/repo/mongoose/schemas/reservation.d.ts +9 -9
- package/lib/chevre/repo/mongoose/schemas/transaction.d.ts +3 -3
- package/lib/chevre/repo/offer.js +3 -2
- package/lib/chevre/repo/offerCatalog.js +0 -27
- package/lib/chevre/repo/offerItemCondition.js +2 -1
- package/lib/chevre/repo/order.js +8 -7
- package/lib/chevre/repo/ownershipInfo.js +2 -7
- package/lib/chevre/repo/paymentServiceProvider.d.ts +65 -0
- package/lib/chevre/repo/paymentServiceProvider.js +156 -0
- package/lib/chevre/repo/place.d.ts +203 -27
- package/lib/chevre/repo/place.js +1726 -694
- package/lib/chevre/repo/priceSpecification.js +3 -2
- package/lib/chevre/repo/product.d.ts +5 -3
- package/lib/chevre/repo/product.js +92 -5
- package/lib/chevre/repo/project.js +2 -1
- package/lib/chevre/repo/reservation.d.ts +9 -1
- package/lib/chevre/repo/reservation.js +29 -20
- package/lib/chevre/repo/role.d.ts +7 -0
- package/lib/chevre/repo/role.js +39 -2
- package/lib/chevre/repo/seller.d.ts +21 -1
- package/lib/chevre/repo/seller.js +59 -4
- package/lib/chevre/repo/serviceOutput.js +2 -1
- package/lib/chevre/repo/stockHolder.d.ts +143 -7
- package/lib/chevre/repo/stockHolder.js +622 -104
- package/lib/chevre/repo/task.d.ts +12 -1
- package/lib/chevre/repo/task.js +17 -7
- package/lib/chevre/repo/transaction.js +6 -5
- package/lib/chevre/repo/trip.js +2 -1
- package/lib/chevre/repository.d.ts +6 -0
- package/lib/chevre/repository.js +8 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +18 -8
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +19 -8
- package/lib/chevre/service/aggregation/system.d.ts +43 -1
- package/lib/chevre/service/aggregation/system.js +112 -2
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +1 -1
- package/lib/chevre/service/assetTransaction/pay/account/validation.js +1 -1
- package/lib/chevre/service/assetTransaction/pay.js +2 -2
- package/lib/chevre/service/assetTransaction/refund.js +1 -1
- package/lib/chevre/service/assetTransaction/reserve.js +10 -3
- package/lib/chevre/service/event.d.ts +3 -0
- package/lib/chevre/service/event.js +52 -21
- package/lib/chevre/service/iam.d.ts +6 -2
- package/lib/chevre/service/iam.js +23 -9
- package/lib/chevre/service/offer/event/factory.js +22 -13
- package/lib/chevre/service/offer/event/importFromCOA.js +2 -2
- package/lib/chevre/service/offer/eventServiceByCOA/factory.js +15 -8
- package/lib/chevre/service/offer/eventServiceByCOA.js +7 -9
- package/lib/chevre/service/offer/product/factory.js +13 -6
- package/lib/chevre/service/offer/product.js +2 -2
- package/lib/chevre/service/offer.d.ts +16 -8
- package/lib/chevre/service/offer.js +71 -8
- package/lib/chevre/service/order/createAccountingReportIfNotExist.js +31 -17
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged.js +2 -2
- package/lib/chevre/service/order/placeOrder.js +4 -4
- package/lib/chevre/service/order/returnOrder.js +1 -1
- package/lib/chevre/service/order/sendOrder.js +3 -3
- package/lib/chevre/service/payment/any/onPaymentStatusChanged.js +4 -6
- package/lib/chevre/service/payment/any/onRefund.js +46 -42
- package/lib/chevre/service/payment/creditCard.js +2 -2
- package/lib/chevre/service/payment/movieTicket/checkByIdentifier.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket/factory.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket/getCredentials.d.ts +1 -1
- package/lib/chevre/service/payment/movieTicket/getCredentials.js +1 -1
- package/lib/chevre/service/payment/movieTicket/validation.js +16 -9
- package/lib/chevre/service/payment/movieTicket.js +2 -2
- package/lib/chevre/service/reserve/cancelReservation.js +15 -3
- package/lib/chevre/service/reserve/confirmReservation.js +19 -11
- package/lib/chevre/service/task/aggregateScreeningEvent.js +1 -1
- package/lib/chevre/service/task/cancelPendingReservation.js +1 -1
- package/lib/chevre/service/task/cancelReservation.js +1 -1
- package/lib/chevre/service/task/deleteTransaction.js +2 -0
- package/lib/chevre/service/task/onEventChanged.d.ts +7 -0
- package/lib/chevre/service/task/onEventChanged.js +29 -0
- package/lib/chevre/service/task/onResourceUpdated.d.ts +7 -0
- package/lib/chevre/service/task/onResourceUpdated.js +396 -0
- package/lib/chevre/service/task/syncScreeningRooms.d.ts +7 -0
- package/lib/chevre/service/task/syncScreeningRooms.js +24 -0
- package/lib/chevre/service/task/voidReserveTransaction.js +1 -1
- package/lib/chevre/service/transaction/deleteTransaction.d.ts +2 -0
- package/lib/chevre/service/transaction/deleteTransaction.js +129 -1
- package/lib/chevre/service/transaction/moneyTransfer/exportTasks/factory.js +1 -0
- package/lib/chevre/service/transaction/moneyTransfer/factory.d.ts +1 -1
- package/lib/chevre/service/transaction/moneyTransfer.js +1 -1
- package/lib/chevre/service/transaction/orderProgramMembership/findCreditCard.js +1 -1
- package/lib/chevre/service/transaction/orderProgramMembership/findPaymentCardPermit.js +1 -1
- package/lib/chevre/service/transaction/orderProgramMembership.js +1 -1
- package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +1 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/givePointAward.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/sendEmailMessage.js +4 -4
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.js +3 -4
- package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +8 -12
- package/lib/chevre/service/transaction/placeOrderInProgress.js +6 -4
- package/lib/chevre/service/transaction/returnOrder/exportTasks/factory.js +1 -0
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.js +2 -2
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +5 -5
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.js +2 -2
- package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +3 -3
- package/lib/chevre/service/transaction/returnOrder/potentialActions.js +1 -1
- package/lib/chevre/service/transaction/returnOrder.js +3 -1
- package/lib/chevre/settings.d.ts +11 -0
- package/lib/chevre/settings.js +44 -2
- package/package.json +3 -3
- package/example/src/chevre/eventCatalog2eventService.ts +0 -123
- package/example/src/chevre/migrateOrderAdditionalProperties.ts +0 -85
- package/example/src/chevre/migrateStockHolderKeys.ts +0 -89
|
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
23
23
|
exports.MongoRepository = void 0;
|
|
24
24
|
const factory = require("../factory");
|
|
25
25
|
const priceSpecification_1 = require("./mongoose/schemas/priceSpecification");
|
|
26
|
+
const settings_1 = require("../settings");
|
|
26
27
|
/**
|
|
27
28
|
* 価格仕様リポジトリ
|
|
28
29
|
*/
|
|
@@ -156,7 +157,7 @@ class MongoRepository {
|
|
|
156
157
|
return __awaiter(this, void 0, void 0, function* () {
|
|
157
158
|
const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
|
|
158
159
|
return this.priceSpecificationModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
|
|
159
|
-
.setOptions({ maxTimeMS:
|
|
160
|
+
.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
160
161
|
.exec();
|
|
161
162
|
});
|
|
162
163
|
}
|
|
@@ -182,7 +183,7 @@ class MongoRepository {
|
|
|
182
183
|
// const explainResult = await (<any>query).explain();
|
|
183
184
|
// console.log(explainResult[0].executionStats.allPlansExecution.map((e: any) => e.executionStages.inputStage));
|
|
184
185
|
// return;
|
|
185
|
-
return query.setOptions({ maxTimeMS:
|
|
186
|
+
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
186
187
|
.exec()
|
|
187
188
|
.then((docs) => docs.map((doc) => doc.toObject()));
|
|
188
189
|
});
|
|
@@ -25,6 +25,9 @@
|
|
|
25
25
|
import { Connection } from 'mongoose';
|
|
26
26
|
import * as factory from '../factory';
|
|
27
27
|
export type IProduct = factory.product.IProduct | factory.service.paymentService.IService;
|
|
28
|
+
export type IPaymentServiceByProvider = Pick<factory.service.paymentService.IService, 'name' | 'description' | 'typeOf' | 'id' | 'productID' | 'serviceType' | 'additionalProperty'> & {
|
|
29
|
+
provider?: Pick<factory.service.paymentService.IProvider, 'credentials'>;
|
|
30
|
+
};
|
|
28
31
|
/**
|
|
29
32
|
* プロダクトリポジトリ
|
|
30
33
|
*/
|
|
@@ -37,9 +40,7 @@ export declare class MongoRepository {
|
|
|
37
40
|
}, projection?: {
|
|
38
41
|
[key: string]: number;
|
|
39
42
|
}): Promise<IProduct>;
|
|
40
|
-
search(conditions: factory.product.ISearchConditions,
|
|
41
|
-
[key: string]: number;
|
|
42
|
-
}): Promise<IProduct[]>;
|
|
43
|
+
search(conditions: factory.product.ISearchConditions, inclusion: string[], exclusion: string[]): Promise<IProduct[]>;
|
|
43
44
|
deleteById(params: {
|
|
44
45
|
id: string;
|
|
45
46
|
}): Promise<void>;
|
|
@@ -53,6 +54,7 @@ export declare class MongoRepository {
|
|
|
53
54
|
typeOf: factory.service.paymentService.PaymentServiceType;
|
|
54
55
|
id: string;
|
|
55
56
|
}): Promise<factory.product.IAvailableChannel>;
|
|
57
|
+
searchPaymentServicesByProvider(params: Pick<factory.product.ISearchConditions, 'limit' | 'page' | 'sort' | 'project' | 'provider' | 'typeOf'>): Promise<IPaymentServiceByProvider[]>;
|
|
56
58
|
/**
|
|
57
59
|
* プロダクトを保管する
|
|
58
60
|
* 作成 or 更新
|
|
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
23
23
|
exports.MongoRepository = void 0;
|
|
24
24
|
const product_1 = require("./mongoose/schemas/product");
|
|
25
25
|
const factory = require("../factory");
|
|
26
|
+
const settings_1 = require("../settings");
|
|
26
27
|
/**
|
|
27
28
|
* プロダクトリポジトリ
|
|
28
29
|
*/
|
|
@@ -32,7 +33,7 @@ class MongoRepository {
|
|
|
32
33
|
}
|
|
33
34
|
// tslint:disable-next-line:max-func-body-length
|
|
34
35
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
35
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
36
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
36
37
|
// MongoDB検索条件
|
|
37
38
|
const andConditions = [];
|
|
38
39
|
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
@@ -143,6 +144,11 @@ class MongoRepository {
|
|
|
143
144
|
]
|
|
144
145
|
});
|
|
145
146
|
}
|
|
147
|
+
// プロバイダー条件を追加(2023-06-21~)
|
|
148
|
+
const providerIdEq = (_x = (_w = params.provider) === null || _w === void 0 ? void 0 : _w.id) === null || _x === void 0 ? void 0 : _x.$eq;
|
|
149
|
+
if (typeof providerIdEq === 'string') {
|
|
150
|
+
andConditions.push({ 'provider.id': { $exists: true, $eq: providerIdEq } });
|
|
151
|
+
}
|
|
146
152
|
return andConditions;
|
|
147
153
|
}
|
|
148
154
|
findById(conditions, projection) {
|
|
@@ -155,11 +161,31 @@ class MongoRepository {
|
|
|
155
161
|
return doc.toObject();
|
|
156
162
|
});
|
|
157
163
|
}
|
|
158
|
-
search(conditions,
|
|
164
|
+
search(conditions,
|
|
165
|
+
// projection?: { [key: string]: number }
|
|
166
|
+
inclusion, exclusion) {
|
|
159
167
|
var _a;
|
|
160
168
|
return __awaiter(this, void 0, void 0, function* () {
|
|
161
169
|
const andConditions = MongoRepository.CREATE_MONGO_CONDITIONS(conditions);
|
|
162
|
-
|
|
170
|
+
let projection = {};
|
|
171
|
+
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
172
|
+
inclusion.forEach((field) => {
|
|
173
|
+
projection[field] = 1;
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
projection = {
|
|
178
|
+
__v: 0,
|
|
179
|
+
createdAt: 0,
|
|
180
|
+
updatedAt: 0
|
|
181
|
+
};
|
|
182
|
+
if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
183
|
+
exclusion.forEach((field) => {
|
|
184
|
+
projection[field] = 0;
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
const query = this.productModel.find((andConditions.length > 0) ? { $and: andConditions } : {}, projection);
|
|
163
189
|
if (typeof conditions.limit === 'number' && conditions.limit > 0) {
|
|
164
190
|
const page = (typeof conditions.page === 'number' && conditions.page > 0) ? conditions.page : 1;
|
|
165
191
|
query.limit(conditions.limit)
|
|
@@ -170,7 +196,7 @@ class MongoRepository {
|
|
|
170
196
|
if (((_a = conditions.sort) === null || _a === void 0 ? void 0 : _a.productID) !== undefined) {
|
|
171
197
|
query.sort({ productID: conditions.sort.productID });
|
|
172
198
|
}
|
|
173
|
-
return query.setOptions({ maxTimeMS:
|
|
199
|
+
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
174
200
|
.exec()
|
|
175
201
|
.then((docs) => docs.map((doc) => doc.toObject()));
|
|
176
202
|
});
|
|
@@ -192,7 +218,7 @@ class MongoRepository {
|
|
|
192
218
|
project: { id: { $eq: params.project.id } },
|
|
193
219
|
typeOf: { $eq: params.typeOf },
|
|
194
220
|
id: { $eq: params.id }
|
|
195
|
-
});
|
|
221
|
+
}, [], []);
|
|
196
222
|
const paymentServiceSetting = paymentServices.shift();
|
|
197
223
|
if (paymentServiceSetting === undefined) {
|
|
198
224
|
throw new factory.errors.NotFound('PaymentService');
|
|
@@ -204,6 +230,67 @@ class MongoRepository {
|
|
|
204
230
|
return availableChannel;
|
|
205
231
|
});
|
|
206
232
|
}
|
|
233
|
+
searchPaymentServicesByProvider(params) {
|
|
234
|
+
var _a, _b, _c, _d, _e, _f;
|
|
235
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
236
|
+
const matchStages = [];
|
|
237
|
+
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
238
|
+
if (typeof projectIdEq === 'string') {
|
|
239
|
+
matchStages.push({ $match: { 'project.id': { $eq: projectIdEq } } });
|
|
240
|
+
}
|
|
241
|
+
const typeOfEq = (_c = params.typeOf) === null || _c === void 0 ? void 0 : _c.$eq;
|
|
242
|
+
if (typeof typeOfEq === 'string') {
|
|
243
|
+
matchStages.push({ $match: { typeOf: { $eq: typeOfEq } } });
|
|
244
|
+
}
|
|
245
|
+
const providerIdEq = (_e = (_d = params.provider) === null || _d === void 0 ? void 0 : _d.id) === null || _e === void 0 ? void 0 : _e.$eq;
|
|
246
|
+
if (typeof providerIdEq === 'string') {
|
|
247
|
+
matchStages.push({ $match: { 'provider.id': { $exists: true, $eq: providerIdEq } } });
|
|
248
|
+
}
|
|
249
|
+
const aggregate = this.productModel.aggregate([
|
|
250
|
+
...(typeof ((_f = params.sort) === null || _f === void 0 ? void 0 : _f.productID) === 'number')
|
|
251
|
+
? [{ $sort: { productID: params.sort.productID } }]
|
|
252
|
+
: [],
|
|
253
|
+
{
|
|
254
|
+
$unwind: {
|
|
255
|
+
path: '$provider'
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
...matchStages,
|
|
259
|
+
{
|
|
260
|
+
$project: {
|
|
261
|
+
_id: 0,
|
|
262
|
+
typeOf: '$typeOf',
|
|
263
|
+
productID: '$productID',
|
|
264
|
+
description: '$description',
|
|
265
|
+
name: '$name',
|
|
266
|
+
// provider: [ [Object] ],
|
|
267
|
+
additionalProperty: '$additionalProperty',
|
|
268
|
+
serviceType: '$serviceType',
|
|
269
|
+
id: { $toString: '$_id' },
|
|
270
|
+
// ↓セキュアな情報を隠蔽するように
|
|
271
|
+
provider: {
|
|
272
|
+
credentials: {
|
|
273
|
+
shopId: '$provider.credentials.shopId',
|
|
274
|
+
tokenizationCode: '$provider.credentials.tokenizationCode',
|
|
275
|
+
paymentUrl: {
|
|
276
|
+
expiresInSeconds: '$provider.credentials.paymentUrl.expiresInSeconds',
|
|
277
|
+
useCallback: '$provider.credentials.paymentUrl.useCallback',
|
|
278
|
+
useWebhook: '$provider.credentials.paymentUrl.useWebhook'
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
]);
|
|
285
|
+
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
286
|
+
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
287
|
+
aggregate.limit(params.limit * page)
|
|
288
|
+
.skip(params.limit * (page - 1));
|
|
289
|
+
}
|
|
290
|
+
return aggregate.option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
291
|
+
.exec();
|
|
292
|
+
});
|
|
293
|
+
}
|
|
207
294
|
/**
|
|
208
295
|
* プロダクトを保管する
|
|
209
296
|
* 作成 or 更新
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.MongoRepository = void 0;
|
|
13
13
|
const project_1 = require("./mongoose/schemas/project");
|
|
14
14
|
const factory = require("../factory");
|
|
15
|
+
const settings_1 = require("../settings");
|
|
15
16
|
/**
|
|
16
17
|
* プロジェクトリポジトリ
|
|
17
18
|
*/
|
|
@@ -89,7 +90,7 @@ class MongoRepository {
|
|
|
89
90
|
if (((_a = conditions.sort) === null || _a === void 0 ? void 0 : _a._id) !== undefined) {
|
|
90
91
|
query.sort({ _id: conditions.sort._id });
|
|
91
92
|
}
|
|
92
|
-
return query.setOptions({ maxTimeMS:
|
|
93
|
+
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
93
94
|
.exec()
|
|
94
95
|
.then((docs) => docs.map((doc) => doc.toObject()));
|
|
95
96
|
});
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BulkWriteResult as BulkWriteOpResultObject } from 'mongodb';
|
|
1
2
|
import { Connection, UpdateWriteOpResult } from 'mongoose';
|
|
2
3
|
import * as factory from '../factory';
|
|
3
4
|
export interface IUpdatePartiallyParams {
|
|
@@ -38,13 +39,20 @@ export declare class MongoRepository {
|
|
|
38
39
|
broker?: factory.reservation.IBroker<factory.reservationType>;
|
|
39
40
|
issuedThrough?: factory.assetTransaction.reserve.IIssuedThrough;
|
|
40
41
|
}): Promise<void>;
|
|
41
|
-
|
|
42
|
+
confirmByIdIfNotExist__(params: {
|
|
42
43
|
reservation: factory.assetTransaction.reserve.IObjectSubReservation;
|
|
43
44
|
reservationFor: factory.assetTransaction.reserve.IReservationFor;
|
|
44
45
|
underName?: factory.reservation.IUnderName<factory.reservationType.EventReservation>;
|
|
45
46
|
broker?: factory.reservation.IBroker<factory.reservationType>;
|
|
46
47
|
issuedThrough?: factory.assetTransaction.reserve.IIssuedThrough;
|
|
47
48
|
}): Promise<void>;
|
|
49
|
+
confirmManyIfNotExist(params: {
|
|
50
|
+
subReservation: factory.assetTransaction.reserve.IObjectSubReservation[];
|
|
51
|
+
reservationFor: factory.assetTransaction.reserve.IReservationFor;
|
|
52
|
+
underName?: factory.reservation.IUnderName<factory.reservationType.EventReservation>;
|
|
53
|
+
broker?: factory.reservation.IBroker<factory.reservationType>;
|
|
54
|
+
issuedThrough?: factory.assetTransaction.reserve.IIssuedThrough;
|
|
55
|
+
}): Promise<BulkWriteOpResultObject | void>;
|
|
48
56
|
/**
|
|
49
57
|
* 予約取消
|
|
50
58
|
*/
|
|
@@ -10,10 +10,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.MongoRepository = void 0;
|
|
13
|
-
const createDebug = require("debug");
|
|
14
13
|
const reservation_1 = require("./mongoose/schemas/reservation");
|
|
15
14
|
const factory = require("../factory");
|
|
16
|
-
const
|
|
15
|
+
const settings_1 = require("../settings");
|
|
17
16
|
/**
|
|
18
17
|
* 予約リポジトリ
|
|
19
18
|
*/
|
|
@@ -813,18 +812,6 @@ class MongoRepository {
|
|
|
813
812
|
}
|
|
814
813
|
return andConditions;
|
|
815
814
|
}
|
|
816
|
-
// public async distinct<T extends factory.reservationType>(
|
|
817
|
-
// field: string,
|
|
818
|
-
// params: factory.reservation.ISearchConditions<T>
|
|
819
|
-
// ): Promise<any[]> {
|
|
820
|
-
// const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
|
|
821
|
-
// return this.reservationModel.distinct(
|
|
822
|
-
// field,
|
|
823
|
-
// (conditions.length > 0) ? { $and: conditions } : {}
|
|
824
|
-
// )
|
|
825
|
-
// .setOptions({ maxTimeMS: 10000 })
|
|
826
|
-
// .exec();
|
|
827
|
-
// }
|
|
828
815
|
createMany(params) {
|
|
829
816
|
return __awaiter(this, void 0, void 0, function* () {
|
|
830
817
|
if (params.reservations.length > 0) {
|
|
@@ -851,7 +838,7 @@ class MongoRepository {
|
|
|
851
838
|
return __awaiter(this, void 0, void 0, function* () {
|
|
852
839
|
const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
|
|
853
840
|
return this.reservationModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
|
|
854
|
-
.setOptions({ maxTimeMS:
|
|
841
|
+
.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
855
842
|
.exec();
|
|
856
843
|
});
|
|
857
844
|
}
|
|
@@ -879,7 +866,7 @@ class MongoRepository {
|
|
|
879
866
|
if (((_a = params.sort) === null || _a === void 0 ? void 0 : _a.modifiedTime) !== undefined) {
|
|
880
867
|
query.sort({ modifiedTime: params.sort.modifiedTime });
|
|
881
868
|
}
|
|
882
|
-
return query.setOptions({ maxTimeMS:
|
|
869
|
+
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
883
870
|
.exec()
|
|
884
871
|
.then((docs) => docs.map((doc) => doc.toObject()));
|
|
885
872
|
});
|
|
@@ -926,15 +913,37 @@ class MongoRepository {
|
|
|
926
913
|
.exec();
|
|
927
914
|
});
|
|
928
915
|
}
|
|
929
|
-
|
|
916
|
+
confirmByIdIfNotExist__(params) {
|
|
930
917
|
var _a, _b;
|
|
931
918
|
return __awaiter(this, void 0, void 0, function* () {
|
|
932
|
-
|
|
919
|
+
yield this.reservationModel.findOneAndUpdate({ _id: { $eq: params.reservation.id } }, {
|
|
933
920
|
$setOnInsert: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, params.reservation), { _id: params.reservation.id, reservationFor: params.reservationFor, reservationStatus: factory.reservationStatusType.ReservationConfirmed, modifiedTime: new Date() }), (params.underName !== undefined) ? { underName: params.underName } : undefined), (typeof ((_a = params.broker) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { broker: params.broker } : undefined), (typeof ((_b = params.issuedThrough) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string') ? { issuedThrough: params.issuedThrough } : undefined)
|
|
934
921
|
}, { upsert: true, new: true })
|
|
935
922
|
.select({ _id: 1 })
|
|
936
923
|
.exec();
|
|
937
|
-
|
|
924
|
+
});
|
|
925
|
+
}
|
|
926
|
+
confirmManyIfNotExist(params) {
|
|
927
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
928
|
+
const modifiedTime = new Date();
|
|
929
|
+
const bulkWriteOps = [];
|
|
930
|
+
if (Array.isArray(params.subReservation)) {
|
|
931
|
+
params.subReservation.forEach((subReservation) => {
|
|
932
|
+
var _a, _b;
|
|
933
|
+
bulkWriteOps.push({
|
|
934
|
+
updateOne: {
|
|
935
|
+
filter: { _id: { $eq: subReservation.id } },
|
|
936
|
+
update: {
|
|
937
|
+
$setOnInsert: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, subReservation), { _id: subReservation.id, reservationFor: params.reservationFor, reservationStatus: factory.reservationStatusType.ReservationConfirmed, modifiedTime }), (params.underName !== undefined) ? { underName: params.underName } : undefined), (typeof ((_a = params.broker) === null || _a === void 0 ? void 0 : _a.typeOf) === 'string') ? { broker: params.broker } : undefined), (typeof ((_b = params.issuedThrough) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string') ? { issuedThrough: params.issuedThrough } : undefined)
|
|
938
|
+
},
|
|
939
|
+
upsert: true
|
|
940
|
+
}
|
|
941
|
+
});
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
if (bulkWriteOps.length > 0) {
|
|
945
|
+
return this.reservationModel.bulkWrite(bulkWriteOps, { ordered: false });
|
|
946
|
+
}
|
|
938
947
|
});
|
|
939
948
|
}
|
|
940
949
|
/**
|
|
@@ -1146,7 +1155,7 @@ class MongoRepository {
|
|
|
1146
1155
|
}
|
|
1147
1156
|
})
|
|
1148
1157
|
.select({ _id: 1 })
|
|
1149
|
-
.setOptions({ maxTimeMS:
|
|
1158
|
+
.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
1150
1159
|
.exec()
|
|
1151
1160
|
.then((docs) => docs.map((doc) => doc._id.toString()));
|
|
1152
1161
|
});
|
|
@@ -17,6 +17,13 @@ export declare class MongoRepository {
|
|
|
17
17
|
static CREATE_MONGO_CONDITIONS(params: factory.iam.IRoleSearchConditions): any[];
|
|
18
18
|
count(params: factory.iam.IRoleSearchConditions): Promise<number>;
|
|
19
19
|
search(params: factory.iam.IRoleSearchConditions): Promise<IRole[]>;
|
|
20
|
+
aggregatePermissions(params: {
|
|
21
|
+
roleName: {
|
|
22
|
+
$in: string[];
|
|
23
|
+
};
|
|
24
|
+
}): Promise<{
|
|
25
|
+
_id: string;
|
|
26
|
+
}[]>;
|
|
20
27
|
findById(params: {
|
|
21
28
|
id: string;
|
|
22
29
|
}): Promise<IRole>;
|
package/lib/chevre/repo/role.js
CHANGED
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.MongoRepository = exports.RoleType = void 0;
|
|
13
13
|
const factory = require("../factory");
|
|
14
14
|
const role_1 = require("./mongoose/schemas/role");
|
|
15
|
+
const settings_1 = require("../settings");
|
|
15
16
|
var RoleType;
|
|
16
17
|
(function (RoleType) {
|
|
17
18
|
RoleType["OrganizationRole"] = "OrganizationRole";
|
|
@@ -67,7 +68,7 @@ class MongoRepository {
|
|
|
67
68
|
return __awaiter(this, void 0, void 0, function* () {
|
|
68
69
|
const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
|
|
69
70
|
return this.roleModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
|
|
70
|
-
.setOptions({ maxTimeMS:
|
|
71
|
+
.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
71
72
|
.exec();
|
|
72
73
|
});
|
|
73
74
|
}
|
|
@@ -91,11 +92,47 @@ class MongoRepository {
|
|
|
91
92
|
}
|
|
92
93
|
// const explainResult = await (<any>query).explain();
|
|
93
94
|
// console.log(explainResult[0].executionStats.allPlansExecution.map((e: any) => e.executionStages.inputStage));
|
|
94
|
-
return query.setOptions({ maxTimeMS:
|
|
95
|
+
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
95
96
|
.exec()
|
|
96
97
|
.then((docs) => docs.map((doc) => doc.toObject()));
|
|
97
98
|
});
|
|
98
99
|
}
|
|
100
|
+
aggregatePermissions(params) {
|
|
101
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
102
|
+
const matchStages = [
|
|
103
|
+
{ $match: { roleName: { $in: params.roleName.$in } } }
|
|
104
|
+
];
|
|
105
|
+
const aggregate = this.roleModel.aggregate([
|
|
106
|
+
// ...(typeof params.sort?.productID === 'number')
|
|
107
|
+
// ? [{ $sort: { productID: params.sort.productID } }]
|
|
108
|
+
// : [],
|
|
109
|
+
...matchStages,
|
|
110
|
+
{
|
|
111
|
+
$unwind: {
|
|
112
|
+
path: '$permissions'
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
$project: {
|
|
117
|
+
_id: 0,
|
|
118
|
+
permission: '$permissions'
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
$group: {
|
|
123
|
+
_id: '$permission'
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
]);
|
|
127
|
+
// if (typeof params.limit === 'number' && params.limit > 0) {
|
|
128
|
+
// const page: number = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
129
|
+
// aggregate.limit(params.limit * page)
|
|
130
|
+
// .skip(params.limit * (page - 1));
|
|
131
|
+
// }
|
|
132
|
+
return aggregate.option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
133
|
+
.exec();
|
|
134
|
+
});
|
|
135
|
+
}
|
|
99
136
|
findById(params) {
|
|
100
137
|
return __awaiter(this, void 0, void 0, function* () {
|
|
101
138
|
const doc = yield this.roleModel.findOne({
|
|
@@ -37,7 +37,7 @@ export declare class MongoRepository {
|
|
|
37
37
|
*/
|
|
38
38
|
findById(conditions: {
|
|
39
39
|
id: string;
|
|
40
|
-
},
|
|
40
|
+
}, inclusion: string[], exclusion: string[]): Promise<ISeller>;
|
|
41
41
|
/**
|
|
42
42
|
* 販売者を保管する
|
|
43
43
|
*/
|
|
@@ -50,6 +50,26 @@ export declare class MongoRepository {
|
|
|
50
50
|
* 販売者検索
|
|
51
51
|
*/
|
|
52
52
|
search(conditions: factory.seller.ISearchConditions, projection?: any): Promise<ISeller[]>;
|
|
53
|
+
/**
|
|
54
|
+
* 対応決済方法を検索する
|
|
55
|
+
*/
|
|
56
|
+
searchPaymentAcceptedById(params: {
|
|
57
|
+
limit?: number;
|
|
58
|
+
page?: number;
|
|
59
|
+
/**
|
|
60
|
+
* 販売者ID
|
|
61
|
+
*/
|
|
62
|
+
id: {
|
|
63
|
+
$eq: string;
|
|
64
|
+
};
|
|
65
|
+
project: {
|
|
66
|
+
id: {
|
|
67
|
+
$eq: string;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
}): Promise<{
|
|
71
|
+
codeValue: string;
|
|
72
|
+
}[]>;
|
|
53
73
|
/**
|
|
54
74
|
* 販売者を削除する
|
|
55
75
|
*/
|
|
@@ -21,8 +21,10 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
};
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
23
|
exports.MongoRepository = void 0;
|
|
24
|
+
const mongoose_1 = require("mongoose");
|
|
24
25
|
const seller_1 = require("./mongoose/schemas/seller");
|
|
25
26
|
const factory = require("../factory");
|
|
27
|
+
const settings_1 = require("../settings");
|
|
26
28
|
/**
|
|
27
29
|
* 販売者リポジトリ
|
|
28
30
|
*/
|
|
@@ -123,9 +125,29 @@ class MongoRepository {
|
|
|
123
125
|
/**
|
|
124
126
|
* 特定販売者検索
|
|
125
127
|
*/
|
|
126
|
-
findById(conditions,
|
|
128
|
+
findById(conditions,
|
|
129
|
+
// projection?: any
|
|
130
|
+
inclusion, exclusion) {
|
|
127
131
|
return __awaiter(this, void 0, void 0, function* () {
|
|
128
|
-
|
|
132
|
+
let projection = {};
|
|
133
|
+
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
134
|
+
inclusion.forEach((field) => {
|
|
135
|
+
projection[field] = 1;
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
projection = {
|
|
140
|
+
__v: 0,
|
|
141
|
+
createdAt: 0,
|
|
142
|
+
updatedAt: 0
|
|
143
|
+
};
|
|
144
|
+
if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
145
|
+
exclusion.forEach((field) => {
|
|
146
|
+
projection[field] = 0;
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
const doc = yield this.organizationModel.findOne({ _id: conditions.id }, projection)
|
|
129
151
|
.exec();
|
|
130
152
|
if (doc === null) {
|
|
131
153
|
throw new factory.errors.NotFound(this.organizationModel.modelName);
|
|
@@ -160,7 +182,7 @@ class MongoRepository {
|
|
|
160
182
|
return __awaiter(this, void 0, void 0, function* () {
|
|
161
183
|
const conditions = MongoRepository.CREATE_MONGO_CONDITIONS(params);
|
|
162
184
|
return this.organizationModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
|
|
163
|
-
.setOptions({ maxTimeMS:
|
|
185
|
+
.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
164
186
|
.exec();
|
|
165
187
|
});
|
|
166
188
|
}
|
|
@@ -182,11 +204,44 @@ class MongoRepository {
|
|
|
182
204
|
if (((_a = conditions.sort) === null || _a === void 0 ? void 0 : _a.branchCode) !== undefined) {
|
|
183
205
|
query.sort({ branchCode: conditions.sort.branchCode });
|
|
184
206
|
}
|
|
185
|
-
return query.setOptions({ maxTimeMS:
|
|
207
|
+
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
186
208
|
.exec()
|
|
187
209
|
.then((docs) => docs.map((doc) => doc.toObject()));
|
|
188
210
|
});
|
|
189
211
|
}
|
|
212
|
+
/**
|
|
213
|
+
* 対応決済方法を検索する
|
|
214
|
+
*/
|
|
215
|
+
searchPaymentAcceptedById(params) {
|
|
216
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
217
|
+
const matchStages = [
|
|
218
|
+
{ $match: { 'project.id': { $eq: params.project.id.$eq } } },
|
|
219
|
+
{ $match: { _id: { $eq: new mongoose_1.Types.ObjectId(params.id.$eq) } } }
|
|
220
|
+
];
|
|
221
|
+
const aggregate = this.organizationModel.aggregate([
|
|
222
|
+
{
|
|
223
|
+
$unwind: {
|
|
224
|
+
path: '$paymentAccepted'
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
...matchStages,
|
|
228
|
+
{ $sort: { 'paymentAccepted.paymentMethodType': factory.sortType.Ascending } },
|
|
229
|
+
{
|
|
230
|
+
$project: {
|
|
231
|
+
_id: 0,
|
|
232
|
+
codeValue: '$paymentAccepted.paymentMethodType'
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
]);
|
|
236
|
+
if (typeof params.limit === 'number' && params.limit > 0) {
|
|
237
|
+
const page = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
238
|
+
aggregate.limit(params.limit * page)
|
|
239
|
+
.skip(params.limit * (page - 1));
|
|
240
|
+
}
|
|
241
|
+
return aggregate.option({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
242
|
+
.exec();
|
|
243
|
+
});
|
|
244
|
+
}
|
|
190
245
|
/**
|
|
191
246
|
* 販売者を削除する
|
|
192
247
|
*/
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.MongoRepository = void 0;
|
|
13
13
|
const serviceOutput_1 = require("./mongoose/schemas/serviceOutput");
|
|
14
14
|
const factory = require("../factory");
|
|
15
|
+
const settings_1 = require("../settings");
|
|
15
16
|
/**
|
|
16
17
|
* サービスアウトプットリポジトリ
|
|
17
18
|
*/
|
|
@@ -128,7 +129,7 @@ class MongoRepository {
|
|
|
128
129
|
// if (params.sort !== undefined) {
|
|
129
130
|
// query.sort(params.sort);
|
|
130
131
|
// }
|
|
131
|
-
return query.setOptions({ maxTimeMS:
|
|
132
|
+
return query.setOptions({ maxTimeMS: settings_1.MONGO_MAX_TIME_MS })
|
|
132
133
|
.exec()
|
|
133
134
|
.then((docs) => docs.map((doc) => doc.toObject()));
|
|
134
135
|
});
|