@chevre/domain 21.8.0-alpha.9 → 21.8.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/countOffers.ts +32 -0
- package/example/src/chevre/findItemListElementByCatalogId.ts +30 -0
- package/example/src/chevre/importOffersFromCOA.ts +7 -1
- 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/optimizeCatalogs.ts +54 -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/pushIncludedInDataCatalog.ts +47 -0
- package/example/src/chevre/searchAggregateOffers.ts +48 -0
- package/example/src/chevre/searchEventTicketOffers.ts +5 -1
- package/example/src/chevre/searchEvents.ts +9 -7
- package/example/src/chevre/searchOfferCatalogs.ts +7 -3
- package/example/src/chevre/searchOffers.ts +5 -2
- package/example/src/chevre/searchOffersByCatalog.ts +15 -9
- package/example/src/chevre/searchOffersFromAggregateOffer.ts +168 -0
- package/example/src/chevre/searchOrders.ts +9 -7
- package/example/src/chevre/syncCatalogs2aggregateOffers.ts +85 -0
- package/lib/chevre/emailMessageBuilder.js +6 -5
- package/lib/chevre/repo/aggregateOffer.d.ts +62 -0
- package/lib/chevre/repo/aggregateOffer.js +562 -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 +74 -0
- package/lib/chevre/repo/mongoose/schemas/aggregateOffer.js +189 -0
- package/lib/chevre/repo/mongoose/schemas/authorization.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/creativeWork.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/event.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.d.ts +3 -0
- package/lib/chevre/repo/mongoose/schemas/offerCatalog.js +10 -1
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +3 -0
- package/lib/chevre/repo/mongoose/schemas/order.js +7 -0
- package/lib/chevre/repo/mongoose/schemas/priceSpecification.d.ts +9 -9
- package/lib/chevre/repo/mongoose/schemas/product.d.ts +3 -3
- package/lib/chevre/repo/mongoose/schemas/project.d.ts +3 -3
- 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 +87 -51
- package/lib/chevre/repo/offer.js +513 -283
- package/lib/chevre/repo/offerCatalog.d.ts +32 -3
- package/lib/chevre/repo/offerCatalog.js +97 -10
- package/lib/chevre/repo/order.d.ts +15 -0
- package/lib/chevre/repo/order.js +58 -26
- package/lib/chevre/repo/task.d.ts +6 -2
- package/lib/chevre/repo/task.js +58 -4
- package/lib/chevre/repository.d.ts +3 -0
- package/lib/chevre/repository.js +5 -1
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +3 -41
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.d.ts +2 -0
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +2 -40
- package/lib/chevre/service/aggregation/event/findEventOffers.d.ts +16 -0
- package/lib/chevre/service/aggregation/event/findEventOffers.js +58 -0
- 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/registerService.js +2 -1
- package/lib/chevre/service/assetTransaction/reserve.js +111 -35
- package/lib/chevre/service/offer/event/authorize.js +39 -35
- package/lib/chevre/service/offer/event/factory.d.ts +1 -1
- 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.d.ts +3 -0
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +48 -17
- package/lib/chevre/service/offer/event/voidTransaction.js +57 -36
- package/lib/chevre/service/offer/eventServiceByCOA/factory.d.ts +2 -1
- package/lib/chevre/service/offer/eventServiceByCOA/factory.js +7 -11
- package/lib/chevre/service/offer/eventServiceByCOA.js +55 -27
- package/lib/chevre/service/offer/factory.d.ts +12 -4
- package/lib/chevre/service/offer/factory.js +9 -11
- package/lib/chevre/service/offer/product/searchProductOffers.d.ts +10 -1
- package/lib/chevre/service/offer/product/searchProductOffers.js +51 -12
- package/lib/chevre/service/offer/product.d.ts +2 -0
- package/lib/chevre/service/offer/product.js +3 -2
- package/lib/chevre/service/offer.d.ts +1 -0
- package/lib/chevre/service/offer.js +7 -1
- package/lib/chevre/service/order/confirmPayTransaction.d.ts +0 -2
- package/lib/chevre/service/order/confirmPayTransaction.js +20 -46
- 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 +49 -9
- package/lib/chevre/service/order/payOrder.js +4 -45
- package/lib/chevre/service/order/placeOrder.js +11 -24
- 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/checkInReservation.d.ts +8 -0
- package/lib/chevre/service/reserve/checkInReservation.js +3 -2
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +3 -0
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +4 -5
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.d.ts +8 -0
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +16 -11
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +2 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.d.ts +3 -0
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +3 -5
- package/lib/chevre/service/task/aggregateUseActionsOnEvent.js +2 -0
- 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/onAuthorizationCreated.js +5 -1
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.d.ts +2 -0
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +7 -0
- package/lib/chevre/service/task/onResourceUpdated/syncOfferCatalog.d.ts +17 -0
- package/lib/chevre/service/task/onResourceUpdated/syncOfferCatalog.js +78 -0
- package/lib/chevre/service/task/onResourceUpdated.js +12 -0
- package/lib/chevre/service/task/returnPayTransaction.js +8 -3
- 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 +3 -3
- package/lib/chevre/settings.js +4 -12
- package/package.json +3 -3
- package/example/src/chevre/migrateAuthorizePaymentActionResult.ts +0 -83
- package/example/src/chevre/migrateEventOrganizer.ts +0 -154
- package/lib/chevre/repo/mongoose/schemas/offer.d.ts +0 -149
- package/lib/chevre/repo/mongoose/schemas/offer.js +0 -210
|
@@ -24,6 +24,10 @@
|
|
|
24
24
|
/// <reference types="mongoose/types/inferschematype" />
|
|
25
25
|
import { Connection } from 'mongoose';
|
|
26
26
|
import * as factory from '../factory';
|
|
27
|
+
export type IAggregatedOfferCatalog = Pick<factory.offerCatalog.IOfferCatalog, 'id' | 'name' | 'description' | 'project' | 'typeOf' | 'identifier' | 'itemOffered' | 'additionalProperty'> & {
|
|
28
|
+
numberOfItems?: number;
|
|
29
|
+
itemListElementTypeOf: factory.offerType.Offer | 'OfferCatalog';
|
|
30
|
+
};
|
|
27
31
|
/**
|
|
28
32
|
* オファーカタログリポジトリ
|
|
29
33
|
*/
|
|
@@ -32,6 +36,17 @@ export declare class MongoRepository {
|
|
|
32
36
|
constructor(connection: Connection);
|
|
33
37
|
static CREATE_MONGO_CONDITIONS(params: factory.offerCatalog.ISearchConditions): any[];
|
|
34
38
|
save(params: factory.offerCatalog.IOfferCatalog): Promise<factory.offerCatalog.IOfferCatalog>;
|
|
39
|
+
/**
|
|
40
|
+
* 同期日時を更新する
|
|
41
|
+
*/
|
|
42
|
+
updateDateSynced(params: {
|
|
43
|
+
id: string;
|
|
44
|
+
dateSynced: Date;
|
|
45
|
+
}): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* 型を統一する
|
|
48
|
+
*/
|
|
49
|
+
optimizeAll(): Promise<void>;
|
|
35
50
|
updateManyById(params: {
|
|
36
51
|
id: {
|
|
37
52
|
$in: string[];
|
|
@@ -66,9 +81,23 @@ export declare class MongoRepository {
|
|
|
66
81
|
};
|
|
67
82
|
};
|
|
68
83
|
}): Promise<import("mongodb").UpdateResult | undefined>;
|
|
69
|
-
search(params: factory.offerCatalog.ISearchConditions): Promise<
|
|
70
|
-
|
|
71
|
-
|
|
84
|
+
search(params: factory.offerCatalog.ISearchConditions): Promise<IAggregatedOfferCatalog[]>;
|
|
85
|
+
/**
|
|
86
|
+
* 強制的に親カタログのみ検索する
|
|
87
|
+
*/
|
|
88
|
+
searchParentCatalogsForcibly(params: factory.offerCatalog.ISearchConditions): Promise<IAggregatedOfferCatalog[]>;
|
|
89
|
+
findItemListElementById(params: {
|
|
90
|
+
id: string;
|
|
91
|
+
project: {
|
|
92
|
+
id: string;
|
|
93
|
+
};
|
|
94
|
+
}): Promise<Pick<factory.offerCatalog.IOfferCatalog, 'itemListElement'>>;
|
|
95
|
+
/**
|
|
96
|
+
* 一つ目のitemListElementを取得する
|
|
97
|
+
*/
|
|
98
|
+
findFirstItemListElementById(params: {
|
|
99
|
+
id: string;
|
|
100
|
+
}): Promise<factory.offerCatalog.IItemListElement>;
|
|
72
101
|
deleteById(params: {
|
|
73
102
|
id: string;
|
|
74
103
|
}): Promise<void>;
|
|
@@ -33,7 +33,7 @@ class MongoRepository {
|
|
|
33
33
|
}
|
|
34
34
|
// tslint:disable-next-line:max-func-body-length
|
|
35
35
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
36
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
36
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
37
37
|
// MongoDB検索条件
|
|
38
38
|
const andConditions = [];
|
|
39
39
|
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
@@ -70,7 +70,11 @@ class MongoRepository {
|
|
|
70
70
|
]
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
-
const
|
|
73
|
+
const itemListElementTypeOfEq = (_h = (_g = params.itemListElement) === null || _g === void 0 ? void 0 : _g.typeOf) === null || _h === void 0 ? void 0 : _h.$eq;
|
|
74
|
+
if (typeof itemListElementTypeOfEq === 'string') {
|
|
75
|
+
andConditions.push({ 'itemListElement.typeOf': { $exists: true, $eq: itemListElementTypeOfEq } });
|
|
76
|
+
}
|
|
77
|
+
const itemListElementIdIn = (_k = (_j = params.itemListElement) === null || _j === void 0 ? void 0 : _j.id) === null || _k === void 0 ? void 0 : _k.$in;
|
|
74
78
|
if (Array.isArray(itemListElementIdIn)) {
|
|
75
79
|
andConditions.push({
|
|
76
80
|
'itemListElement.id': {
|
|
@@ -79,7 +83,7 @@ class MongoRepository {
|
|
|
79
83
|
}
|
|
80
84
|
});
|
|
81
85
|
}
|
|
82
|
-
const itemListElementIdNin = (
|
|
86
|
+
const itemListElementIdNin = (_m = (_l = params.itemListElement) === null || _l === void 0 ? void 0 : _l.id) === null || _m === void 0 ? void 0 : _m.$nin;
|
|
83
87
|
if (Array.isArray(itemListElementIdNin)) {
|
|
84
88
|
andConditions.push({
|
|
85
89
|
'itemListElement.id': {
|
|
@@ -87,7 +91,7 @@ class MongoRepository {
|
|
|
87
91
|
}
|
|
88
92
|
});
|
|
89
93
|
}
|
|
90
|
-
const itemListElementIdAll = (
|
|
94
|
+
const itemListElementIdAll = (_p = (_o = params.itemListElement) === null || _o === void 0 ? void 0 : _o.id) === null || _p === void 0 ? void 0 : _p.$all;
|
|
91
95
|
if (Array.isArray(itemListElementIdAll)) {
|
|
92
96
|
andConditions.push({
|
|
93
97
|
'itemListElement.id': {
|
|
@@ -96,7 +100,7 @@ class MongoRepository {
|
|
|
96
100
|
}
|
|
97
101
|
});
|
|
98
102
|
}
|
|
99
|
-
const itemOfferedTypeOfEq = (
|
|
103
|
+
const itemOfferedTypeOfEq = (_r = (_q = params.itemOffered) === null || _q === void 0 ? void 0 : _q.typeOf) === null || _r === void 0 ? void 0 : _r.$eq;
|
|
100
104
|
if (typeof itemOfferedTypeOfEq === 'string') {
|
|
101
105
|
andConditions.push({
|
|
102
106
|
'itemOffered.typeOf': {
|
|
@@ -105,7 +109,7 @@ class MongoRepository {
|
|
|
105
109
|
}
|
|
106
110
|
});
|
|
107
111
|
}
|
|
108
|
-
const itemOfferedServiceTypeCodeValueEq = (
|
|
112
|
+
const itemOfferedServiceTypeCodeValueEq = (_u = (_t = (_s = params.itemOffered) === null || _s === void 0 ? void 0 : _s.serviceType) === null || _t === void 0 ? void 0 : _t.codeValue) === null || _u === void 0 ? void 0 : _u.$eq;
|
|
109
113
|
if (typeof itemOfferedServiceTypeCodeValueEq === 'string') {
|
|
110
114
|
andConditions.push({
|
|
111
115
|
'itemOffered.serviceType.codeValue': {
|
|
@@ -114,7 +118,7 @@ class MongoRepository {
|
|
|
114
118
|
}
|
|
115
119
|
});
|
|
116
120
|
}
|
|
117
|
-
const additionalPropertyElemMatch = (
|
|
121
|
+
const additionalPropertyElemMatch = (_v = params.additionalProperty) === null || _v === void 0 ? void 0 : _v.$elemMatch;
|
|
118
122
|
if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
119
123
|
andConditions.push({
|
|
120
124
|
additionalProperty: {
|
|
@@ -144,6 +148,44 @@ class MongoRepository {
|
|
|
144
148
|
return doc.toObject();
|
|
145
149
|
});
|
|
146
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* 同期日時を更新する
|
|
153
|
+
*/
|
|
154
|
+
updateDateSynced(params) {
|
|
155
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
156
|
+
yield this.offerCatalogModel.updateOne({ _id: params.id }, { $set: { dateSynced: params.dateSynced } })
|
|
157
|
+
.exec();
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* 型を統一する
|
|
162
|
+
*/
|
|
163
|
+
optimizeAll() {
|
|
164
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
165
|
+
let result = yield this.offerCatalogModel.updateMany({ typeOf: { $ne: 'OfferCatalog' } }, { $set: { typeOf: 'OfferCatalog' } })
|
|
166
|
+
.exec();
|
|
167
|
+
// tslint:disable-next-line:no-console
|
|
168
|
+
console.log(result);
|
|
169
|
+
result = yield this.offerCatalogModel.updateMany({ ticketTypes: { $exists: true } }, {
|
|
170
|
+
$unset: { ticketTypes: 1 }
|
|
171
|
+
})
|
|
172
|
+
.exec();
|
|
173
|
+
// tslint:disable-next-line:no-console
|
|
174
|
+
console.log(result);
|
|
175
|
+
result = yield this.offerCatalogModel.updateMany({ id: { $exists: true } }, {
|
|
176
|
+
$unset: { id: 1 }
|
|
177
|
+
})
|
|
178
|
+
.exec();
|
|
179
|
+
// tslint:disable-next-line:no-console
|
|
180
|
+
console.log(result);
|
|
181
|
+
result = yield this.offerCatalogModel.updateMany({ 'itemOffered.serviceType': { $exists: true } }, {
|
|
182
|
+
$unset: { 'itemOffered.serviceType': 1 }
|
|
183
|
+
})
|
|
184
|
+
.exec();
|
|
185
|
+
// tslint:disable-next-line:no-console
|
|
186
|
+
console.log(result);
|
|
187
|
+
});
|
|
188
|
+
}
|
|
147
189
|
updateManyById(params) {
|
|
148
190
|
return __awaiter(this, void 0, void 0, function* () {
|
|
149
191
|
if (!Array.isArray(params.id.$in) || params.id.$in.length === 0) {
|
|
@@ -206,7 +248,6 @@ class MongoRepository {
|
|
|
206
248
|
const matchStages = conditions.map((condition) => {
|
|
207
249
|
return { $match: condition };
|
|
208
250
|
});
|
|
209
|
-
// numberOfItems集計(2023-02-28~)
|
|
210
251
|
const aggregate = this.offerCatalogModel.aggregate([
|
|
211
252
|
...(((_a = params.sort) === null || _a === void 0 ? void 0 : _a.identifier) !== undefined) ? [{ $sort: { identifier: params.sort.identifier } }] : [],
|
|
212
253
|
...matchStages,
|
|
@@ -219,7 +260,6 @@ class MongoRepository {
|
|
|
219
260
|
typeOf: '$typeOf',
|
|
220
261
|
id: '$_id',
|
|
221
262
|
identifier: '$identifier',
|
|
222
|
-
// itemListElement: '$itemListElement',
|
|
223
263
|
itemOffered: '$itemOffered',
|
|
224
264
|
additionalProperty: '$additionalProperty',
|
|
225
265
|
numberOfItems: {
|
|
@@ -228,7 +268,9 @@ class MongoRepository {
|
|
|
228
268
|
then: { $size: '$itemListElement' },
|
|
229
269
|
else: 0
|
|
230
270
|
}
|
|
231
|
-
}
|
|
271
|
+
},
|
|
272
|
+
// itemListElement.typeOfを追加(2023-09-14~)
|
|
273
|
+
itemListElementTypeOf: { $first: '$itemListElement.typeOf' }
|
|
232
274
|
}
|
|
233
275
|
}
|
|
234
276
|
]);
|
|
@@ -240,6 +282,51 @@ class MongoRepository {
|
|
|
240
282
|
return aggregate.exec();
|
|
241
283
|
});
|
|
242
284
|
}
|
|
285
|
+
/**
|
|
286
|
+
* 強制的に親カタログのみ検索する
|
|
287
|
+
*/
|
|
288
|
+
searchParentCatalogsForcibly(params) {
|
|
289
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
290
|
+
return this.search(Object.assign(Object.assign({}, params), { itemListElement: Object.assign(Object.assign({}, params.itemListElement), { typeOf: { $eq: factory.offerType.Offer } }) }));
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
findItemListElementById(params) {
|
|
294
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
295
|
+
const doc = yield this.offerCatalogModel.findOne({
|
|
296
|
+
'project.id': { $eq: params.project.id },
|
|
297
|
+
_id: { $eq: params.id }
|
|
298
|
+
}, { 'itemListElement.id': 1 })
|
|
299
|
+
.exec();
|
|
300
|
+
if (doc === null) {
|
|
301
|
+
throw new factory.errors.NotFound(this.offerCatalogModel.modelName);
|
|
302
|
+
}
|
|
303
|
+
return doc.toObject();
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* 一つ目のitemListElementを取得する
|
|
308
|
+
*/
|
|
309
|
+
findFirstItemListElementById(params) {
|
|
310
|
+
var _a;
|
|
311
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
312
|
+
const aggregate = this.offerCatalogModel.aggregate([
|
|
313
|
+
{
|
|
314
|
+
$match: { _id: { $eq: params.id } }
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
$project: {
|
|
318
|
+
firstElement: { $first: '$itemListElement' }
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
]);
|
|
322
|
+
const catalogs = yield aggregate.exec();
|
|
323
|
+
const firstElement = (_a = catalogs.shift()) === null || _a === void 0 ? void 0 : _a.firstElement;
|
|
324
|
+
if (firstElement === undefined) {
|
|
325
|
+
throw new factory.errors.NotFound(this.offerCatalogModel.modelName);
|
|
326
|
+
}
|
|
327
|
+
return firstElement;
|
|
328
|
+
});
|
|
329
|
+
}
|
|
243
330
|
deleteById(params) {
|
|
244
331
|
return __awaiter(this, void 0, void 0, function* () {
|
|
245
332
|
yield this.offerCatalogModel.findOneAndRemove({
|
|
@@ -70,6 +70,21 @@ export declare class MongoRepository {
|
|
|
70
70
|
}): Promise<{
|
|
71
71
|
updatedAt: Date;
|
|
72
72
|
}>;
|
|
73
|
+
/**
|
|
74
|
+
* 注文後に決済方法区分を確定する
|
|
75
|
+
*/
|
|
76
|
+
fixPaymentMethodIdentifier(params: {
|
|
77
|
+
project: {
|
|
78
|
+
id: string;
|
|
79
|
+
};
|
|
80
|
+
orderNumber: string;
|
|
81
|
+
invoice: {
|
|
82
|
+
paymentMethodId: string;
|
|
83
|
+
paymentMethod: {
|
|
84
|
+
identifier: string;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
}): Promise<void>;
|
|
73
88
|
findById(params: {
|
|
74
89
|
id: string;
|
|
75
90
|
inclusion: string[];
|
package/lib/chevre/repo/order.js
CHANGED
|
@@ -24,7 +24,7 @@ class MongoRepository {
|
|
|
24
24
|
}
|
|
25
25
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
26
26
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
27
|
-
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, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19;
|
|
27
|
+
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, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22;
|
|
28
28
|
const andConditions = [];
|
|
29
29
|
const projectIdEq = (_b = (_a = params.project) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.$eq;
|
|
30
30
|
if (typeof projectIdEq === 'string') {
|
|
@@ -82,10 +82,11 @@ class MongoRepository {
|
|
|
82
82
|
if (Array.isArray(sellerIds)) {
|
|
83
83
|
andConditions.push({ 'seller.id': { $exists: true, $in: sellerIds } });
|
|
84
84
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
|
|
85
|
+
// 不要なので廃止(2023-09-11~)
|
|
86
|
+
// if (typeof params.seller?.typeOf === 'string') {
|
|
87
|
+
// andConditions.push({ 'seller.typeOf': { $exists: true, $eq: params.seller.typeOf } });
|
|
88
|
+
// }
|
|
89
|
+
const brokerIdEq = (_o = (_m = params.broker) === null || _m === void 0 ? void 0 : _m.id) === null || _o === void 0 ? void 0 : _o.$eq;
|
|
89
90
|
if (typeof brokerIdEq === 'string') {
|
|
90
91
|
andConditions.push({
|
|
91
92
|
'broker.id': {
|
|
@@ -302,7 +303,7 @@ class MongoRepository {
|
|
|
302
303
|
}
|
|
303
304
|
}
|
|
304
305
|
}
|
|
305
|
-
const nameEq = (
|
|
306
|
+
const nameEq = (_p = params.name) === null || _p === void 0 ? void 0 : _p.$eq;
|
|
306
307
|
if (typeof nameEq === 'string') {
|
|
307
308
|
andConditions.push({
|
|
308
309
|
name: {
|
|
@@ -311,7 +312,7 @@ class MongoRepository {
|
|
|
311
312
|
}
|
|
312
313
|
});
|
|
313
314
|
}
|
|
314
|
-
const nameRegex = (
|
|
315
|
+
const nameRegex = (_q = params.name) === null || _q === void 0 ? void 0 : _q.$regex;
|
|
315
316
|
if (typeof nameRegex === 'string' && nameRegex.length > 0) {
|
|
316
317
|
andConditions.push({
|
|
317
318
|
name: {
|
|
@@ -344,7 +345,7 @@ class MongoRepository {
|
|
|
344
345
|
}
|
|
345
346
|
});
|
|
346
347
|
}
|
|
347
|
-
const itemOfferedIdentifierIn = (
|
|
348
|
+
const itemOfferedIdentifierIn = (_t = (_s = (_r = params.acceptedOffers) === null || _r === void 0 ? void 0 : _r.itemOffered) === null || _s === void 0 ? void 0 : _s.identifier) === null || _t === void 0 ? void 0 : _t.$in;
|
|
348
349
|
if (Array.isArray(itemOfferedIdentifierIn)) {
|
|
349
350
|
andConditions.push({
|
|
350
351
|
'acceptedOffers.itemOffered.identifier': {
|
|
@@ -353,7 +354,7 @@ class MongoRepository {
|
|
|
353
354
|
}
|
|
354
355
|
});
|
|
355
356
|
}
|
|
356
|
-
const itemOfferedTypeOfIn = (
|
|
357
|
+
const itemOfferedTypeOfIn = (_w = (_v = (_u = params.acceptedOffers) === null || _u === void 0 ? void 0 : _u.itemOffered) === null || _v === void 0 ? void 0 : _v.typeOf) === null || _w === void 0 ? void 0 : _w.$in;
|
|
357
358
|
if (Array.isArray(itemOfferedTypeOfIn)) {
|
|
358
359
|
andConditions.push({
|
|
359
360
|
'acceptedOffers.itemOffered.typeOf': {
|
|
@@ -362,7 +363,7 @@ class MongoRepository {
|
|
|
362
363
|
}
|
|
363
364
|
});
|
|
364
365
|
}
|
|
365
|
-
const itemOfferedIssuedThroughTypeOfEq = (
|
|
366
|
+
const itemOfferedIssuedThroughTypeOfEq = (_0 = (_z = (_y = (_x = params.acceptedOffers) === null || _x === void 0 ? void 0 : _x.itemOffered) === null || _y === void 0 ? void 0 : _y.issuedThrough) === null || _z === void 0 ? void 0 : _z.typeOf) === null || _0 === void 0 ? void 0 : _0.$eq;
|
|
366
367
|
if (typeof itemOfferedIssuedThroughTypeOfEq === 'string') {
|
|
367
368
|
andConditions.push({
|
|
368
369
|
'acceptedOffers.itemOffered.issuedThrough.typeOf': {
|
|
@@ -371,7 +372,7 @@ class MongoRepository {
|
|
|
371
372
|
}
|
|
372
373
|
});
|
|
373
374
|
}
|
|
374
|
-
const itemOfferedIssuedThroughIdIn = (
|
|
375
|
+
const itemOfferedIssuedThroughIdIn = (_4 = (_3 = (_2 = (_1 = params.acceptedOffers) === null || _1 === void 0 ? void 0 : _1.itemOffered) === null || _2 === void 0 ? void 0 : _2.issuedThrough) === null || _3 === void 0 ? void 0 : _3.id) === null || _4 === void 0 ? void 0 : _4.$in;
|
|
375
376
|
if (Array.isArray(itemOfferedIssuedThroughIdIn)) {
|
|
376
377
|
andConditions.push({
|
|
377
378
|
'acceptedOffers.itemOffered.issuedThrough.id': {
|
|
@@ -380,7 +381,7 @@ class MongoRepository {
|
|
|
380
381
|
}
|
|
381
382
|
});
|
|
382
383
|
}
|
|
383
|
-
const itemOfferedProgramMembershipUsedIdentifierEq = (
|
|
384
|
+
const itemOfferedProgramMembershipUsedIdentifierEq = (_8 = (_7 = (_6 = (_5 = params.acceptedOffers) === null || _5 === void 0 ? void 0 : _5.itemOffered) === null || _6 === void 0 ? void 0 : _6.programMembershipUsed) === null || _7 === void 0 ? void 0 : _7.identifier) === null || _8 === void 0 ? void 0 : _8.$eq;
|
|
384
385
|
if (typeof itemOfferedProgramMembershipUsedIdentifierEq === 'string') {
|
|
385
386
|
andConditions.push({
|
|
386
387
|
'acceptedOffers.itemOffered.programMembershipUsed.identifier': {
|
|
@@ -389,7 +390,7 @@ class MongoRepository {
|
|
|
389
390
|
}
|
|
390
391
|
});
|
|
391
392
|
}
|
|
392
|
-
const itemOfferedProgramMembershipUsedIssuedThroughServiceTypeCodeValueEq = (
|
|
393
|
+
const itemOfferedProgramMembershipUsedIssuedThroughServiceTypeCodeValueEq = (_14 = (_13 = (_12 = (_11 = (_10 = (_9 = params.acceptedOffers) === null || _9 === void 0 ? void 0 : _9.itemOffered) === null || _10 === void 0 ? void 0 : _10.programMembershipUsed) === null || _11 === void 0 ? void 0 : _11.issuedThrough) === null || _12 === void 0 ? void 0 : _12.serviceType) === null || _13 === void 0 ? void 0 : _13.codeValue) === null || _14 === void 0 ? void 0 : _14.$eq;
|
|
393
394
|
if (typeof itemOfferedProgramMembershipUsedIssuedThroughServiceTypeCodeValueEq === 'string') {
|
|
394
395
|
andConditions.push({
|
|
395
396
|
'acceptedOffers.itemOffered.programMembershipUsed.issuedThrough.serviceType.codeValue': {
|
|
@@ -551,6 +552,14 @@ class MongoRepository {
|
|
|
551
552
|
}
|
|
552
553
|
}
|
|
553
554
|
}
|
|
555
|
+
const paymentMethodIdentifierIn = (_17 = (_16 = (_15 = params.paymentMethods) === null || _15 === void 0 ? void 0 : _15.paymentMethod) === null || _16 === void 0 ? void 0 : _16.identifier) === null || _17 === void 0 ? void 0 : _17.$in;
|
|
556
|
+
if (Array.isArray(paymentMethodIdentifierIn)) {
|
|
557
|
+
andConditions.push({ 'paymentMethods.paymentMethod.identifier': { $exists: true, $in: paymentMethodIdentifierIn } });
|
|
558
|
+
}
|
|
559
|
+
const paymentMethodsTypeOfIn = (_18 = params.paymentMethods) === null || _18 === void 0 ? void 0 : _18.typeOfs;
|
|
560
|
+
if (Array.isArray(paymentMethodsTypeOfIn)) {
|
|
561
|
+
andConditions.push({ 'paymentMethods.typeOf': { $exists: true, $in: paymentMethodsTypeOfIn } });
|
|
562
|
+
}
|
|
554
563
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
555
564
|
/* istanbul ignore else */
|
|
556
565
|
if (params.paymentMethods !== undefined) {
|
|
@@ -566,16 +575,6 @@ class MongoRepository {
|
|
|
566
575
|
}
|
|
567
576
|
// tslint:disable-next-line:no-single-line-block-comment
|
|
568
577
|
/* istanbul ignore else */
|
|
569
|
-
if (Array.isArray(params.paymentMethods.typeOfs)) {
|
|
570
|
-
andConditions.push({
|
|
571
|
-
'paymentMethods.typeOf': {
|
|
572
|
-
$exists: true,
|
|
573
|
-
$in: params.paymentMethods.typeOfs
|
|
574
|
-
}
|
|
575
|
-
});
|
|
576
|
-
}
|
|
577
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
578
|
-
/* istanbul ignore else */
|
|
579
578
|
if (Array.isArray(params.paymentMethods.paymentMethodIds)) {
|
|
580
579
|
andConditions.push({
|
|
581
580
|
'paymentMethods.paymentMethodId': {
|
|
@@ -585,7 +584,7 @@ class MongoRepository {
|
|
|
585
584
|
});
|
|
586
585
|
}
|
|
587
586
|
}
|
|
588
|
-
const paymentMethodAdditionalPropertyAll = (
|
|
587
|
+
const paymentMethodAdditionalPropertyAll = (_20 = (_19 = params.paymentMethods) === null || _19 === void 0 ? void 0 : _19.additionalProperty) === null || _20 === void 0 ? void 0 : _20.$all;
|
|
589
588
|
if (Array.isArray(paymentMethodAdditionalPropertyAll)) {
|
|
590
589
|
andConditions.push({
|
|
591
590
|
'paymentMethods.additionalProperty': {
|
|
@@ -594,7 +593,7 @@ class MongoRepository {
|
|
|
594
593
|
}
|
|
595
594
|
});
|
|
596
595
|
}
|
|
597
|
-
const paymentMethodAdditionalPropertyIn = (
|
|
596
|
+
const paymentMethodAdditionalPropertyIn = (_22 = (_21 = params.paymentMethods) === null || _21 === void 0 ? void 0 : _21.additionalProperty) === null || _22 === void 0 ? void 0 : _22.$in;
|
|
598
597
|
if (Array.isArray(paymentMethodAdditionalPropertyIn)) {
|
|
599
598
|
andConditions.push({
|
|
600
599
|
'paymentMethods.additionalProperty': {
|
|
@@ -681,7 +680,10 @@ class MongoRepository {
|
|
|
681
680
|
orderNumber: { $eq: params.orderNumber },
|
|
682
681
|
orderStatus: { $eq: params.previousOrderStatus },
|
|
683
682
|
'project.id': { $eq: params.project.id }
|
|
684
|
-
}, {
|
|
683
|
+
}, {
|
|
684
|
+
previousOrderStatus: params.previousOrderStatus,
|
|
685
|
+
orderStatus: params.orderStatus
|
|
686
|
+
}, {
|
|
685
687
|
new: true,
|
|
686
688
|
projection: {
|
|
687
689
|
__v: 0,
|
|
@@ -723,6 +725,7 @@ class MongoRepository {
|
|
|
723
725
|
orderStatus: { $eq: factory.orderStatus.OrderDelivered },
|
|
724
726
|
'project.id': { $eq: params.project.id }
|
|
725
727
|
}, {
|
|
728
|
+
previousOrderStatus: factory.orderStatus.OrderDelivered,
|
|
726
729
|
orderStatus: factory.orderStatus.OrderReturned,
|
|
727
730
|
dateReturned: params.dateReturned,
|
|
728
731
|
returner: params.returner
|
|
@@ -782,6 +785,35 @@ class MongoRepository {
|
|
|
782
785
|
return { updatedAt: doc.updatedAt };
|
|
783
786
|
});
|
|
784
787
|
}
|
|
788
|
+
/**
|
|
789
|
+
* 注文後に決済方法区分を確定する
|
|
790
|
+
*/
|
|
791
|
+
fixPaymentMethodIdentifier(params) {
|
|
792
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
793
|
+
const doc = yield this.orderModel.findOneAndUpdate({
|
|
794
|
+
orderNumber: { $eq: params.orderNumber },
|
|
795
|
+
'project.id': { $eq: params.project.id },
|
|
796
|
+
'paymentMethods.paymentMethodId': { $exists: true, $eq: params.invoice.paymentMethodId }
|
|
797
|
+
}, {
|
|
798
|
+
$set: {
|
|
799
|
+
'paymentMethods.$[invoice].paymentMethod.identifier': params.invoice.paymentMethod.identifier,
|
|
800
|
+
// tslint:disable-next-line:no-suspicious-comment
|
|
801
|
+
// TODO 互換性維持対応としてtypeOfも変更しているが、そのうち廃止(2023-08-30)
|
|
802
|
+
'paymentMethods.$[invoice].typeOf': params.invoice.paymentMethod.identifier
|
|
803
|
+
}
|
|
804
|
+
}, {
|
|
805
|
+
arrayFilters: [{ 'invoice.paymentMethodId': { $eq: params.invoice.paymentMethodId } }],
|
|
806
|
+
new: true,
|
|
807
|
+
projection: {
|
|
808
|
+
_id: 1
|
|
809
|
+
}
|
|
810
|
+
})
|
|
811
|
+
.exec();
|
|
812
|
+
if (doc === null) {
|
|
813
|
+
throw new factory.errors.NotFound(this.orderModel.modelName);
|
|
814
|
+
}
|
|
815
|
+
});
|
|
816
|
+
}
|
|
785
817
|
findById(params) {
|
|
786
818
|
return __awaiter(this, void 0, void 0, function* () {
|
|
787
819
|
let projection = {};
|
|
@@ -30,14 +30,18 @@ export declare class MongoRepository {
|
|
|
30
30
|
saveMany(taskAttributes: factory.task.IAttributes<factory.taskName>[], options: IOptionOnCreate): Promise<{
|
|
31
31
|
id: string;
|
|
32
32
|
}[]>;
|
|
33
|
+
/**
|
|
34
|
+
* タスク識別子から冪等作成する
|
|
35
|
+
*/
|
|
36
|
+
createIfNotExistByIdentifier(params: factory.task.IAttributes<factory.taskName>, options: IOptionOnCreate): Promise<void>;
|
|
33
37
|
createInformTaskIfNotExist(params: factory.task.IAttributes<factory.taskName.TriggerWebhook>, options: IOptionOnCreate): Promise<void>;
|
|
34
38
|
/**
|
|
35
39
|
* 取引削除タスク冪等作成
|
|
36
40
|
*/
|
|
37
41
|
createDeleteTransactionTaskIfNotExist(params: factory.task.IAttributes<factory.taskName.DeleteTransaction>, options: IOptionOnCreate): Promise<void>;
|
|
38
42
|
createConfirmReserveTransactionTaskIfNotExist(params: factory.task.IAttributes<factory.taskName.ConfirmReserveTransaction>, options: IOptionOnCreate): Promise<void>;
|
|
43
|
+
createOnAssetTransactionStatusChangedTaskIfNotExist(params: factory.task.IAttributes<factory.taskName.OnAssetTransactionStatusChanged>, options: IOptionOnCreate): Promise<void>;
|
|
39
44
|
createSendOrderTaskIfNotExist(params: factory.task.IAttributes<factory.taskName.SendOrder>, options: IOptionOnCreate): Promise<void>;
|
|
40
|
-
createOnOrderPaymentCompletedTaskIfNotExist(params: factory.task.IAttributes<factory.taskName.OnOrderPaymentCompleted>, options: IOptionOnCreate): Promise<void>;
|
|
41
45
|
executeById(params: {
|
|
42
46
|
id: string;
|
|
43
47
|
executor: {
|
|
@@ -70,7 +74,7 @@ export declare class MongoRepository {
|
|
|
70
74
|
*/
|
|
71
75
|
$nin?: factory.taskName[];
|
|
72
76
|
};
|
|
73
|
-
}): Promise<Pick<import("@chevre/factory/lib/task").ITask | import("@chevre/factory/lib/task/confirmMoneyTransfer").ITask | import("@chevre/factory/lib/task/confirmRegisterService").ITask | import("@chevre/factory/lib/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/task/createEvent").ITask | import("@chevre/factory/lib/task/deleteTransaction").ITask | import("@chevre/factory/lib/task/givePointAward").ITask | import("@chevre/factory/lib/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/task/onEventChanged").ITask | import("@chevre/factory/lib/task/onResourceUpdated").ITask | import("@chevre/factory/lib/task/onOrderPaymentCompleted").ITask | import("@chevre/factory/lib/task/placeOrder").ITask | import("@chevre/factory/lib/task/returnOrder").ITask | import("@chevre/factory/lib/task/returnMoneyTransfer").ITask | import("@chevre/factory/lib/task/returnPayTransaction").ITask | import("@chevre/factory/lib/task/returnPointAward").ITask | import("@chevre/factory/lib/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/task/sendEmailMessage").ITask | import("@chevre/factory/lib/task/sendOrder").ITask | import("@chevre/factory/lib/task/syncScreeningRooms").ITask | import("@chevre/factory/lib/task/triggerWebhook").ITask | import("@chevre/factory/lib/task/useReservation").ITask | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").ITask | import("@chevre/factory/lib/task/voidPayTransaction").ITask | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/voidReserveTransaction").ITask, "id" | "name" | "status">[]>;
|
|
77
|
+
}): Promise<Pick<import("@chevre/factory/lib/task").ITask | import("@chevre/factory/lib/task/confirmMoneyTransfer").ITask | import("@chevre/factory/lib/task/confirmRegisterService").ITask | import("@chevre/factory/lib/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/task/createEvent").ITask | import("@chevre/factory/lib/task/deleteTransaction").ITask | import("@chevre/factory/lib/task/givePointAward").ITask | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").ITask | import("@chevre/factory/lib/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/task/onEventChanged").ITask | import("@chevre/factory/lib/task/onResourceUpdated").ITask | import("@chevre/factory/lib/task/onOrderPaymentCompleted").ITask | import("@chevre/factory/lib/task/placeOrder").ITask | import("@chevre/factory/lib/task/returnOrder").ITask | import("@chevre/factory/lib/task/returnMoneyTransfer").ITask | import("@chevre/factory/lib/task/returnPayTransaction").ITask | import("@chevre/factory/lib/task/returnPointAward").ITask | import("@chevre/factory/lib/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/task/sendEmailMessage").ITask | import("@chevre/factory/lib/task/sendOrder").ITask | import("@chevre/factory/lib/task/syncAggregateOffer").ITask | import("@chevre/factory/lib/task/syncScreeningRooms").ITask | import("@chevre/factory/lib/task/triggerWebhook").ITask | import("@chevre/factory/lib/task/useReservation").ITask | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").ITask | import("@chevre/factory/lib/task/voidPayTransaction").ITask | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/voidReserveTransaction").ITask, "id" | "name" | "status">[]>;
|
|
74
78
|
retry(params: {
|
|
75
79
|
intervalInMinutes: number;
|
|
76
80
|
}): Promise<void>;
|
package/lib/chevre/repo/task.js
CHANGED
|
@@ -174,6 +174,30 @@ class MongoRepository {
|
|
|
174
174
|
}
|
|
175
175
|
});
|
|
176
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* タスク識別子から冪等作成する
|
|
179
|
+
*/
|
|
180
|
+
createIfNotExistByIdentifier(params, options) {
|
|
181
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
182
|
+
if (typeof params.identifier !== 'string' || params.identifier.length === 0) {
|
|
183
|
+
throw new factory.errors.ArgumentNull('identifier');
|
|
184
|
+
}
|
|
185
|
+
const createdTask = yield this.taskModel.findOneAndUpdate({
|
|
186
|
+
'project.id': { $eq: params.project.id },
|
|
187
|
+
name: { $eq: params.name },
|
|
188
|
+
identifier: { $exists: true, $eq: params.identifier }
|
|
189
|
+
}, { $setOnInsert: params }, { new: true, upsert: true })
|
|
190
|
+
.select({ _id: 1 })
|
|
191
|
+
.exec();
|
|
192
|
+
if (options.emitImmediately) {
|
|
193
|
+
task_2.taskEventEmitter.emitTaskStatusChanged({
|
|
194
|
+
id: createdTask.id,
|
|
195
|
+
name: params.name,
|
|
196
|
+
status: factory.taskStatus.Ready
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
}
|
|
177
201
|
createInformTaskIfNotExist(params, options) {
|
|
178
202
|
return __awaiter(this, void 0, void 0, function* () {
|
|
179
203
|
const createdTask = yield this.taskModel.findOneAndUpdate({
|
|
@@ -244,14 +268,18 @@ class MongoRepository {
|
|
|
244
268
|
}
|
|
245
269
|
});
|
|
246
270
|
}
|
|
247
|
-
|
|
271
|
+
createOnAssetTransactionStatusChangedTaskIfNotExist(params, options) {
|
|
248
272
|
return __awaiter(this, void 0, void 0, function* () {
|
|
249
273
|
const createdTask = yield this.taskModel.findOneAndUpdate({
|
|
250
274
|
'project.id': { $eq: params.project.id },
|
|
251
275
|
name: { $eq: params.name },
|
|
252
|
-
'data.object.
|
|
276
|
+
'data.object.transactionNumber': {
|
|
253
277
|
$exists: true,
|
|
254
|
-
$eq: String(params.data.object.
|
|
278
|
+
$eq: String(params.data.object.transactionNumber)
|
|
279
|
+
},
|
|
280
|
+
'data.purpose.orderNumber': {
|
|
281
|
+
$exists: true,
|
|
282
|
+
$eq: String(params.data.purpose.orderNumber)
|
|
255
283
|
}
|
|
256
284
|
}, { $setOnInsert: params }, { new: true, upsert: true })
|
|
257
285
|
.select({ _id: 1 })
|
|
@@ -265,7 +293,7 @@ class MongoRepository {
|
|
|
265
293
|
}
|
|
266
294
|
});
|
|
267
295
|
}
|
|
268
|
-
|
|
296
|
+
createSendOrderTaskIfNotExist(params, options) {
|
|
269
297
|
return __awaiter(this, void 0, void 0, function* () {
|
|
270
298
|
const createdTask = yield this.taskModel.findOneAndUpdate({
|
|
271
299
|
'project.id': { $eq: params.project.id },
|
|
@@ -286,6 +314,32 @@ class MongoRepository {
|
|
|
286
314
|
}
|
|
287
315
|
});
|
|
288
316
|
}
|
|
317
|
+
// public async createOnOrderPaymentCompletedTaskIfNotExist(
|
|
318
|
+
// params: factory.task.IAttributes<factory.taskName.OnOrderPaymentCompleted>,
|
|
319
|
+
// options: IOptionOnCreate
|
|
320
|
+
// ): Promise<void> {
|
|
321
|
+
// const createdTask = await this.taskModel.findOneAndUpdate(
|
|
322
|
+
// {
|
|
323
|
+
// 'project.id': { $eq: params.project.id },
|
|
324
|
+
// name: { $eq: params.name },
|
|
325
|
+
// 'data.object.orderNumber': {
|
|
326
|
+
// $exists: true,
|
|
327
|
+
// $eq: String(params.data.object.orderNumber)
|
|
328
|
+
// }
|
|
329
|
+
// },
|
|
330
|
+
// { $setOnInsert: params },
|
|
331
|
+
// { new: true, upsert: true }
|
|
332
|
+
// )
|
|
333
|
+
// .select({ _id: 1 })
|
|
334
|
+
// .exec();
|
|
335
|
+
// if (options.emitImmediately) {
|
|
336
|
+
// taskEventEmitter.emitTaskStatusChanged({
|
|
337
|
+
// id: createdTask.id,
|
|
338
|
+
// name: params.name,
|
|
339
|
+
// status: factory.taskStatus.Ready
|
|
340
|
+
// });
|
|
341
|
+
// }
|
|
342
|
+
// }
|
|
289
343
|
executeById(params) {
|
|
290
344
|
return __awaiter(this, void 0, void 0, function* () {
|
|
291
345
|
const doc = yield this.taskModel.findOneAndUpdate({
|
|
@@ -7,6 +7,7 @@ import { MongoRepository as AccountTitleRepo } from './repo/accountTitle';
|
|
|
7
7
|
import { MongoRepository as AccountTransactionRepo } from './repo/accountTransaction';
|
|
8
8
|
import { MongoRepository as ActionRepo } from './repo/action';
|
|
9
9
|
import { MongoRepository as AdditionalPropertyRepo } from './repo/additionalProperty';
|
|
10
|
+
import { MongoRepository as AggregateOfferRepo } from './repo/aggregateOffer';
|
|
10
11
|
import { MongoRepository as AggregationRepo } from './repo/aggregation';
|
|
11
12
|
import { MongoRepository as AssetTransactionRepo } from './repo/assetTransaction';
|
|
12
13
|
import { MongoRepository as CategoryCodeRepo } from './repo/categoryCode';
|
|
@@ -71,6 +72,8 @@ export declare class Action extends ActionRepo {
|
|
|
71
72
|
*/
|
|
72
73
|
export declare class AdditionalProperty extends AdditionalPropertyRepo {
|
|
73
74
|
}
|
|
75
|
+
export declare class AggregateOffer extends AggregateOfferRepo {
|
|
76
|
+
}
|
|
74
77
|
export declare class Aggregation extends AggregationRepo {
|
|
75
78
|
}
|
|
76
79
|
export declare namespace action {
|
package/lib/chevre/repository.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.rateLimit = exports.Trip = exports.TransactionNumber = exports.Transaction = exports.Telemetry = exports.Task = exports.StockHolder = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.Seller = exports.Role = exports.Reservation = exports.Project = exports.ProductOffer = exports.Product = exports.PriceSpecification = exports.Place = exports.Permit = exports.Person = exports.paymentMethod = exports.PaymentServiceProvider = exports.OwnershipInfo = exports.OrderNumber = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalog = exports.MerchantReturnPolicy = exports.Member = exports.Event = exports.EmailMessage = exports.Customer = exports.CreativeWork = exports.ConfirmationNumber = exports.Comment = exports.Code = exports.CategoryCode = exports.AssetTransaction = exports.action = exports.Aggregation = exports.AdditionalProperty = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = void 0;
|
|
3
|
+
exports.rateLimit = exports.Trip = exports.TransactionNumber = exports.Transaction = exports.Telemetry = exports.Task = exports.StockHolder = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.Seller = exports.Role = exports.Reservation = exports.Project = exports.ProductOffer = exports.Product = exports.PriceSpecification = exports.Place = exports.Permit = exports.Person = exports.paymentMethod = exports.PaymentServiceProvider = exports.OwnershipInfo = exports.OrderNumber = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalog = exports.MerchantReturnPolicy = exports.Member = exports.Event = exports.EmailMessage = exports.Customer = exports.CreativeWork = exports.ConfirmationNumber = exports.Comment = exports.Code = exports.CategoryCode = exports.AssetTransaction = exports.action = exports.Aggregation = exports.AggregateOffer = exports.AdditionalProperty = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = void 0;
|
|
4
4
|
// tslint:disable:max-classes-per-file completed-docs
|
|
5
5
|
/**
|
|
6
6
|
* リポジトリ
|
|
@@ -11,6 +11,7 @@ const accountTitle_1 = require("./repo/accountTitle");
|
|
|
11
11
|
const accountTransaction_1 = require("./repo/accountTransaction");
|
|
12
12
|
const action_1 = require("./repo/action");
|
|
13
13
|
const additionalProperty_1 = require("./repo/additionalProperty");
|
|
14
|
+
const aggregateOffer_1 = require("./repo/aggregateOffer");
|
|
14
15
|
const aggregation_1 = require("./repo/aggregation");
|
|
15
16
|
const assetTransaction_1 = require("./repo/assetTransaction");
|
|
16
17
|
const categoryCode_1 = require("./repo/categoryCode");
|
|
@@ -81,6 +82,9 @@ exports.Action = Action;
|
|
|
81
82
|
class AdditionalProperty extends additionalProperty_1.MongoRepository {
|
|
82
83
|
}
|
|
83
84
|
exports.AdditionalProperty = AdditionalProperty;
|
|
85
|
+
class AggregateOffer extends aggregateOffer_1.MongoRepository {
|
|
86
|
+
}
|
|
87
|
+
exports.AggregateOffer = AggregateOffer;
|
|
84
88
|
class Aggregation extends aggregation_1.MongoRepository {
|
|
85
89
|
}
|
|
86
90
|
exports.Aggregation = Aggregation;
|