@chevre/domain 21.4.0-alpha.19 → 21.4.0-alpha.20
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/migrateReservationProvider.ts +3 -3
- package/lib/chevre/repo/product.d.ts +1 -3
- package/lib/chevre/repo/product.js +23 -2
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +2 -2
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +1 -1
- package/lib/chevre/service/assetTransaction/registerService.js +2 -2
- package/lib/chevre/service/assetTransaction/reserve.js +1 -1
- package/lib/chevre/service/moneyTransfer.js +1 -1
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +1 -1
- package/lib/chevre/service/offer/product/searchProductOffers.js +1 -1
- package/lib/chevre/service/payment/paymentCard.js +1 -3
- package/lib/chevre/service/transaction/orderProgramMembership/findCreditCard.js +1 -1
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ import { chevre } from '../../../lib/index';
|
|
|
9
9
|
|
|
10
10
|
// tslint:disable-next-line:max-func-body-length
|
|
11
11
|
async function main() {
|
|
12
|
-
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex:
|
|
12
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: true });
|
|
13
13
|
|
|
14
14
|
const reservationRepo = new chevre.repository.Reservation(mongoose.connection);
|
|
15
15
|
const placeRepo = new chevre.repository.Place(mongoose.connection);
|
|
@@ -85,9 +85,9 @@ async function main() {
|
|
|
85
85
|
'movieTheaterBranchCode:', movieTheaterBranchCode,
|
|
86
86
|
i
|
|
87
87
|
);
|
|
88
|
-
throw new Error('movieTheater not found');
|
|
88
|
+
// throw new Error('movieTheater not found');
|
|
89
89
|
|
|
90
|
-
|
|
90
|
+
return;
|
|
91
91
|
}
|
|
92
92
|
if (typeof sellerId === 'string') {
|
|
93
93
|
const newProvider: chevre.factory.reservation.IProvider = {
|
|
@@ -37,9 +37,7 @@ export declare class MongoRepository {
|
|
|
37
37
|
static CREATE_MONGO_CONDITIONS(params: factory.product.ISearchConditions): any[];
|
|
38
38
|
findById(conditions: {
|
|
39
39
|
id: string;
|
|
40
|
-
},
|
|
41
|
-
[key: string]: number;
|
|
42
|
-
}): Promise<IProduct>;
|
|
40
|
+
}, inclusion: string[], exclusion: string[]): Promise<IProduct>;
|
|
43
41
|
search(conditions: factory.product.ISearchConditions, inclusion: string[], exclusion: string[]): Promise<IProduct[]>;
|
|
44
42
|
deleteById(params: {
|
|
45
43
|
id: string;
|
|
@@ -151,9 +151,30 @@ class MongoRepository {
|
|
|
151
151
|
}
|
|
152
152
|
return andConditions;
|
|
153
153
|
}
|
|
154
|
-
findById(conditions,
|
|
154
|
+
findById(conditions,
|
|
155
|
+
// inclusion化(2023-07-20~)
|
|
156
|
+
// projection?: { [key: string]: number }
|
|
157
|
+
inclusion, exclusion) {
|
|
155
158
|
return __awaiter(this, void 0, void 0, function* () {
|
|
156
|
-
|
|
159
|
+
let projection = {};
|
|
160
|
+
if (Array.isArray(inclusion) && inclusion.length > 0) {
|
|
161
|
+
inclusion.forEach((field) => {
|
|
162
|
+
projection[field] = 1;
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
projection = {
|
|
167
|
+
__v: 0,
|
|
168
|
+
createdAt: 0,
|
|
169
|
+
updatedAt: 0
|
|
170
|
+
};
|
|
171
|
+
if (Array.isArray(exclusion) && exclusion.length > 0) {
|
|
172
|
+
exclusion.forEach((field) => {
|
|
173
|
+
projection[field] = 0;
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
const doc = yield this.productModel.findOne({ _id: conditions.id }, projection)
|
|
157
178
|
.exec();
|
|
158
179
|
if (doc === null) {
|
|
159
180
|
throw new factory.errors.NotFound(this.productModel.modelName);
|
|
@@ -175,7 +175,7 @@ function findOffers(params) {
|
|
|
175
175
|
// 興行設定があれば興行のカタログを参照する(2022-08-31~)
|
|
176
176
|
const eventOffers = params.event.offers;
|
|
177
177
|
if (typeof ((_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
|
|
178
|
-
const eventService = yield repos.product.findById({ id: eventOffers.itemOffered.id });
|
|
178
|
+
const eventService = yield repos.product.findById({ id: eventOffers.itemOffered.id }, ['hasOfferCatalog'], []);
|
|
179
179
|
if (typeof ((_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
|
|
180
180
|
const findOffersByOfferCatalogIdResult = yield repos.offer.findOffersByOfferCatalogId({
|
|
181
181
|
offerCatalog: { id: eventService.hasOfferCatalog.id },
|
|
@@ -209,7 +209,7 @@ function calculateOfferCount(params) {
|
|
|
209
209
|
try {
|
|
210
210
|
const eventOffers = params.event.offers;
|
|
211
211
|
if (typeof ((_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
|
|
212
|
-
const eventService = yield repos.product.findById({ id: eventOffers.itemOffered.id });
|
|
212
|
+
const eventService = yield repos.product.findById({ id: eventOffers.itemOffered.id }, ['hasOfferCatalog'], []);
|
|
213
213
|
if (typeof ((_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
|
|
214
214
|
const catalogs = yield repos.offerCatalog.search({
|
|
215
215
|
limit: 1,
|
|
@@ -100,7 +100,7 @@ function findOffers(params) {
|
|
|
100
100
|
// 興行設定があれば興行のカタログを参照する(2022-08-31~)
|
|
101
101
|
const eventOffers = params.event.offers;
|
|
102
102
|
if (typeof ((_a = eventOffers === null || eventOffers === void 0 ? void 0 : eventOffers.itemOffered) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
|
|
103
|
-
const eventService = yield repos.product.findById({ id: eventOffers.itemOffered.id });
|
|
103
|
+
const eventService = yield repos.product.findById({ id: eventOffers.itemOffered.id }, ['hasOfferCatalog'], []);
|
|
104
104
|
if (typeof ((_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
|
|
105
105
|
const findOffersByOfferCatalogIdResult = yield repos.offer.findOffersByOfferCatalogId({
|
|
106
106
|
offerCatalog: { id: eventService.hasOfferCatalog.id },
|
|
@@ -40,7 +40,7 @@ function start(params) {
|
|
|
40
40
|
throw new factory.errors.ArgumentNull('object.itemOffered.id');
|
|
41
41
|
}
|
|
42
42
|
// プロダクト確認
|
|
43
|
-
const product = yield repos.product.findById({ id: productId });
|
|
43
|
+
const product = yield repos.product.findById({ id: productId }, [], []);
|
|
44
44
|
const transactionNumber = params.transactionNumber;
|
|
45
45
|
if (typeof transactionNumber !== 'string' || transactionNumber.length === 0) {
|
|
46
46
|
throw new factory.errors.ArgumentNull('transactionNumber');
|
|
@@ -124,7 +124,7 @@ function createTransactionObject(params) {
|
|
|
124
124
|
function createPermitService(params) {
|
|
125
125
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
126
126
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
127
|
-
const product = yield repos.product.findById({ id: params.issuedThrough.id });
|
|
127
|
+
const product = yield repos.product.findById({ id: params.issuedThrough.id }, [], []);
|
|
128
128
|
const permitServiceEndpoint = (_a = product.availableChannel) === null || _a === void 0 ? void 0 : _a.serviceUrl;
|
|
129
129
|
const permitServiceAuthorizeServerDomain = (_c = (_b = product.availableChannel) === null || _b === void 0 ? void 0 : _b.credentials) === null || _c === void 0 ? void 0 : _c.authorizeServerDomain;
|
|
130
130
|
const permitServiceClientId = (_e = (_d = product.availableChannel) === null || _d === void 0 ? void 0 : _d.credentials) === null || _e === void 0 ? void 0 : _e.clientId;
|
|
@@ -531,7 +531,7 @@ function validateProgramMembershipUsed(params) {
|
|
|
531
531
|
function createPermitService(params) {
|
|
532
532
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
533
533
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
534
|
-
const product = yield repos.product.findById({ id: params.issuedThrough.id });
|
|
534
|
+
const product = yield repos.product.findById({ id: params.issuedThrough.id }, ['availableChannel'], []);
|
|
535
535
|
const permitServiceEndpoint = (_a = product.availableChannel) === null || _a === void 0 ? void 0 : _a.serviceUrl;
|
|
536
536
|
const permitServiceAuthorizeServerDomain = (_c = (_b = product.availableChannel) === null || _b === void 0 ? void 0 : _b.credentials) === null || _c === void 0 ? void 0 : _c.authorizeServerDomain;
|
|
537
537
|
const permitServiceClientId = (_e = (_d = product.availableChannel) === null || _d === void 0 ? void 0 : _d.credentials) === null || _e === void 0 ? void 0 : _e.clientId;
|
|
@@ -322,7 +322,7 @@ function getIssuedThroughIdByAction(params) {
|
|
|
322
322
|
function createPermitServiceCredentials(params) {
|
|
323
323
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
324
324
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
325
|
-
const paymentCardService = yield repos.product.findById({ id: params.issuedThrough.id });
|
|
325
|
+
const paymentCardService = yield repos.product.findById({ id: params.issuedThrough.id }, ['availableChannel'], []);
|
|
326
326
|
const permitServiceEndpoint = (_a = paymentCardService.availableChannel) === null || _a === void 0 ? void 0 : _a.serviceUrl;
|
|
327
327
|
const permitServiceAuthorizeServerDomain = (_c = (_b = paymentCardService.availableChannel) === null || _b === void 0 ? void 0 : _b.credentials) === null || _c === void 0 ? void 0 : _c.authorizeServerDomain;
|
|
328
328
|
const permitServiceClientId = (_e = (_d = paymentCardService.availableChannel) === null || _d === void 0 ? void 0 : _d.credentials) === null || _e === void 0 ? void 0 : _e.clientId;
|
|
@@ -18,7 +18,7 @@ function searchTicketOffersByItemOffered(params) {
|
|
|
18
18
|
var _a, _b, _c, _d;
|
|
19
19
|
let catalogId;
|
|
20
20
|
if (typeof ((_a = params.itemOffered) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
|
|
21
|
-
const eventService = yield repos.product.findById({ id: (_b = params.itemOffered) === null || _b === void 0 ? void 0 : _b.id });
|
|
21
|
+
const eventService = yield repos.product.findById({ id: (_b = params.itemOffered) === null || _b === void 0 ? void 0 : _b.id }, ['hasOfferCatalog'], []);
|
|
22
22
|
if (typeof ((_c = eventService.hasOfferCatalog) === null || _c === void 0 ? void 0 : _c.id) === 'string') {
|
|
23
23
|
catalogId = eventService.hasOfferCatalog.id;
|
|
24
24
|
}
|
|
@@ -18,7 +18,7 @@ function searchProductOffers(params) {
|
|
|
18
18
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
19
19
|
var _a;
|
|
20
20
|
// プロダクト検索
|
|
21
|
-
const productWithOffers = yield repos.product.findById({ id: params.itemOffered.id });
|
|
21
|
+
const productWithOffers = yield repos.product.findById({ id: params.itemOffered.id }, ['hasOfferCatalog'], []);
|
|
22
22
|
const offerCatalogId = (_a = productWithOffers.hasOfferCatalog) === null || _a === void 0 ? void 0 : _a.id;
|
|
23
23
|
if (typeof offerCatalogId !== 'string') {
|
|
24
24
|
return [];
|
|
@@ -75,9 +75,7 @@ function validatePaymentMethod(params, paymentServiceId) {
|
|
|
75
75
|
throw new factory.errors.ArgumentNull('object.paymentMethod.typeOf');
|
|
76
76
|
}
|
|
77
77
|
// プロダクトから通貨区分を取得
|
|
78
|
-
const paymentCatdProduct = yield repos.product.findById({
|
|
79
|
-
id: paymentServiceId
|
|
80
|
-
});
|
|
78
|
+
const paymentCatdProduct = yield repos.product.findById({ id: paymentServiceId }, ['serviceOutput'], []);
|
|
81
79
|
const currency = (_e = (_d = paymentCatdProduct.serviceOutput) === null || _d === void 0 ? void 0 : _d.amount) === null || _e === void 0 ? void 0 : _e.currency;
|
|
82
80
|
if (typeof currency !== 'string') {
|
|
83
81
|
throw new factory.errors.NotFound('product.serviceOutput.amount.currency');
|
|
@@ -112,7 +112,7 @@ function getCreditCardPaymentServiceChannel(params) {
|
|
|
112
112
|
throw new factory.errors.NotFound('PaymentService');
|
|
113
113
|
}
|
|
114
114
|
// IDで検索いないとavailableChannelを取得できない
|
|
115
|
-
const paymentService = yield repos.product.findById({ id: String(paymentServiceSetting.id) });
|
|
115
|
+
const paymentService = yield repos.product.findById({ id: String(paymentServiceSetting.id) }, ['availableChannel'], []);
|
|
116
116
|
const availableChannel = paymentService === null || paymentService === void 0 ? void 0 : paymentService.availableChannel;
|
|
117
117
|
if (typeof (availableChannel === null || availableChannel === void 0 ? void 0 : availableChannel.serviceUrl) !== 'string') {
|
|
118
118
|
throw new factory.errors.NotFound('paymentService.availableChannel.serviceUrl');
|
package/package.json
CHANGED