@chevre/domain 21.8.0-alpha.4 → 21.8.0-alpha.41
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/countOffers.ts +32 -0
- package/example/src/chevre/importOffersFromCOA.ts +7 -1
- package/example/src/chevre/migrateAggregateOffers.ts +75 -0
- package/example/src/chevre/migrateOrderPaymentMethodIdentifier.ts +81 -0
- package/example/src/chevre/migratePayTransactionPaymentMethodId.ts +72 -0
- package/example/src/chevre/migratePayTransactionPaymentMethodIdentifier.ts +78 -0
- package/example/src/chevre/processPay.ts +3 -4
- package/example/src/chevre/publishPermitOwnershipInfoToken.ts +56 -0
- package/example/src/chevre/pullAddOnsFromOffer.ts +26 -0
- package/example/src/chevre/searchOffersByCatalog.ts +9 -4
- package/example/src/chevre/searchOffersFromAggregateOffer.ts +167 -0
- package/example/src/chevre/sync2aggregateOffer.ts +27 -0
- package/example/src/chevre/syncAggregateOffer.ts +25 -0
- package/lib/chevre/repo/assetTransaction.d.ts +16 -1
- package/lib/chevre/repo/assetTransaction.js +54 -2
- package/lib/chevre/repo/mongoose/schemas/aggregateOffer.d.ts +71 -0
- package/lib/chevre/repo/mongoose/schemas/aggregateOffer.js +176 -0
- package/lib/chevre/repo/mongoose/schemas/offer.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +3 -0
- package/lib/chevre/repo/mongoose/schemas/order.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/task.d.ts +3 -0
- package/lib/chevre/repo/mongoose/schemas/task.js +8 -0
- package/lib/chevre/repo/offer.d.ts +71 -14
- package/lib/chevre/repo/offer.js +1061 -87
- package/lib/chevre/repo/order.d.ts +15 -0
- package/lib/chevre/repo/order.js +34 -1
- package/lib/chevre/repo/task.d.ts +7 -1
- package/lib/chevre/repo/task.js +100 -0
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +2 -2
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +2 -2
- package/lib/chevre/service/assetTransaction/pay/account/validation.js +2 -2
- package/lib/chevre/service/assetTransaction/pay/factory.js +26 -18
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +3 -3
- package/lib/chevre/service/assetTransaction/pay.js +65 -46
- package/lib/chevre/service/assetTransaction/refund/factory.js +8 -2
- package/lib/chevre/service/assetTransaction/reserve.js +105 -31
- package/lib/chevre/service/delivery.js +17 -0
- package/lib/chevre/service/offer/event/authorize.js +18 -19
- package/lib/chevre/service/offer/event/factory.js +8 -8
- package/lib/chevre/service/offer/event/importFromCOA.d.ts +2 -0
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +2 -2
- package/lib/chevre/service/offer/event/voidTransaction.js +7 -2
- package/lib/chevre/service/offer/product/searchProductOffers.js +1 -1
- package/lib/chevre/service/order/confirmPayTransaction.d.ts +0 -2
- package/lib/chevre/service/order/confirmPayTransaction.js +29 -40
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +27 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +226 -0
- package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +8 -6
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +80 -57
- package/lib/chevre/service/order/onOrderStatusChanged.js +104 -81
- package/lib/chevre/service/order/payOrder.d.ts +2 -10
- package/lib/chevre/service/order/payOrder.js +4 -45
- package/lib/chevre/service/order/placeOrder.js +11 -13
- package/lib/chevre/service/order.d.ts +3 -1
- package/lib/chevre/service/order.js +6 -2
- package/lib/chevre/service/payment/any/factory.js +33 -8
- package/lib/chevre/service/payment/any.js +30 -21
- package/lib/chevre/service/payment/creditCard.js +12 -12
- package/lib/chevre/service/payment/movieTicket/validation.js +2 -2
- package/lib/chevre/service/payment/movieTicket.js +10 -11
- package/lib/chevre/service/payment/paymentCard.js +9 -12
- package/lib/chevre/service/project.js +1 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +3 -0
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +1 -4
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +1 -5
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.d.ts +3 -0
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +1 -4
- package/lib/chevre/service/task/confirmPayTransaction.js +1 -3
- package/lib/chevre/service/task/importOffersFromCOA.js +3 -0
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.d.ts +6 -0
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +37 -0
- package/lib/chevre/service/task/onOrderPaymentCompleted.d.ts +6 -0
- package/lib/chevre/service/task/onOrderPaymentCompleted.js +35 -0
- package/lib/chevre/service/task/returnPayTransaction.js +8 -3
- package/lib/chevre/service/task/syncAggregateOffer.d.ts +7 -0
- package/lib/chevre/service/task/syncAggregateOffer.js +23 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/result.js +32 -16
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js +13 -11
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +53 -17
- package/lib/chevre/service/transaction/placeOrderInProgress.js +4 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +7 -6
- package/lib/chevre/service/transaction/returnOrder.js +5 -1
- package/lib/chevre/settings.d.ts +4 -2
- package/lib/chevre/settings.js +5 -5
- package/package.json +3 -3
- package/example/src/chevre/migrateAuthorizePaymentActionResult.ts +0 -83
- package/example/src/chevre/migrateEventOrganizer.ts +0 -154
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
// import * as redis from 'redis';
|
|
3
|
+
import * as mongoose from 'mongoose';
|
|
4
|
+
|
|
5
|
+
import { chevre } from '../../../lib/index';
|
|
6
|
+
|
|
7
|
+
const project = { id: String(process.env.PROJECT_ID) };
|
|
8
|
+
|
|
9
|
+
async function main() {
|
|
10
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
11
|
+
|
|
12
|
+
const offerRepo = new chevre.repository.Offer(mongoose.connection);
|
|
13
|
+
|
|
14
|
+
const result = await offerRepo.sync2aggregateOffer({
|
|
15
|
+
project: { id: project.id },
|
|
16
|
+
identifier: { $in: ['COA-120-15'] },
|
|
17
|
+
isDeleted: false,
|
|
18
|
+
typeOf: chevre.factory.offerType.Offer
|
|
19
|
+
});
|
|
20
|
+
console.log(result);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
main()
|
|
24
|
+
.then(console.log)
|
|
25
|
+
.catch(console.error);
|
|
@@ -78,7 +78,14 @@ export declare class MongoRepository {
|
|
|
78
78
|
confirm<T extends factory.assetTransactionType>(params: {
|
|
79
79
|
typeOf: T;
|
|
80
80
|
id: string;
|
|
81
|
-
object?: Pick<factory.assetTransaction.reserve.IObject, 'underName'
|
|
81
|
+
object?: Pick<factory.assetTransaction.reserve.IObject, 'underName'> & {
|
|
82
|
+
/**
|
|
83
|
+
* 決済取引における決済方法区分指定
|
|
84
|
+
*/
|
|
85
|
+
paymentMethod?: {
|
|
86
|
+
identifier?: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
82
89
|
result: factory.assetTransaction.IResult<T>;
|
|
83
90
|
potentialActions: factory.assetTransaction.IPotentialActions<T>;
|
|
84
91
|
}): Promise<void>;
|
|
@@ -182,6 +189,14 @@ export declare class MongoRepository {
|
|
|
182
189
|
id: string;
|
|
183
190
|
update: any;
|
|
184
191
|
}): Promise<factory.assetTransaction.ITransaction<T>>;
|
|
192
|
+
migratePaymentMethodIdentifier(params: {
|
|
193
|
+
transactionNumber: string;
|
|
194
|
+
object: {
|
|
195
|
+
paymentMethod: {
|
|
196
|
+
identifier: string;
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
}): Promise<any>;
|
|
185
200
|
findByIdAndDelete(params: {
|
|
186
201
|
id: string;
|
|
187
202
|
}): Promise<void>;
|
|
@@ -344,14 +344,16 @@ class MongoRepository {
|
|
|
344
344
|
* 取引を確定する
|
|
345
345
|
*/
|
|
346
346
|
confirm(params) {
|
|
347
|
-
var _a, _b;
|
|
347
|
+
var _a, _b, _c, _d;
|
|
348
348
|
return __awaiter(this, void 0, void 0, function* () {
|
|
349
349
|
const doc = yield this.transactionModel.findOneAndUpdate({
|
|
350
350
|
_id: { $eq: params.id },
|
|
351
351
|
typeOf: { $eq: params.typeOf },
|
|
352
352
|
status: { $eq: factory.transactionStatusType.InProgress }
|
|
353
|
-
}, Object.assign({ status: factory.transactionStatusType.Confirmed, endDate: new Date(), result: params.result, potentialActions: params.potentialActions }, (typeof ((_b = (_a = params.object) === null || _a === void 0 ? void 0 : _a.underName) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string')
|
|
353
|
+
}, Object.assign(Object.assign({ status: factory.transactionStatusType.Confirmed, endDate: new Date(), result: params.result, potentialActions: params.potentialActions }, (typeof ((_b = (_a = params.object) === null || _a === void 0 ? void 0 : _a.underName) === null || _b === void 0 ? void 0 : _b.typeOf) === 'string')
|
|
354
354
|
? { 'object.underName': params.object.underName }
|
|
355
|
+
: undefined), (typeof ((_d = (_c = params.object) === null || _c === void 0 ? void 0 : _c.paymentMethod) === null || _d === void 0 ? void 0 : _d.identifier) === 'string')
|
|
356
|
+
? { 'object.paymentMethod.identifier': params.object.paymentMethod.identifier }
|
|
355
357
|
: undefined), {
|
|
356
358
|
new: true,
|
|
357
359
|
projection: { _id: 1 }
|
|
@@ -704,6 +706,55 @@ class MongoRepository {
|
|
|
704
706
|
});
|
|
705
707
|
});
|
|
706
708
|
}
|
|
709
|
+
migratePaymentMethodIdentifier(params) {
|
|
710
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
711
|
+
return this.transactionModel.findOneAndUpdate({
|
|
712
|
+
typeOf: { $eq: factory.assetTransactionType.Pay },
|
|
713
|
+
transactionNumber: { $exists: true, $eq: params.transactionNumber }
|
|
714
|
+
}, { 'object.paymentMethod.identifier': params.object.paymentMethod.identifier }, {
|
|
715
|
+
new: true,
|
|
716
|
+
projection: { _id: 1 }
|
|
717
|
+
})
|
|
718
|
+
.exec()
|
|
719
|
+
.then((doc) => {
|
|
720
|
+
if (doc === null) {
|
|
721
|
+
throw new factory.errors.ArgumentNull(this.transactionModel.modelName);
|
|
722
|
+
}
|
|
723
|
+
return doc.toObject();
|
|
724
|
+
});
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
// public async migratePaymentMethodIdentifierMany() {
|
|
728
|
+
// // return this.transactionModel.updateMany(
|
|
729
|
+
// // {
|
|
730
|
+
// // typeOf: { $eq: factory.assetTransactionType.Pay }
|
|
731
|
+
// // // 'object.paymentMethod.identifier': { $exists: false }
|
|
732
|
+
// // },
|
|
733
|
+
// // { $set: { 'object.paymentMethod.identifier': '$object.paymentMethod.typeOf' } }
|
|
734
|
+
// // )
|
|
735
|
+
// // .exec();
|
|
736
|
+
// return this.transactionModel.aggregate([
|
|
737
|
+
// {
|
|
738
|
+
// $match: {
|
|
739
|
+
// typeOf: { $eq: factory.assetTransactionType.Pay }
|
|
740
|
+
// }
|
|
741
|
+
// },
|
|
742
|
+
// {
|
|
743
|
+
// $project: {
|
|
744
|
+
// paymentMethodIdentifier: '$object.paymentMethod.typeOf'
|
|
745
|
+
// }
|
|
746
|
+
// },
|
|
747
|
+
// {
|
|
748
|
+
// $unset: ['object.paymentMethod.identifier']
|
|
749
|
+
// }
|
|
750
|
+
// // {
|
|
751
|
+
// // $set: {
|
|
752
|
+
// // 'object.paymentMethod.identifier': '$paymentMethodIdentifier'
|
|
753
|
+
// // }
|
|
754
|
+
// // }
|
|
755
|
+
// ])
|
|
756
|
+
// .exec();
|
|
757
|
+
// }
|
|
707
758
|
findByIdAndDelete(params) {
|
|
708
759
|
return __awaiter(this, void 0, void 0, function* () {
|
|
709
760
|
yield this.transactionModel.findByIdAndDelete(params.id)
|
|
@@ -713,6 +764,7 @@ class MongoRepository {
|
|
|
713
764
|
getCursor(conditions, projection) {
|
|
714
765
|
return this.transactionModel.find(conditions, projection)
|
|
715
766
|
.sort({ startDate: factory.sortType.Ascending })
|
|
767
|
+
// .sort({ startDate: factory.sortType.Descending })
|
|
716
768
|
.cursor();
|
|
717
769
|
}
|
|
718
770
|
aggregateAssetTransaction(params) {
|
|
@@ -0,0 +1,71 @@
|
|
|
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
|
+
import { Schema } from 'mongoose';
|
|
26
|
+
declare const modelName = "AggregateOffer";
|
|
27
|
+
/**
|
|
28
|
+
* 集計オファースキーマ
|
|
29
|
+
*/
|
|
30
|
+
declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
31
|
+
collection: string;
|
|
32
|
+
id: true;
|
|
33
|
+
read: string;
|
|
34
|
+
writeConcern: import("mongodb").WriteConcern;
|
|
35
|
+
strict: true;
|
|
36
|
+
strictQuery: false;
|
|
37
|
+
timestamps: {
|
|
38
|
+
createdAt: string;
|
|
39
|
+
updatedAt: string;
|
|
40
|
+
};
|
|
41
|
+
toJSON: {
|
|
42
|
+
getters: false;
|
|
43
|
+
virtuals: false;
|
|
44
|
+
minimize: false;
|
|
45
|
+
versionKey: false;
|
|
46
|
+
};
|
|
47
|
+
toObject: {
|
|
48
|
+
getters: false;
|
|
49
|
+
virtuals: true;
|
|
50
|
+
minimize: false;
|
|
51
|
+
versionKey: false;
|
|
52
|
+
};
|
|
53
|
+
}, {
|
|
54
|
+
offers: any[];
|
|
55
|
+
_id?: string | undefined;
|
|
56
|
+
typeOf?: string | undefined;
|
|
57
|
+
project?: any;
|
|
58
|
+
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
59
|
+
offers: any[];
|
|
60
|
+
_id?: string | undefined;
|
|
61
|
+
typeOf?: string | undefined;
|
|
62
|
+
project?: any;
|
|
63
|
+
}>> & Omit<import("mongoose").FlatRecord<{
|
|
64
|
+
offers: any[];
|
|
65
|
+
_id?: string | undefined;
|
|
66
|
+
typeOf?: string | undefined;
|
|
67
|
+
project?: any;
|
|
68
|
+
}> & Required<{
|
|
69
|
+
_id: string;
|
|
70
|
+
}>, never>>;
|
|
71
|
+
export { modelName, schema };
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.schema = exports.modelName = void 0;
|
|
4
|
+
const mongoose_1 = require("mongoose");
|
|
5
|
+
const writeConcern_1 = require("../writeConcern");
|
|
6
|
+
const modelName = 'AggregateOffer';
|
|
7
|
+
exports.modelName = modelName;
|
|
8
|
+
/**
|
|
9
|
+
* 集計オファースキーマ
|
|
10
|
+
*/
|
|
11
|
+
const schema = new mongoose_1.Schema({
|
|
12
|
+
project: mongoose_1.SchemaTypes.Mixed,
|
|
13
|
+
_id: String,
|
|
14
|
+
typeOf: String,
|
|
15
|
+
offers: [mongoose_1.SchemaTypes.Mixed]
|
|
16
|
+
}, {
|
|
17
|
+
collection: 'aggregateOffers',
|
|
18
|
+
id: true,
|
|
19
|
+
read: 'primaryPreferred',
|
|
20
|
+
writeConcern: writeConcern_1.writeConcern,
|
|
21
|
+
strict: true,
|
|
22
|
+
strictQuery: false,
|
|
23
|
+
timestamps: {
|
|
24
|
+
createdAt: 'createdAt',
|
|
25
|
+
updatedAt: 'updatedAt'
|
|
26
|
+
},
|
|
27
|
+
toJSON: {
|
|
28
|
+
getters: false,
|
|
29
|
+
virtuals: false,
|
|
30
|
+
minimize: false,
|
|
31
|
+
versionKey: false
|
|
32
|
+
},
|
|
33
|
+
toObject: {
|
|
34
|
+
getters: false,
|
|
35
|
+
virtuals: true,
|
|
36
|
+
minimize: false,
|
|
37
|
+
versionKey: false
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
exports.schema = schema;
|
|
41
|
+
schema.index({ createdAt: 1 }, { name: 'searchByCreatedAt' });
|
|
42
|
+
schema.index({ updatedAt: 1 }, { name: 'searchByUpdatedAt' });
|
|
43
|
+
schema.index({ 'offers.priceSpecification.price': 1 }, { name: 'searchByOffersPriceSpecificationPrice' });
|
|
44
|
+
schema.index({ 'project.id': 1, 'offers.priceSpecification.price': 1 }, { name: 'searchByProjectId' });
|
|
45
|
+
// オファーIDはグローバルユニーク
|
|
46
|
+
schema.index({ 'offers.id': 1 }, {
|
|
47
|
+
name: 'uniqueOfferId',
|
|
48
|
+
unique: true
|
|
49
|
+
});
|
|
50
|
+
// オファーコードはプロジェクト内ユニーク
|
|
51
|
+
schema.index({ 'offers.identifier': 1, 'project.id': 1 }, {
|
|
52
|
+
name: 'uniqueOfferIdentifier',
|
|
53
|
+
unique: true
|
|
54
|
+
});
|
|
55
|
+
schema.index({ 'offers.availability': 1, 'offers.priceSpecification.price': 1 }, { name: 'searchByOffersAvailability' });
|
|
56
|
+
schema.index({ 'offers.itemOffered.typeOf': 1, 'offers.priceSpecification.price': 1 }, { name: 'searchByOffersItemOfferedTypeOf' });
|
|
57
|
+
schema.index({ 'offers.identifier': 1, 'offers.priceSpecification.price': 1 }, {
|
|
58
|
+
name: 'searchByOffersIdentifier',
|
|
59
|
+
partialFilterExpression: {
|
|
60
|
+
'offers.identifier': { $exists: true }
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
schema.index({ 'offers.priceSpecification.referenceQuantity.value': 1, 'offers.priceSpecification.price': 1 }, {
|
|
64
|
+
name: 'searchByOffersPriceSpecificationReferenceQuantityValue',
|
|
65
|
+
partialFilterExpression: {
|
|
66
|
+
'offers.priceSpecification.referenceQuantity.value': { $exists: true }
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
schema.index({ 'offers.priceSpecification.accounting.accountsReceivable': 1, 'offers.priceSpecification.price': 1 }, {
|
|
70
|
+
name: 'searchByOffersPriceSpecificationAccountingAccountsReceivable',
|
|
71
|
+
partialFilterExpression: {
|
|
72
|
+
'offers.priceSpecification.accounting.accountsReceivable': { $exists: true }
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
schema.index({ 'offers.priceSpecification.accounting.operatingRevenue.codeValue': 1, 'offers.priceSpecification.price': 1 }, {
|
|
76
|
+
name: 'searchByOffersPriceSpecificationAccountingOperatingRevenueCodeValue',
|
|
77
|
+
partialFilterExpression: {
|
|
78
|
+
'offers.priceSpecification.accounting.operatingRevenue.codeValue': { $exists: true }
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
schema.index({ 'offers.priceSpecification.appliesToMovieTicket.serviceType': 1, 'offers.priceSpecification.price': 1 }, {
|
|
82
|
+
name: 'searchByOffersPriceSpecificationAppliesToMovieTicketServiceType',
|
|
83
|
+
partialFilterExpression: {
|
|
84
|
+
'offers.priceSpecification.appliesToMovieTicket.serviceType': { $exists: true }
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
schema.index({ 'offers.priceSpecification.appliesToMovieTicket.serviceOutput.typeOf': 1, 'offers.priceSpecification.price': 1 }, {
|
|
88
|
+
name: 'searchByOffersPriceSpecificationAppliesToMovieTicketServiceOutputTypeOf',
|
|
89
|
+
partialFilterExpression: {
|
|
90
|
+
'offers.priceSpecification.appliesToMovieTicket.serviceOutput.typeOf': { $exists: true }
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
schema.index({ 'offers.name.ja': 1, 'offers.priceSpecification.price': 1 }, {
|
|
94
|
+
name: 'searchByOffersNameJa',
|
|
95
|
+
partialFilterExpression: {
|
|
96
|
+
'offers.name.ja': { $exists: true }
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
schema.index({ 'offers.name.en': 1, 'offers.priceSpecification.price': 1 }, {
|
|
100
|
+
name: 'searchByOffersNameEn',
|
|
101
|
+
partialFilterExpression: {
|
|
102
|
+
'offers.name.en': { $exists: true }
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
schema.index({ 'offers.alternateName': 1, 'offers.priceSpecification.price': 1 }, {
|
|
106
|
+
name: 'searchByOffersAlternateName',
|
|
107
|
+
partialFilterExpression: {
|
|
108
|
+
'offers.alternateName': { $exists: true }
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
schema.index({ 'offers.category.id': 1, 'offers.priceSpecification.price': 1 }, {
|
|
112
|
+
name: 'searchOffersCategoryId',
|
|
113
|
+
partialFilterExpression: {
|
|
114
|
+
'offers.category.id': { $exists: true }
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
schema.index({ 'offers.category.codeValue': 1, 'offers.priceSpecification.price': 1 }, {
|
|
118
|
+
name: 'searchByOffersCategoryCodeValue',
|
|
119
|
+
partialFilterExpression: {
|
|
120
|
+
'offers.category.codeValue': { $exists: true }
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
schema.index({ 'offers.availableAtOrFrom.id': 1, 'offers.priceSpecification.price': 1 }, {
|
|
124
|
+
name: 'searchByOffersAvailableAtOrFromId',
|
|
125
|
+
partialFilterExpression: {
|
|
126
|
+
'offers.availableAtOrFrom.id': { $exists: true }
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
schema.index({ 'offers.eligibleMembershipType.codeValue': 1, 'offers.priceSpecification.price': 1 }, {
|
|
130
|
+
name: 'searchByOffersEligibleMembershipTypeCodeValue',
|
|
131
|
+
partialFilterExpression: {
|
|
132
|
+
'offers.eligibleMembershipType.codeValue': { $exists: true }
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
schema.index({ 'offers.eligibleMonetaryAmount.currency': 1, 'offers.priceSpecification.price': 1 }, {
|
|
136
|
+
name: 'searchByOffersEligibleMonetaryAmountCurrency',
|
|
137
|
+
partialFilterExpression: {
|
|
138
|
+
'offers.eligibleMonetaryAmount.currency': { $exists: true }
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
schema.index({ 'offers.eligibleSeatingType.codeValue': 1, 'offers.priceSpecification.price': 1 }, {
|
|
142
|
+
name: 'searchByOffersEligibleSeatingTypeCodeValue',
|
|
143
|
+
partialFilterExpression: {
|
|
144
|
+
'offers.eligibleSeatingType.codeValue': { $exists: true }
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
schema.index({ 'offers.addOn.itemOffered.id': 1, 'offers.priceSpecification.price': 1 }, {
|
|
148
|
+
name: 'searchByOffersAddOnItemOfferedId',
|
|
149
|
+
partialFilterExpression: {
|
|
150
|
+
'offers.addOn.itemOffered.id': { $exists: true }
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
schema.index({ 'offers.hasMerchantReturnPolicy.id': 1, 'offers.priceSpecification.price': 1 }, {
|
|
154
|
+
name: 'searchByOffersHasMerchantReturnPolicyId',
|
|
155
|
+
partialFilterExpression: {
|
|
156
|
+
'offers.hasMerchantReturnPolicy.id': { $exists: true }
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
schema.index({ 'offers.additionalProperty': 1, 'offers.priceSpecification.price': 1 }, {
|
|
160
|
+
name: 'searchByOffersAdditionalProperty',
|
|
161
|
+
partialFilterExpression: {
|
|
162
|
+
'offers.additionalProperty': { $exists: true }
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
schema.index({ 'offers.validFrom': 1, 'offers.priceSpecification.price': 1 }, {
|
|
166
|
+
name: 'searchByOffersValidFrom',
|
|
167
|
+
partialFilterExpression: {
|
|
168
|
+
'offers.validFrom': { $exists: true }
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
schema.index({ 'offers.validThrough': 1, 'offers.priceSpecification.price': 1 }, {
|
|
172
|
+
name: 'searchByOffersValidThrough',
|
|
173
|
+
partialFilterExpression: {
|
|
174
|
+
'offers.validThrough': { $exists: true }
|
|
175
|
+
}
|
|
176
|
+
});
|
|
@@ -29,6 +29,7 @@ const schema = new mongoose_1.Schema({
|
|
|
29
29
|
availableAtOrFrom: [mongoose_1.SchemaTypes.Mixed],
|
|
30
30
|
hasMerchantReturnPolicy: mongoose_1.SchemaTypes.Mixed,
|
|
31
31
|
itemOffered: mongoose_1.SchemaTypes.Mixed,
|
|
32
|
+
// offers: [SchemaTypes.Mixed],
|
|
32
33
|
priceCurrency: String,
|
|
33
34
|
priceSpecification: mongoose_1.SchemaTypes.Mixed,
|
|
34
35
|
eligibleCustomerType: mongoose_1.SchemaTypes.Mixed,
|
|
@@ -72,6 +72,7 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
|
|
|
72
72
|
customer?: any;
|
|
73
73
|
returner?: any;
|
|
74
74
|
orderStatus?: string | undefined;
|
|
75
|
+
previousOrderStatus?: string | undefined;
|
|
75
76
|
isGift?: boolean | undefined;
|
|
76
77
|
dateReturned?: Date | undefined;
|
|
77
78
|
}, import("mongoose").Document<unknown, {}, import("mongoose").FlatRecord<{
|
|
@@ -95,6 +96,7 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
|
|
|
95
96
|
customer?: any;
|
|
96
97
|
returner?: any;
|
|
97
98
|
orderStatus?: string | undefined;
|
|
99
|
+
previousOrderStatus?: string | undefined;
|
|
98
100
|
isGift?: boolean | undefined;
|
|
99
101
|
dateReturned?: Date | undefined;
|
|
100
102
|
}>> & Omit<import("mongoose").FlatRecord<{
|
|
@@ -118,6 +120,7 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
|
|
|
118
120
|
customer?: any;
|
|
119
121
|
returner?: any;
|
|
120
122
|
orderStatus?: string | undefined;
|
|
123
|
+
previousOrderStatus?: string | undefined;
|
|
121
124
|
isGift?: boolean | undefined;
|
|
122
125
|
dateReturned?: Date | undefined;
|
|
123
126
|
}> & {
|
|
@@ -57,6 +57,7 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
|
|
|
57
57
|
status?: string | undefined;
|
|
58
58
|
data?: any;
|
|
59
59
|
project?: any;
|
|
60
|
+
identifier?: string | undefined;
|
|
60
61
|
runsAt?: Date | undefined;
|
|
61
62
|
remainingNumberOfTries?: number | undefined;
|
|
62
63
|
lastTriedAt?: Date | undefined;
|
|
@@ -69,6 +70,7 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
|
|
|
69
70
|
status?: string | undefined;
|
|
70
71
|
data?: any;
|
|
71
72
|
project?: any;
|
|
73
|
+
identifier?: string | undefined;
|
|
72
74
|
runsAt?: Date | undefined;
|
|
73
75
|
remainingNumberOfTries?: number | undefined;
|
|
74
76
|
lastTriedAt?: Date | undefined;
|
|
@@ -81,6 +83,7 @@ declare const schema: Schema<any, import("mongoose").Model<any, any, any, any, a
|
|
|
81
83
|
status?: string | undefined;
|
|
82
84
|
data?: any;
|
|
83
85
|
project?: any;
|
|
86
|
+
identifier?: string | undefined;
|
|
84
87
|
runsAt?: Date | undefined;
|
|
85
88
|
remainingNumberOfTries?: number | undefined;
|
|
86
89
|
lastTriedAt?: Date | undefined;
|
|
@@ -9,6 +9,7 @@ exports.modelName = modelName;
|
|
|
9
9
|
* タスクスキーマ
|
|
10
10
|
*/
|
|
11
11
|
const schema = new mongoose_1.Schema({
|
|
12
|
+
identifier: String,
|
|
12
13
|
project: mongoose_1.SchemaTypes.Mixed,
|
|
13
14
|
name: String,
|
|
14
15
|
status: String,
|
|
@@ -52,6 +53,13 @@ schema.index({ 'project.id': 1, runsAt: -1 }, { name: 'searchByProjectId-v202207
|
|
|
52
53
|
schema.index({ name: 1, runsAt: -1 }, { name: 'searchByName-v2' });
|
|
53
54
|
schema.index({ status: 1, runsAt: -1 }, { name: 'searchByStatus-v2' });
|
|
54
55
|
schema.index({ runsAt: -1 }, { name: 'searchByRunsAt-v2' });
|
|
56
|
+
// identifier追加(2023-09-01~)
|
|
57
|
+
schema.index({ identifier: 1, runsAt: -1 }, {
|
|
58
|
+
name: 'searchByIdentifier',
|
|
59
|
+
partialFilterExpression: {
|
|
60
|
+
identifier: { $exists: true }
|
|
61
|
+
}
|
|
62
|
+
});
|
|
55
63
|
schema.index({ dateAborted: 1, runsAt: -1 }, {
|
|
56
64
|
name: 'searchByDateAborted',
|
|
57
65
|
partialFilterExpression: {
|
|
@@ -22,19 +22,28 @@
|
|
|
22
22
|
/// <reference types="mongoose/types/validation" />
|
|
23
23
|
/// <reference types="mongoose/types/virtuals" />
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
|
-
import {
|
|
25
|
+
import { BulkWriteResult as BulkWriteOpResultObject } from 'mongodb';
|
|
26
|
+
import { AnyExpression, Connection, PipelineStage } from 'mongoose';
|
|
26
27
|
import * as factory from '../factory';
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
type IMatchStage = PipelineStage.Match;
|
|
29
|
+
type KeyOfUnitPriceOffer = keyof factory.unitPriceOffer.IUnitPriceOffer;
|
|
30
|
+
type IProjection = {
|
|
31
|
+
[key in KeyOfUnitPriceOffer]?: 0 | 1;
|
|
32
|
+
};
|
|
30
33
|
/**
|
|
31
34
|
* オファーリポジトリ
|
|
32
35
|
*/
|
|
33
36
|
export declare class MongoRepository {
|
|
37
|
+
private readonly aggregateOfferModel;
|
|
34
38
|
private readonly offerModel;
|
|
35
39
|
private readonly offerCatalogModel;
|
|
40
|
+
private readonly taskModel;
|
|
36
41
|
constructor(connection: Connection);
|
|
37
42
|
static CREATE_OFFER_MONGO_CONDITIONS(params: factory.unitPriceOffer.ISearchConditions): any[];
|
|
43
|
+
static CREATE_AGGREGATE_OFFERS_MATCH_CONDITIONS(params: factory.unitPriceOffer.ISearchConditions): IMatchStage[];
|
|
44
|
+
static CREATE_AGGREGATE_OFFERS_PROJECTION(params: IProjection): {
|
|
45
|
+
[field: string]: AnyExpression;
|
|
46
|
+
};
|
|
38
47
|
/**
|
|
39
48
|
* カタログに含まれるオファーを検索する
|
|
40
49
|
* カタログに登録されたオファーの順序は保証される
|
|
@@ -55,18 +64,37 @@ export declare class MongoRepository {
|
|
|
55
64
|
onlyValid?: boolean;
|
|
56
65
|
limit?: number;
|
|
57
66
|
page?: number;
|
|
58
|
-
sort: boolean;
|
|
59
67
|
projection?: IProjection;
|
|
68
|
+
/**
|
|
69
|
+
* 強制的にoffersコレクションを使用する
|
|
70
|
+
*/
|
|
71
|
+
useOffersAsPrimary?: boolean;
|
|
60
72
|
}): Promise<{
|
|
61
73
|
offers: factory.unitPriceOffer.IUnitPriceOffer[];
|
|
62
74
|
sortedOfferIds: string[];
|
|
63
75
|
}>;
|
|
64
76
|
findById(params: {
|
|
77
|
+
project: {
|
|
78
|
+
id: string;
|
|
79
|
+
};
|
|
65
80
|
id: string;
|
|
66
81
|
}): Promise<factory.unitPriceOffer.IUnitPriceOffer>;
|
|
67
|
-
|
|
68
|
-
|
|
82
|
+
findAggregateOfferById(params: {
|
|
83
|
+
project: {
|
|
84
|
+
id: string;
|
|
85
|
+
};
|
|
86
|
+
id: string;
|
|
87
|
+
}): Promise<factory.aggregateOffer.IAggregateOffer>;
|
|
88
|
+
count(params: Omit<factory.unitPriceOffer.ISearchConditions, 'limit' | 'page' | 'sort'>): Promise<number>;
|
|
89
|
+
search(params: factory.unitPriceOffer.ISearchConditions, projection?: IProjection,
|
|
90
|
+
/**
|
|
91
|
+
* 強制的にoffersコレクションを使用する
|
|
92
|
+
*/
|
|
93
|
+
useOffersAsPrimary?: boolean): Promise<factory.unitPriceOffer.IUnitPriceOffer[]>;
|
|
69
94
|
save(params: factory.unitPriceOffer.IUnitPriceOffer): Promise<factory.unitPriceOffer.IUnitPriceOffer>;
|
|
95
|
+
/**
|
|
96
|
+
* sskts専用オファー保管
|
|
97
|
+
*/
|
|
70
98
|
saveManyByIdentifier(params: {
|
|
71
99
|
attributes: factory.unitPriceOffer.IUnitPriceOffer;
|
|
72
100
|
upsert?: boolean;
|
|
@@ -87,17 +115,46 @@ export declare class MongoRepository {
|
|
|
87
115
|
};
|
|
88
116
|
}): Promise<import("mongodb").UpdateResult | undefined>;
|
|
89
117
|
deleteById(params: {
|
|
90
|
-
id: string;
|
|
91
|
-
}): Promise<void>;
|
|
92
|
-
deleteByProject(params: {
|
|
93
118
|
project: {
|
|
94
119
|
id: string;
|
|
95
120
|
};
|
|
121
|
+
id: string;
|
|
96
122
|
}): Promise<void>;
|
|
97
123
|
getCursor(conditions: any, projection: any): import("mongoose").Cursor<any, import("mongoose").QueryOptions<any>>;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
124
|
+
sync2aggregateOffer(params: {
|
|
125
|
+
id?: {
|
|
126
|
+
$in: string[];
|
|
127
|
+
};
|
|
128
|
+
identifier?: {
|
|
129
|
+
$in: string[];
|
|
130
|
+
};
|
|
131
|
+
project: {
|
|
132
|
+
id: string;
|
|
133
|
+
};
|
|
134
|
+
isDeleted: boolean;
|
|
135
|
+
typeOf: factory.offerType.AggregateOffer | factory.offerType.Offer;
|
|
136
|
+
}): Promise<BulkWriteOpResultObject | void>;
|
|
137
|
+
/**
|
|
138
|
+
* オファー同期専用のタスク保管
|
|
139
|
+
*/
|
|
140
|
+
saveSyncTask(params: {
|
|
141
|
+
id: {
|
|
142
|
+
$in: string[];
|
|
143
|
+
};
|
|
144
|
+
identifier: {
|
|
145
|
+
$in: string[];
|
|
146
|
+
};
|
|
147
|
+
isDeleted: boolean;
|
|
148
|
+
project: {
|
|
149
|
+
id: string;
|
|
150
|
+
};
|
|
151
|
+
typeOf: factory.offerType.AggregateOffer | factory.offerType.Offer;
|
|
152
|
+
options: {
|
|
153
|
+
emitImmediately: boolean;
|
|
154
|
+
};
|
|
155
|
+
}): Promise<{
|
|
156
|
+
id: string;
|
|
157
|
+
}[]>;
|
|
158
|
+
private searchFromAggregateOffer;
|
|
102
159
|
}
|
|
103
160
|
export {};
|