@chevre/domain 21.8.0-alpha.61 → 21.8.0-alpha.63
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/searchEventTicketOffers.ts +2 -2
- package/example/src/chevre/searchEvents.ts +2 -2
- package/example/src/chevre/searchOffersByCatalog.ts +4 -4
- package/lib/chevre/repo/offer.d.ts +18 -35
- package/lib/chevre/repo/offer.js +179 -941
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +3 -41
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +2 -40
- package/lib/chevre/service/aggregation/event/findEventOffers.d.ts +14 -0
- package/lib/chevre/service/aggregation/event/findEventOffers.js +51 -0
- package/lib/chevre/service/assetTransaction/registerService.js +2 -1
- package/lib/chevre/service/assetTransaction/reserve.js +3 -2
- package/lib/chevre/service/offer/event/authorize.js +2 -1
- package/lib/chevre/service/offer/event/searchEventTicketOffers.d.ts +1 -0
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +15 -8
- package/lib/chevre/service/offer/product/searchProductOffers.d.ts +1 -0
- package/lib/chevre/service/offer/product/searchProductOffers.js +12 -5
- package/lib/chevre/service/offer/product.d.ts +1 -0
- package/lib/chevre/service/offer/product.js +3 -2
- package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +3 -3
- package/lib/chevre/settings.d.ts +0 -2
- package/lib/chevre/settings.js +1 -3
- package/package.json +1 -1
- /package/example/src/chevre/{migrateAggregateOffers.ts → syncCatalogs2aggregateOffers.ts} +0 -0
package/lib/chevre/repo/offer.js
CHANGED
|
@@ -24,11 +24,7 @@ exports.MongoRepository = void 0;
|
|
|
24
24
|
const uniqid = require("uniqid");
|
|
25
25
|
const factory = require("../factory");
|
|
26
26
|
const aggregateOffer_1 = require("./mongoose/schemas/aggregateOffer");
|
|
27
|
-
// import { modelName as offerModelName, schema as offerSchema } from './mongoose/schemas/offer';
|
|
28
27
|
const offerCatalog_1 = require("./mongoose/schemas/offerCatalog");
|
|
29
|
-
const task_1 = require("./mongoose/schemas/task");
|
|
30
|
-
const task_2 = require("../eventEmitter/task");
|
|
31
|
-
const settings_1 = require("../settings");
|
|
32
28
|
const OFFERS_ARRAY_INDEX_NAME = 'offerIndex';
|
|
33
29
|
/**
|
|
34
30
|
* 単価オファーリポジトリ
|
|
@@ -37,331 +33,12 @@ class MongoRepository {
|
|
|
37
33
|
constructor(connection) {
|
|
38
34
|
this.aggregateOfferModel = connection.model(aggregateOffer_1.modelName, aggregateOffer_1.schema);
|
|
39
35
|
// .on('index', (error: any) => {
|
|
40
|
-
//
|
|
41
|
-
//
|
|
42
|
-
// console.error('index event emitted.', error);
|
|
43
|
-
// }
|
|
36
|
+
// // tslint:disable-next-line:no-console
|
|
37
|
+
// console.error('index event emitted.', error);
|
|
44
38
|
// });
|
|
45
|
-
// this.offerModel = connection.model(offerModelName, offerSchema);
|
|
46
39
|
this.offerCatalogModel = connection.model(offerCatalog_1.modelName, offerCatalog_1.schema);
|
|
47
|
-
this.taskModel = connection.model(task_1.modelName, task_1.schema);
|
|
48
40
|
}
|
|
49
41
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
50
|
-
// public static CREATE_OFFER_MONGO_CONDITIONS(params: factory.unitPriceOffer.ISearchConditions) {
|
|
51
|
-
// // MongoDB検索条件
|
|
52
|
-
// const andConditions: any[] = [];
|
|
53
|
-
// const projectIdEq = params.project?.id?.$eq;
|
|
54
|
-
// if (typeof projectIdEq === 'string') {
|
|
55
|
-
// andConditions.push({
|
|
56
|
-
// 'project.id': {
|
|
57
|
-
// $eq: projectIdEq
|
|
58
|
-
// }
|
|
59
|
-
// });
|
|
60
|
-
// }
|
|
61
|
-
// const parentOfferIdIn = params.parentOffer?.id?.$in;
|
|
62
|
-
// if (Array.isArray(parentOfferIdIn)) {
|
|
63
|
-
// andConditions.push({ _id: { $in: parentOfferIdIn } });
|
|
64
|
-
// }
|
|
65
|
-
// const idEq = params.id?.$eq;
|
|
66
|
-
// if (typeof idEq === 'string') {
|
|
67
|
-
// andConditions.push({
|
|
68
|
-
// _id: {
|
|
69
|
-
// $eq: idEq
|
|
70
|
-
// }
|
|
71
|
-
// });
|
|
72
|
-
// }
|
|
73
|
-
// const idIn = params.id?.$in;
|
|
74
|
-
// if (Array.isArray(idIn)) {
|
|
75
|
-
// andConditions.push({
|
|
76
|
-
// _id: {
|
|
77
|
-
// $in: idIn
|
|
78
|
-
// }
|
|
79
|
-
// });
|
|
80
|
-
// }
|
|
81
|
-
// const identifierEq = params.identifier?.$eq;
|
|
82
|
-
// if (typeof identifierEq === 'string') {
|
|
83
|
-
// andConditions.push({
|
|
84
|
-
// identifier: {
|
|
85
|
-
// $exists: true,
|
|
86
|
-
// $eq: identifierEq
|
|
87
|
-
// }
|
|
88
|
-
// });
|
|
89
|
-
// }
|
|
90
|
-
// const identifierIn = params.identifier?.$in;
|
|
91
|
-
// if (Array.isArray(identifierIn)) {
|
|
92
|
-
// andConditions.push({
|
|
93
|
-
// identifier: {
|
|
94
|
-
// $exists: true,
|
|
95
|
-
// $in: identifierIn
|
|
96
|
-
// }
|
|
97
|
-
// });
|
|
98
|
-
// }
|
|
99
|
-
// const identifierRegex = params.identifier?.$regex;
|
|
100
|
-
// if (typeof identifierRegex === 'string' && identifierRegex.length > 0) {
|
|
101
|
-
// andConditions.push({
|
|
102
|
-
// identifier: {
|
|
103
|
-
// $exists: true,
|
|
104
|
-
// $regex: new RegExp(identifierRegex)
|
|
105
|
-
// }
|
|
106
|
-
// });
|
|
107
|
-
// }
|
|
108
|
-
// const nameRegex = params.name?.$regex;
|
|
109
|
-
// if (typeof nameRegex === 'string' && nameRegex.length > 0) {
|
|
110
|
-
// const nameRegexExp = new RegExp(nameRegex);
|
|
111
|
-
// andConditions.push({
|
|
112
|
-
// $or: [
|
|
113
|
-
// {
|
|
114
|
-
// 'name.ja': {
|
|
115
|
-
// $exists: true,
|
|
116
|
-
// $regex: nameRegexExp
|
|
117
|
-
// }
|
|
118
|
-
// },
|
|
119
|
-
// {
|
|
120
|
-
// 'name.en': {
|
|
121
|
-
// $exists: true,
|
|
122
|
-
// $regex: nameRegexExp
|
|
123
|
-
// }
|
|
124
|
-
// },
|
|
125
|
-
// {
|
|
126
|
-
// 'alternateName.ja': {
|
|
127
|
-
// $exists: true,
|
|
128
|
-
// $regex: nameRegexExp
|
|
129
|
-
// }
|
|
130
|
-
// },
|
|
131
|
-
// {
|
|
132
|
-
// 'alternateName.en': {
|
|
133
|
-
// $exists: true,
|
|
134
|
-
// $regex: nameRegexExp
|
|
135
|
-
// }
|
|
136
|
-
// }
|
|
137
|
-
// ]
|
|
138
|
-
// });
|
|
139
|
-
// }
|
|
140
|
-
// const itemOfferedTypeOfEq = params.itemOffered?.typeOf?.$eq;
|
|
141
|
-
// if (typeof itemOfferedTypeOfEq === 'string') {
|
|
142
|
-
// andConditions.push({
|
|
143
|
-
// 'itemOffered.typeOf': {
|
|
144
|
-
// $exists: true,
|
|
145
|
-
// $eq: itemOfferedTypeOfEq
|
|
146
|
-
// }
|
|
147
|
-
// });
|
|
148
|
-
// }
|
|
149
|
-
// const categoryCodeValueIn = params.category?.codeValue?.$in;
|
|
150
|
-
// if (Array.isArray(categoryCodeValueIn)) {
|
|
151
|
-
// andConditions.push({
|
|
152
|
-
// 'category.codeValue': {
|
|
153
|
-
// $exists: true,
|
|
154
|
-
// $in: categoryCodeValueIn
|
|
155
|
-
// }
|
|
156
|
-
// });
|
|
157
|
-
// }
|
|
158
|
-
// const eligibleMembershipTypeCodeValueEq = params.eligibleMembershipType?.codeValue?.$eq;
|
|
159
|
-
// if (typeof eligibleMembershipTypeCodeValueEq === 'string') {
|
|
160
|
-
// andConditions.push({
|
|
161
|
-
// 'eligibleMembershipType.codeValue': {
|
|
162
|
-
// $exists: true,
|
|
163
|
-
// $eq: eligibleMembershipTypeCodeValueEq
|
|
164
|
-
// }
|
|
165
|
-
// });
|
|
166
|
-
// }
|
|
167
|
-
// const eligibleMonetaryAmountCurrencyEq = params.eligibleMonetaryAmount?.currency?.$eq;
|
|
168
|
-
// if (typeof eligibleMonetaryAmountCurrencyEq === 'string') {
|
|
169
|
-
// andConditions.push({
|
|
170
|
-
// 'eligibleMonetaryAmount.currency': {
|
|
171
|
-
// $exists: true,
|
|
172
|
-
// $eq: eligibleMonetaryAmountCurrencyEq
|
|
173
|
-
// }
|
|
174
|
-
// });
|
|
175
|
-
// }
|
|
176
|
-
// const eligibleSeatingTypeCodeValueEq = params.eligibleSeatingType?.codeValue?.$eq;
|
|
177
|
-
// if (typeof eligibleSeatingTypeCodeValueEq === 'string') {
|
|
178
|
-
// andConditions.push({
|
|
179
|
-
// 'eligibleSeatingType.codeValue': {
|
|
180
|
-
// $exists: true,
|
|
181
|
-
// $eq: eligibleSeatingTypeCodeValueEq
|
|
182
|
-
// }
|
|
183
|
-
// });
|
|
184
|
-
// }
|
|
185
|
-
// const appliesToMovieTicketServiceTypeExist = params.priceSpecification?.appliesToMovieTicket?.serviceType?.$exists;
|
|
186
|
-
// if (typeof appliesToMovieTicketServiceTypeExist === 'boolean') {
|
|
187
|
-
// andConditions.push({
|
|
188
|
-
// 'priceSpecification.appliesToMovieTicket.serviceType': {
|
|
189
|
-
// $exists: appliesToMovieTicketServiceTypeExist
|
|
190
|
-
// }
|
|
191
|
-
// });
|
|
192
|
-
// }
|
|
193
|
-
// const appliesToMovieTicketServiceTypeEq = params.priceSpecification?.appliesToMovieTicket?.serviceType?.$eq;
|
|
194
|
-
// if (typeof appliesToMovieTicketServiceTypeEq === 'string') {
|
|
195
|
-
// andConditions.push({
|
|
196
|
-
// 'priceSpecification.appliesToMovieTicket.serviceType': {
|
|
197
|
-
// $exists: true,
|
|
198
|
-
// $eq: appliesToMovieTicketServiceTypeEq
|
|
199
|
-
// }
|
|
200
|
-
// });
|
|
201
|
-
// }
|
|
202
|
-
// const appliesToMovieTicketServiceOutputTypeOfEq = params.priceSpecification?.appliesToMovieTicket?.serviceOutput?.typeOf?.$eq;
|
|
203
|
-
// if (typeof appliesToMovieTicketServiceOutputTypeOfEq === 'string') {
|
|
204
|
-
// andConditions.push({
|
|
205
|
-
// 'priceSpecification.appliesToMovieTicket.serviceOutput.typeOf': {
|
|
206
|
-
// $exists: true,
|
|
207
|
-
// $eq: appliesToMovieTicketServiceOutputTypeOfEq
|
|
208
|
-
// }
|
|
209
|
-
// });
|
|
210
|
-
// }
|
|
211
|
-
// const appliesToMovieTicketServiceOutputTypeOfNin = params.priceSpecification?.appliesToMovieTicket?.serviceOutput?.typeOf?.$nin;
|
|
212
|
-
// if (Array.isArray(appliesToMovieTicketServiceOutputTypeOfNin)) {
|
|
213
|
-
// andConditions.push({
|
|
214
|
-
// 'priceSpecification.appliesToMovieTicket.serviceOutput.typeOf': {
|
|
215
|
-
// $nin: appliesToMovieTicketServiceOutputTypeOfNin
|
|
216
|
-
// }
|
|
217
|
-
// });
|
|
218
|
-
// }
|
|
219
|
-
// if (params.priceSpecification !== undefined && params.priceSpecification !== null) {
|
|
220
|
-
// const priceSpecificationPriceGte = params.priceSpecification.price?.$gte;
|
|
221
|
-
// if (typeof priceSpecificationPriceGte === 'number') {
|
|
222
|
-
// andConditions.push({
|
|
223
|
-
// 'priceSpecification.price': {
|
|
224
|
-
// $exists: true,
|
|
225
|
-
// $gte: priceSpecificationPriceGte
|
|
226
|
-
// }
|
|
227
|
-
// });
|
|
228
|
-
// }
|
|
229
|
-
// const priceSpecificationPriceLte = params.priceSpecification.price?.$lte;
|
|
230
|
-
// if (typeof priceSpecificationPriceLte === 'number') {
|
|
231
|
-
// andConditions.push({
|
|
232
|
-
// 'priceSpecification.price': {
|
|
233
|
-
// $exists: true,
|
|
234
|
-
// $lte: priceSpecificationPriceLte
|
|
235
|
-
// }
|
|
236
|
-
// });
|
|
237
|
-
// }
|
|
238
|
-
// const accountsReceivableGte = params.priceSpecification.accounting?.accountsReceivable?.$gte;
|
|
239
|
-
// if (typeof accountsReceivableGte === 'number') {
|
|
240
|
-
// andConditions.push({
|
|
241
|
-
// 'priceSpecification.accounting.accountsReceivable': {
|
|
242
|
-
// $exists: true,
|
|
243
|
-
// $gte: accountsReceivableGte
|
|
244
|
-
// }
|
|
245
|
-
// });
|
|
246
|
-
// }
|
|
247
|
-
// const accountsReceivableLte = params.priceSpecification.accounting?.accountsReceivable?.$lte;
|
|
248
|
-
// if (typeof accountsReceivableLte === 'number') {
|
|
249
|
-
// andConditions.push({
|
|
250
|
-
// 'priceSpecification.accounting.accountsReceivable': {
|
|
251
|
-
// $exists: true,
|
|
252
|
-
// $lte: accountsReceivableLte
|
|
253
|
-
// }
|
|
254
|
-
// });
|
|
255
|
-
// }
|
|
256
|
-
// const accountingCodeValueEq = params.priceSpecification.accounting?.operatingRevenue?.codeValue?.$eq;
|
|
257
|
-
// if (typeof accountingCodeValueEq === 'string') {
|
|
258
|
-
// andConditions.push({
|
|
259
|
-
// 'priceSpecification.accounting.operatingRevenue.codeValue': {
|
|
260
|
-
// $exists: true,
|
|
261
|
-
// $eq: accountingCodeValueEq
|
|
262
|
-
// }
|
|
263
|
-
// });
|
|
264
|
-
// }
|
|
265
|
-
// const accountingCodeValueIn = params.priceSpecification.accounting?.operatingRevenue?.codeValue?.$in;
|
|
266
|
-
// if (Array.isArray(accountingCodeValueIn)) {
|
|
267
|
-
// andConditions.push({
|
|
268
|
-
// 'priceSpecification.accounting.operatingRevenue.codeValue': {
|
|
269
|
-
// $exists: true,
|
|
270
|
-
// $in: accountingCodeValueIn
|
|
271
|
-
// }
|
|
272
|
-
// });
|
|
273
|
-
// }
|
|
274
|
-
// const referenceQuantityValueEq = params.priceSpecification.referenceQuantity?.value?.$eq;
|
|
275
|
-
// if (typeof referenceQuantityValueEq === 'number') {
|
|
276
|
-
// andConditions.push({
|
|
277
|
-
// 'priceSpecification.referenceQuantity.value': {
|
|
278
|
-
// $exists: true,
|
|
279
|
-
// $eq: referenceQuantityValueEq
|
|
280
|
-
// }
|
|
281
|
-
// });
|
|
282
|
-
// }
|
|
283
|
-
// }
|
|
284
|
-
// const availabilityEq = params.availability?.$eq;
|
|
285
|
-
// if (typeof availabilityEq === 'string') {
|
|
286
|
-
// andConditions.push({ availability: { $eq: availabilityEq } });
|
|
287
|
-
// }
|
|
288
|
-
// const availableAtOrFromIdEq = params.availableAtOrFrom?.id?.$eq;
|
|
289
|
-
// if (typeof availableAtOrFromIdEq === 'string') {
|
|
290
|
-
// andConditions.push({
|
|
291
|
-
// 'availableAtOrFrom.id': {
|
|
292
|
-
// $exists: true,
|
|
293
|
-
// $eq: availableAtOrFromIdEq
|
|
294
|
-
// }
|
|
295
|
-
// });
|
|
296
|
-
// }
|
|
297
|
-
// const availableAtOrFromIdIn = params.availableAtOrFrom?.id?.$in;
|
|
298
|
-
// if (Array.isArray(availableAtOrFromIdIn)) {
|
|
299
|
-
// andConditions.push({
|
|
300
|
-
// 'availableAtOrFrom.id': {
|
|
301
|
-
// $exists: true,
|
|
302
|
-
// $in: availableAtOrFromIdIn
|
|
303
|
-
// }
|
|
304
|
-
// });
|
|
305
|
-
// }
|
|
306
|
-
// const addOnItemOfferedIdEq = params.addOn?.itemOffered?.id?.$eq;
|
|
307
|
-
// if (typeof addOnItemOfferedIdEq === 'string') {
|
|
308
|
-
// andConditions.push({
|
|
309
|
-
// 'addOn.itemOffered.id': { $exists: true, $eq: addOnItemOfferedIdEq }
|
|
310
|
-
// });
|
|
311
|
-
// }
|
|
312
|
-
// const addOnItemOfferedIdIn = params.addOn?.itemOffered?.id?.$in;
|
|
313
|
-
// if (Array.isArray(addOnItemOfferedIdIn)) {
|
|
314
|
-
// andConditions.push({
|
|
315
|
-
// 'addOn.itemOffered.id': { $exists: true, $in: addOnItemOfferedIdIn }
|
|
316
|
-
// });
|
|
317
|
-
// }
|
|
318
|
-
// const hasMerchantReturnPolicyIdEq = params.hasMerchantReturnPolicy?.id?.$eq;
|
|
319
|
-
// if (typeof hasMerchantReturnPolicyIdEq === 'string') {
|
|
320
|
-
// andConditions.push({
|
|
321
|
-
// 'hasMerchantReturnPolicy.id': {
|
|
322
|
-
// $exists: true,
|
|
323
|
-
// $eq: hasMerchantReturnPolicyIdEq
|
|
324
|
-
// }
|
|
325
|
-
// });
|
|
326
|
-
// }
|
|
327
|
-
// const additionalPropertyAll = params.additionalProperty?.$all;
|
|
328
|
-
// if (Array.isArray(additionalPropertyAll)) {
|
|
329
|
-
// andConditions.push({
|
|
330
|
-
// additionalProperty: {
|
|
331
|
-
// $exists: true,
|
|
332
|
-
// $all: additionalPropertyAll
|
|
333
|
-
// }
|
|
334
|
-
// });
|
|
335
|
-
// }
|
|
336
|
-
// const additionalPropertyElemMatch = params.additionalProperty?.$elemMatch;
|
|
337
|
-
// if (additionalPropertyElemMatch !== undefined && additionalPropertyElemMatch !== null) {
|
|
338
|
-
// andConditions.push({
|
|
339
|
-
// additionalProperty: {
|
|
340
|
-
// $exists: true,
|
|
341
|
-
// $elemMatch: additionalPropertyElemMatch
|
|
342
|
-
// }
|
|
343
|
-
// });
|
|
344
|
-
// }
|
|
345
|
-
// if (params.onlyValid === true) {
|
|
346
|
-
// const now = new Date();
|
|
347
|
-
// andConditions.push(
|
|
348
|
-
// {
|
|
349
|
-
// $or: [
|
|
350
|
-
// { validFrom: { $exists: false } },
|
|
351
|
-
// { validFrom: { $exists: true, $lte: now } }
|
|
352
|
-
// ]
|
|
353
|
-
// },
|
|
354
|
-
// {
|
|
355
|
-
// $or: [
|
|
356
|
-
// { validThrough: { $exists: false } },
|
|
357
|
-
// { validThrough: { $exists: true, $gte: now } }
|
|
358
|
-
// ]
|
|
359
|
-
// }
|
|
360
|
-
// );
|
|
361
|
-
// }
|
|
362
|
-
// return andConditions;
|
|
363
|
-
// }
|
|
364
|
-
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
365
42
|
static CREATE_AGGREGATE_OFFERS_MATCH_CONDITIONS(params) {
|
|
366
43
|
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, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41;
|
|
367
44
|
const matchStages = [];
|
|
@@ -763,15 +440,46 @@ class MongoRepository {
|
|
|
763
440
|
return projectStage;
|
|
764
441
|
}
|
|
765
442
|
/**
|
|
766
|
-
* カタログID
|
|
443
|
+
* カタログIDで単価オファーを全て検索する
|
|
767
444
|
* 必ずカタログデータから単価オファーIDを参照する
|
|
768
445
|
*/
|
|
769
|
-
|
|
446
|
+
searchAllByOfferCatalogId(params) {
|
|
447
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
448
|
+
const matchStages = [{ $match: { _id: { $eq: params.offerCatalog.id } } }];
|
|
449
|
+
const itemListElements = yield this.offerCatalogModel.aggregate([
|
|
450
|
+
{ $unwind: '$itemListElement' },
|
|
451
|
+
...matchStages,
|
|
452
|
+
{
|
|
453
|
+
$project: {
|
|
454
|
+
_id: 0,
|
|
455
|
+
id: '$itemListElement.id'
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
])
|
|
459
|
+
.exec();
|
|
460
|
+
const sortedOfferIds = (Array.isArray(itemListElements))
|
|
461
|
+
? itemListElements.map((element) => element.id)
|
|
462
|
+
: [];
|
|
463
|
+
let offers = [];
|
|
464
|
+
if (sortedOfferIds.length > 0) {
|
|
465
|
+
const searchOffersConditions = {
|
|
466
|
+
parentOffer: { id: { $in: sortedOfferIds } }
|
|
467
|
+
};
|
|
468
|
+
offers = yield this.search(searchOffersConditions, params.projection);
|
|
469
|
+
}
|
|
470
|
+
return { offers };
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* 単価オファーIDとカタログIDで単価オファーを検索する
|
|
475
|
+
* 必ずカタログデータから単価オファーIDを参照する
|
|
476
|
+
*/
|
|
477
|
+
searchByIdsAndOfferCatalogId(params) {
|
|
770
478
|
var _a;
|
|
771
479
|
return __awaiter(this, void 0, void 0, function* () {
|
|
772
480
|
const unitPriceOfferIds = params.ids;
|
|
773
|
-
let aggregateOfferIds
|
|
774
|
-
if (
|
|
481
|
+
let aggregateOfferIds; // 集計オファーIDでフィルターする場合
|
|
482
|
+
if (Array.isArray(unitPriceOfferIds)) {
|
|
775
483
|
// 解釈を集計オファーIDに変更する必要がある(2023-09-11~)
|
|
776
484
|
// 単価オファーIDリスト→集計オファーIDに変換→カタログ条件にセット
|
|
777
485
|
const searchDistinctAggregateOfferIdsResult = yield this.aggregateOfferModel.distinct('_id', { 'offers.id': { $in: unitPriceOfferIds } })
|
|
@@ -819,7 +527,7 @@ class MongoRepository {
|
|
|
819
527
|
// 明示的なソート指定を調整(決して重複しない属性が相応)(2023-09-07~)
|
|
820
528
|
? { sort: { identifier: factory.sortType.Ascending } }
|
|
821
529
|
: undefined), (typeof params.limit === 'number') ? { limit: params.limit } : undefined), (typeof params.page === 'number') ? { page: params.page } : undefined);
|
|
822
|
-
offers = yield this.search(searchOffersConditions, params.projection
|
|
530
|
+
offers = yield this.search(searchOffersConditions, params.projection);
|
|
823
531
|
}
|
|
824
532
|
return { offers };
|
|
825
533
|
});
|
|
@@ -831,20 +539,23 @@ class MongoRepository {
|
|
|
831
539
|
searchByOfferCatalogIdWithSortIndex(params) {
|
|
832
540
|
var _a;
|
|
833
541
|
return __awaiter(this, void 0, void 0, function* () {
|
|
834
|
-
const unitPriceOfferIds = params.ids;
|
|
835
|
-
let aggregateOfferIds
|
|
836
|
-
if (
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
542
|
+
// const unitPriceOfferIds = params.ids;
|
|
543
|
+
// let aggregateOfferIds: string[] | undefined; // 集計オファーIDでフィルターする場合
|
|
544
|
+
// if (Array.isArray(unitPriceOfferIds)) {
|
|
545
|
+
// // 解釈を集計オファーIDに変更する必要がある(2023-09-11~)
|
|
546
|
+
// // 単価オファーIDリスト→集計オファーIDに変換→カタログ条件にセット
|
|
547
|
+
// const searchDistinctAggregateOfferIdsResult = await this.aggregateOfferModel.distinct<string>(
|
|
548
|
+
// '_id',
|
|
549
|
+
// { 'offers.id': { $in: unitPriceOfferIds } }
|
|
550
|
+
// )
|
|
551
|
+
// .exec();
|
|
552
|
+
// aggregateOfferIds = searchDistinctAggregateOfferIdsResult;
|
|
553
|
+
// }
|
|
843
554
|
// aggregateで再実装(2023-01-26~)
|
|
844
555
|
const matchStages = [{ $match: { _id: { $eq: params.offerCatalog.id } } }];
|
|
845
|
-
if (Array.isArray(aggregateOfferIds)) {
|
|
846
|
-
|
|
847
|
-
}
|
|
556
|
+
// if (Array.isArray(aggregateOfferIds)) {
|
|
557
|
+
// matchStages.push({ $match: { 'itemListElement.id': { $exists: true, $in: aggregateOfferIds } } });
|
|
558
|
+
// }
|
|
848
559
|
const itemListElements = yield this.offerCatalogModel.aggregate([
|
|
849
560
|
{ $unwind: '$itemListElement' },
|
|
850
561
|
...matchStages,
|
|
@@ -861,9 +572,11 @@ class MongoRepository {
|
|
|
861
572
|
: [];
|
|
862
573
|
let offers = [];
|
|
863
574
|
if (sortedOfferIds.length > 0) {
|
|
864
|
-
const searchOffersConditions = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(
|
|
575
|
+
const searchOffersConditions = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({
|
|
865
576
|
// aggregateOffer.idで検索する(2023-09-09~)
|
|
866
|
-
parentOffer:
|
|
577
|
+
parentOffer: Object.assign({}, (params.useIncludeInDataCatalog)
|
|
578
|
+
? { includedInDataCatalog: { id: { $in: [params.offerCatalog.id] } } }
|
|
579
|
+
: { id: { $in: sortedOfferIds } }) }, (typeof ((_a = params.availableAtOrFrom) === null || _a === void 0 ? void 0 : _a.id) === 'string')
|
|
867
580
|
? { availableAtOrFrom: { id: { $eq: params.availableAtOrFrom.id } } }
|
|
868
581
|
: undefined), { priceSpecification: {
|
|
869
582
|
appliesToMovieTicket: Object.assign(Object.assign({}, (Array.isArray(params.unacceptedPaymentMethod) && params.unacceptedPaymentMethod.length > 0)
|
|
@@ -881,28 +594,11 @@ class MongoRepository {
|
|
|
881
594
|
// 明示的なソート指定を調整(決して重複しない属性が相応)(2023-09-07~)
|
|
882
595
|
? { sort: { identifier: factory.sortType.Ascending } }
|
|
883
596
|
: undefined), (typeof params.limit === 'number') ? { limit: params.limit } : undefined), (typeof params.page === 'number') ? { page: params.page } : undefined);
|
|
884
|
-
offers = yield this.search(searchOffersConditions, params.projection
|
|
597
|
+
offers = yield this.search(searchOffersConditions, params.projection);
|
|
885
598
|
}
|
|
886
599
|
return { offers, sortedOfferIds };
|
|
887
600
|
});
|
|
888
601
|
}
|
|
889
|
-
// 不要なので廃止(2023-09-11~)
|
|
890
|
-
// public async findById(params: {
|
|
891
|
-
// project: { id: string };
|
|
892
|
-
// id: string;
|
|
893
|
-
// }): Promise<factory.unitPriceOffer.IUnitPriceOffer> {
|
|
894
|
-
// const offers = await this.search({
|
|
895
|
-
// limit: 1,
|
|
896
|
-
// page: 1,
|
|
897
|
-
// project: { id: { $eq: params.project.id } },
|
|
898
|
-
// id: { $eq: params.id }
|
|
899
|
-
// });
|
|
900
|
-
// const unitPriceOffer = offers.shift();
|
|
901
|
-
// if (unitPriceOffer === undefined) {
|
|
902
|
-
// throw new factory.errors.NotFound(factory.offerType.Offer);
|
|
903
|
-
// }
|
|
904
|
-
// return unitPriceOffer;
|
|
905
|
-
// }
|
|
906
602
|
findAggregateOfferById(params) {
|
|
907
603
|
return __awaiter(this, void 0, void 0, function* () {
|
|
908
604
|
const doc = yield this.aggregateOfferModel.findOne({
|
|
@@ -922,180 +618,72 @@ class MongoRepository {
|
|
|
922
618
|
}
|
|
923
619
|
count(params) {
|
|
924
620
|
return __awaiter(this, void 0, void 0, function* () {
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
.exec();
|
|
938
|
-
return offerCount;
|
|
939
|
-
}
|
|
940
|
-
else {
|
|
941
|
-
throw new factory.errors.NotImplemented('useOffersAsPrimary prohibited');
|
|
942
|
-
// const conditions = MongoRepository.CREATE_OFFER_MONGO_CONDITIONS(params);
|
|
943
|
-
// return this.offerModel.countDocuments((conditions.length > 0) ? { $and: conditions } : {})
|
|
944
|
-
// .setOptions({ maxTimeMS: MONGO_MAX_TIME_MS })
|
|
945
|
-
// .exec();
|
|
946
|
-
}
|
|
621
|
+
const matchStages = MongoRepository.CREATE_AGGREGATE_OFFERS_MATCH_CONDITIONS(params);
|
|
622
|
+
const [{ offerCount }] = yield this.aggregateOfferModel.aggregate([
|
|
623
|
+
{
|
|
624
|
+
$unwind: { path: '$offers' }
|
|
625
|
+
},
|
|
626
|
+
...matchStages,
|
|
627
|
+
{
|
|
628
|
+
$count: 'offerCount'
|
|
629
|
+
}
|
|
630
|
+
])
|
|
631
|
+
.exec();
|
|
632
|
+
return offerCount;
|
|
947
633
|
});
|
|
948
634
|
}
|
|
949
|
-
search(params, projection
|
|
950
|
-
/**
|
|
951
|
-
* 強制的にoffersコレクションを使用する
|
|
952
|
-
*/
|
|
953
|
-
useOffersAsPrimary) {
|
|
635
|
+
search(params, projection) {
|
|
954
636
|
return __awaiter(this, void 0, void 0, function* () {
|
|
955
|
-
|
|
956
|
-
const useAggregateOfferAsPrimary = settings_1.USE_AGGREGATE_OFFERS_AS_PRIMARY && (useOffersAsPrimary !== true);
|
|
957
|
-
if (useAggregateOfferAsPrimary) {
|
|
958
|
-
return this.searchFromAggregateOffer(params, projection);
|
|
959
|
-
}
|
|
960
|
-
// useOffersAsPrimary禁止設定(2023-09-09~)
|
|
961
|
-
if (settings_1.USE_PROHIBIT_OFFERS_AS_PRIMARY) {
|
|
962
|
-
throw new factory.errors.NotImplemented('useOffersAsPrimary prohibited');
|
|
963
|
-
}
|
|
964
|
-
throw new factory.errors.NotImplemented('useOffersAsPrimary prohibited');
|
|
965
|
-
// const conditions = MongoRepository.CREATE_OFFER_MONGO_CONDITIONS(params);
|
|
966
|
-
// const positiveProjectionExists: boolean = (projection !== undefined && projection !== null)
|
|
967
|
-
// ? Object.values(projection)
|
|
968
|
-
// .some((value) => value !== 0)
|
|
969
|
-
// : false;
|
|
970
|
-
// const query = this.offerModel.find<Document<string, factory.unitPriceOffer.IUnitPriceOffer>>(
|
|
971
|
-
// (conditions.length > 0) ? { $and: conditions } : {},
|
|
972
|
-
// (positiveProjectionExists)
|
|
973
|
-
// ? projection
|
|
974
|
-
// : {
|
|
975
|
-
// ...projection,
|
|
976
|
-
// __v: 0,
|
|
977
|
-
// createdAt: 0,
|
|
978
|
-
// updatedAt: 0,
|
|
979
|
-
// availableAddOn: 0 // 廃止属性の残存が確認されたので(2023-09-04~)
|
|
980
|
-
// }
|
|
981
|
-
// );
|
|
982
|
-
// if (typeof params.limit === 'number' && params.limit > 0) {
|
|
983
|
-
// const page: number = (typeof params.page === 'number' && params.page > 0) ? params.page : 1;
|
|
984
|
-
// query.limit(params.limit)
|
|
985
|
-
// .skip(params.limit * (page - 1));
|
|
986
|
-
// }
|
|
987
|
-
// const sortByPrice = params.sort?.['priceSpecification.price'];
|
|
988
|
-
// const sortByIdentifier = params.sort?.identifier;
|
|
989
|
-
// if (typeof sortByPrice === 'number' || typeof sortByIdentifier === 'number') {
|
|
990
|
-
// query.sort({
|
|
991
|
-
// ...(typeof sortByPrice === 'number')
|
|
992
|
-
// ? { 'priceSpecification.price': sortByPrice }
|
|
993
|
-
// : undefined,
|
|
994
|
-
// ...(typeof sortByIdentifier === 'number')
|
|
995
|
-
// ? { identifier: sortByIdentifier }
|
|
996
|
-
// : undefined
|
|
997
|
-
// });
|
|
998
|
-
// }
|
|
999
|
-
// return query.setOptions({ maxTimeMS: MONGO_MAX_TIME_MS })
|
|
1000
|
-
// .exec()
|
|
1001
|
-
// .then((docs) => docs.map((doc) => doc.toObject()));
|
|
637
|
+
return this.searchFromAggregateOffer(params, projection);
|
|
1002
638
|
});
|
|
1003
639
|
}
|
|
1004
640
|
// tslint:disable-next-line:max-func-body-length
|
|
1005
641
|
save(params) {
|
|
1006
642
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1007
643
|
let doc;
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
};
|
|
1020
|
-
doc = yield this.aggregateOfferModel.create(Object.assign(Object.assign({}, aggregateOffer), { _id: id }));
|
|
1021
|
-
}
|
|
1022
|
-
else {
|
|
1023
|
-
const unitPriceOffers = yield this.searchFromAggregateOffer({
|
|
1024
|
-
limit: 1,
|
|
1025
|
-
page: 1,
|
|
1026
|
-
project: { id: { $eq: params.project.id } },
|
|
1027
|
-
id: { $eq: params.id }
|
|
1028
|
-
}, { id: 1, identifier: 1, project: 1, typeOf: 1 });
|
|
1029
|
-
const originalUnitPriceOffer = unitPriceOffers.shift();
|
|
1030
|
-
if (originalUnitPriceOffer === undefined) {
|
|
1031
|
-
throw new factory.errors.NotFound(factory.offerType.Offer);
|
|
1032
|
-
}
|
|
1033
|
-
// 上書き禁止属性を除外
|
|
1034
|
-
const { id, identifier, project, typeOf } = paramsWithoutUnset, updateFields = __rest(paramsWithoutUnset, ["id", "identifier", "project", "typeOf"]);
|
|
1035
|
-
savedUnitPriceOffer = Object.assign(Object.assign({}, updateFields), { id: originalUnitPriceOffer.id, identifier: originalUnitPriceOffer.identifier, project: originalUnitPriceOffer.project, typeOf: originalUnitPriceOffer.typeOf });
|
|
1036
|
-
doc = yield this.aggregateOfferModel.findOneAndUpdate({ 'offers.id': params.id }, {
|
|
1037
|
-
$set: {
|
|
1038
|
-
'offers.$[offer]': savedUnitPriceOffer
|
|
1039
|
-
}
|
|
1040
|
-
}, {
|
|
1041
|
-
upsert: false,
|
|
1042
|
-
new: true,
|
|
1043
|
-
arrayFilters: [
|
|
1044
|
-
{ 'offer.id': { $eq: params.id } }
|
|
1045
|
-
]
|
|
1046
|
-
})
|
|
1047
|
-
.exec();
|
|
1048
|
-
}
|
|
1049
|
-
if (doc === null) {
|
|
1050
|
-
throw new factory.errors.NotFound(this.aggregateOfferModel.modelName);
|
|
1051
|
-
}
|
|
1052
|
-
// 同期タスク作成(2023-09-05~)
|
|
1053
|
-
if (typeof savedUnitPriceOffer.id === 'string') {
|
|
1054
|
-
yield this.saveSyncTask({
|
|
1055
|
-
project: { id: savedUnitPriceOffer.project.id },
|
|
1056
|
-
id: { $in: [savedUnitPriceOffer.id] },
|
|
1057
|
-
identifier: { $in: [] },
|
|
1058
|
-
isDeleted: false,
|
|
1059
|
-
typeOf: factory.offerType.AggregateOffer,
|
|
1060
|
-
options: { emitImmediately: true }
|
|
1061
|
-
});
|
|
1062
|
-
}
|
|
1063
|
-
return savedUnitPriceOffer;
|
|
644
|
+
const { $unset } = params, paramsWithoutUnset = __rest(params, ["$unset"]);
|
|
645
|
+
let savedUnitPriceOffer;
|
|
646
|
+
if (params.id === '') {
|
|
647
|
+
const id = uniqid();
|
|
648
|
+
savedUnitPriceOffer = Object.assign(Object.assign({}, paramsWithoutUnset), { id });
|
|
649
|
+
const aggregateOffer = {
|
|
650
|
+
typeOf: factory.offerType.AggregateOffer,
|
|
651
|
+
project: params.project,
|
|
652
|
+
offers: [savedUnitPriceOffer]
|
|
653
|
+
};
|
|
654
|
+
doc = yield this.aggregateOfferModel.create(Object.assign(Object.assign({}, aggregateOffer), { _id: id }));
|
|
1064
655
|
}
|
|
1065
656
|
else {
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
//
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
// options: { emitImmediately: true }
|
|
1095
|
-
// });
|
|
1096
|
-
// }
|
|
1097
|
-
// return doc.toObject();
|
|
657
|
+
const unitPriceOffers = yield this.searchFromAggregateOffer({
|
|
658
|
+
limit: 1,
|
|
659
|
+
page: 1,
|
|
660
|
+
project: { id: { $eq: params.project.id } },
|
|
661
|
+
id: { $eq: params.id }
|
|
662
|
+
}, { id: 1, identifier: 1, project: 1, typeOf: 1 });
|
|
663
|
+
const originalUnitPriceOffer = unitPriceOffers.shift();
|
|
664
|
+
if (originalUnitPriceOffer === undefined) {
|
|
665
|
+
throw new factory.errors.NotFound(factory.offerType.Offer);
|
|
666
|
+
}
|
|
667
|
+
// 上書き禁止属性を除外
|
|
668
|
+
const { id, identifier, project, typeOf } = paramsWithoutUnset, updateFields = __rest(paramsWithoutUnset, ["id", "identifier", "project", "typeOf"]);
|
|
669
|
+
savedUnitPriceOffer = Object.assign(Object.assign({}, updateFields), { id: originalUnitPriceOffer.id, identifier: originalUnitPriceOffer.identifier, project: originalUnitPriceOffer.project, typeOf: originalUnitPriceOffer.typeOf });
|
|
670
|
+
doc = yield this.aggregateOfferModel.findOneAndUpdate({ 'offers.id': params.id }, {
|
|
671
|
+
$set: {
|
|
672
|
+
'offers.$[offer]': savedUnitPriceOffer
|
|
673
|
+
}
|
|
674
|
+
}, {
|
|
675
|
+
upsert: false,
|
|
676
|
+
new: true,
|
|
677
|
+
arrayFilters: [
|
|
678
|
+
{ 'offer.id': { $eq: params.id } }
|
|
679
|
+
]
|
|
680
|
+
})
|
|
681
|
+
.exec();
|
|
682
|
+
}
|
|
683
|
+
if (doc === null) {
|
|
684
|
+
throw new factory.errors.NotFound(this.aggregateOfferModel.modelName);
|
|
1098
685
|
}
|
|
686
|
+
return savedUnitPriceOffer;
|
|
1099
687
|
});
|
|
1100
688
|
}
|
|
1101
689
|
/**
|
|
@@ -1104,109 +692,52 @@ class MongoRepository {
|
|
|
1104
692
|
// tslint:disable-next-line:max-func-body-length
|
|
1105
693
|
saveManyByIdentifier(params) {
|
|
1106
694
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
const aggregateOffer = {
|
|
1116
|
-
project: p.attributes.project,
|
|
1117
|
-
typeOf: factory.offerType.AggregateOffer,
|
|
1118
|
-
offers: [unitPriceOffer]
|
|
1119
|
-
};
|
|
1120
|
-
insertBulkWriteOps.push({
|
|
1121
|
-
updateOne: {
|
|
1122
|
-
filter: {
|
|
1123
|
-
'project.id': { $eq: p.attributes.project.id },
|
|
1124
|
-
'offers.identifier': { $exists: true, $eq: p.attributes.identifier }
|
|
1125
|
-
},
|
|
1126
|
-
update: {
|
|
1127
|
-
$setOnInsert: Object.assign(Object.assign({}, aggregateOffer), { _id: newOfferId })
|
|
1128
|
-
},
|
|
1129
|
-
upsert: true
|
|
1130
|
-
}
|
|
1131
|
-
});
|
|
1132
|
-
const { id } = unitPriceOffer, $set = __rest(unitPriceOffer, ["id"]);
|
|
1133
|
-
updateBulkWriteOps.push({
|
|
1134
|
-
updateOne: {
|
|
1135
|
-
filter: {
|
|
1136
|
-
'project.id': { $eq: unitPriceOffer.project.id },
|
|
1137
|
-
'offers.identifier': { $exists: true, $eq: unitPriceOffer.identifier }
|
|
1138
|
-
},
|
|
1139
|
-
update: {
|
|
1140
|
-
// 特定の属性のみ更新する(IDを上書きできないので)
|
|
1141
|
-
$set: Object.assign(Object.assign({ 'offers.0.name': $set.name, 'offers.0.description': $set.description, 'offers.0.alternateName': $set.alternateName, 'offers.0.priceSpecification': $set.priceSpecification, 'offers.0.additionalProperty': $set.additionalProperty }, (Array.isArray($set.eligibleMembershipType))
|
|
1142
|
-
? { 'offers.0.eligibleMembershipType': $set.eligibleMembershipType }
|
|
1143
|
-
: undefined), (Array.isArray($set.eligibleMonetaryAmount))
|
|
1144
|
-
? { 'offers.0.eligibleMonetaryAmount': $set.eligibleMonetaryAmount }
|
|
1145
|
-
: undefined)
|
|
1146
|
-
},
|
|
1147
|
-
upsert: false
|
|
1148
|
-
}
|
|
1149
|
-
});
|
|
1150
|
-
});
|
|
1151
|
-
}
|
|
1152
|
-
if (insertBulkWriteOps.length > 0) {
|
|
1153
|
-
yield this.aggregateOfferModel.bulkWrite(insertBulkWriteOps, { ordered: false });
|
|
1154
|
-
yield this.aggregateOfferModel.bulkWrite(updateBulkWriteOps, { ordered: false });
|
|
1155
|
-
// 同期タスク作成(2023-09-03~)
|
|
1156
|
-
yield this.saveSyncTask({
|
|
1157
|
-
project: { id: params[0].attributes.project.id },
|
|
1158
|
-
id: { $in: [] },
|
|
1159
|
-
identifier: { $in: params.map((savingOffer) => savingOffer.attributes.identifier) },
|
|
1160
|
-
isDeleted: false,
|
|
695
|
+
const insertBulkWriteOps = [];
|
|
696
|
+
const updateBulkWriteOps = [];
|
|
697
|
+
if (Array.isArray(params)) {
|
|
698
|
+
params.forEach((p) => {
|
|
699
|
+
const newOfferId = uniqid();
|
|
700
|
+
const unitPriceOffer = Object.assign(Object.assign({}, p.attributes), { id: newOfferId });
|
|
701
|
+
const aggregateOffer = {
|
|
702
|
+
project: p.attributes.project,
|
|
1161
703
|
typeOf: factory.offerType.AggregateOffer,
|
|
1162
|
-
|
|
704
|
+
offers: [unitPriceOffer]
|
|
705
|
+
};
|
|
706
|
+
insertBulkWriteOps.push({
|
|
707
|
+
updateOne: {
|
|
708
|
+
filter: {
|
|
709
|
+
'project.id': { $eq: p.attributes.project.id },
|
|
710
|
+
'offers.identifier': { $exists: true, $eq: p.attributes.identifier }
|
|
711
|
+
},
|
|
712
|
+
update: {
|
|
713
|
+
$setOnInsert: Object.assign(Object.assign({}, aggregateOffer), { _id: newOfferId })
|
|
714
|
+
},
|
|
715
|
+
upsert: true
|
|
716
|
+
}
|
|
1163
717
|
});
|
|
1164
|
-
|
|
718
|
+
const { id } = unitPriceOffer, $set = __rest(unitPriceOffer, ["id"]);
|
|
719
|
+
updateBulkWriteOps.push({
|
|
720
|
+
updateOne: {
|
|
721
|
+
filter: {
|
|
722
|
+
'project.id': { $eq: unitPriceOffer.project.id },
|
|
723
|
+
'offers.identifier': { $exists: true, $eq: unitPriceOffer.identifier }
|
|
724
|
+
},
|
|
725
|
+
update: {
|
|
726
|
+
// 特定の属性のみ更新する(IDを上書きできないので)
|
|
727
|
+
$set: Object.assign(Object.assign({ 'offers.0.name': $set.name, 'offers.0.description': $set.description, 'offers.0.alternateName': $set.alternateName, 'offers.0.priceSpecification': $set.priceSpecification, 'offers.0.additionalProperty': $set.additionalProperty }, (Array.isArray($set.eligibleMembershipType))
|
|
728
|
+
? { 'offers.0.eligibleMembershipType': $set.eligibleMembershipType }
|
|
729
|
+
: undefined), (Array.isArray($set.eligibleMonetaryAmount))
|
|
730
|
+
? { 'offers.0.eligibleMonetaryAmount': $set.eligibleMonetaryAmount }
|
|
731
|
+
: undefined)
|
|
732
|
+
},
|
|
733
|
+
upsert: false
|
|
734
|
+
}
|
|
735
|
+
});
|
|
736
|
+
});
|
|
1165
737
|
}
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
// if (Array.isArray(params)) {
|
|
1170
|
-
// params.forEach((p) => {
|
|
1171
|
-
// const id = uniqid();
|
|
1172
|
-
// const $set = { ...p.attributes };
|
|
1173
|
-
// if (typeof $set.id === 'string') {
|
|
1174
|
-
// delete $set.id;
|
|
1175
|
-
// }
|
|
1176
|
-
// bulkWriteOps.push({
|
|
1177
|
-
// updateOne: {
|
|
1178
|
-
// filter: {
|
|
1179
|
-
// 'project.id': {
|
|
1180
|
-
// $eq: p.attributes.project.id
|
|
1181
|
-
// },
|
|
1182
|
-
// identifier: {
|
|
1183
|
-
// $exists: true,
|
|
1184
|
-
// $eq: p.attributes.identifier
|
|
1185
|
-
// }
|
|
1186
|
-
// },
|
|
1187
|
-
// update: {
|
|
1188
|
-
// $set: $set,
|
|
1189
|
-
// $setOnInsert: {
|
|
1190
|
-
// _id: id
|
|
1191
|
-
// }
|
|
1192
|
-
// },
|
|
1193
|
-
// upsert: (p.upsert !== undefined) ? p.upsert : false
|
|
1194
|
-
// }
|
|
1195
|
-
// });
|
|
1196
|
-
// });
|
|
1197
|
-
// }
|
|
1198
|
-
// if (bulkWriteOps.length > 0) {
|
|
1199
|
-
// await this.offerModel.bulkWrite(bulkWriteOps, { ordered: false });
|
|
1200
|
-
// // 同期タスク作成(2023-09-03~)
|
|
1201
|
-
// await this.saveSyncTask({
|
|
1202
|
-
// project: { id: params[0].attributes.project.id },
|
|
1203
|
-
// id: { $in: [] },
|
|
1204
|
-
// identifier: { $in: params.map((savingOffer) => savingOffer.attributes.identifier) },
|
|
1205
|
-
// isDeleted: false,
|
|
1206
|
-
// typeOf: factory.offerType.Offer,
|
|
1207
|
-
// options: { emitImmediately: true }
|
|
1208
|
-
// });
|
|
1209
|
-
// }
|
|
738
|
+
if (insertBulkWriteOps.length > 0) {
|
|
739
|
+
yield this.aggregateOfferModel.bulkWrite(insertBulkWriteOps, { ordered: false });
|
|
740
|
+
yield this.aggregateOfferModel.bulkWrite(updateBulkWriteOps, { ordered: false });
|
|
1210
741
|
}
|
|
1211
742
|
});
|
|
1212
743
|
}
|
|
@@ -1218,341 +749,48 @@ class MongoRepository {
|
|
|
1218
749
|
if (params.addOn.itemOffered.id.$in.length === 0) {
|
|
1219
750
|
return;
|
|
1220
751
|
}
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
}
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
'offers.$[offer].addOn': {
|
|
1234
|
-
'itemOffered.id': { $in: params.addOn.itemOffered.id.$in }
|
|
1235
|
-
}
|
|
752
|
+
const conditions = {
|
|
753
|
+
'project.id': { $eq: params.project.id },
|
|
754
|
+
'offers.addOn.itemOffered.id': { $exists: true, $in: params.addOn.itemOffered.id.$in }
|
|
755
|
+
};
|
|
756
|
+
const updatingOffers = yield this.searchFromAggregateOffer({
|
|
757
|
+
project: { id: { $eq: params.project.id } },
|
|
758
|
+
addOn: { itemOffered: { id: { $in: params.addOn.itemOffered.id.$in } } }
|
|
759
|
+
}, { id: 1 });
|
|
760
|
+
const result = yield this.aggregateOfferModel.updateMany(conditions, {
|
|
761
|
+
$pull: {
|
|
762
|
+
'offers.$[offer].addOn': {
|
|
763
|
+
'itemOffered.id': { $in: params.addOn.itemOffered.id.$in }
|
|
1236
764
|
}
|
|
1237
|
-
}, {
|
|
1238
|
-
arrayFilters: [
|
|
1239
|
-
{ 'offer.addOn.itemOffered.id': { $exists: true, $in: params.addOn.itemOffered.id.$in } }
|
|
1240
|
-
]
|
|
1241
|
-
})
|
|
1242
|
-
.exec();
|
|
1243
|
-
// 同期タスク作成(2023-09-05~)
|
|
1244
|
-
if (updatingOffers.length > 0) {
|
|
1245
|
-
yield this.saveSyncTask({
|
|
1246
|
-
project: { id: params.project.id },
|
|
1247
|
-
id: { $in: updatingOffers.map((offer) => String(offer.id)) },
|
|
1248
|
-
identifier: { $in: [] },
|
|
1249
|
-
isDeleted: false,
|
|
1250
|
-
typeOf: factory.offerType.AggregateOffer,
|
|
1251
|
-
options: { emitImmediately: true }
|
|
1252
|
-
});
|
|
1253
765
|
}
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
//
|
|
1262
|
-
// const updatingOffers = await this.offerModel.find<Document<string>>(conditions, { _id: 1 })
|
|
1263
|
-
// .exec()
|
|
1264
|
-
// .then((docs) => docs.map((doc) => doc.toObject<{ id: string }>()));
|
|
1265
|
-
// const result = await this.offerModel.updateMany(
|
|
1266
|
-
// conditions,
|
|
1267
|
-
// {
|
|
1268
|
-
// $pull: {
|
|
1269
|
-
// addOn: {
|
|
1270
|
-
// 'itemOffered.id': { $in: params.addOn.itemOffered.id.$in }
|
|
1271
|
-
// }
|
|
1272
|
-
// }
|
|
1273
|
-
// }
|
|
1274
|
-
// )
|
|
1275
|
-
// .exec();
|
|
1276
|
-
// // 同期タスク作成(2023-09-03~)
|
|
1277
|
-
// if (updatingOffers.length > 0) {
|
|
1278
|
-
// await this.saveSyncTask({
|
|
1279
|
-
// project: { id: params.project.id },
|
|
1280
|
-
// id: { $in: updatingOffers.map((offer) => offer.id) },
|
|
1281
|
-
// identifier: { $in: [] },
|
|
1282
|
-
// isDeleted: false,
|
|
1283
|
-
// typeOf: factory.offerType.Offer,
|
|
1284
|
-
// options: { emitImmediately: true }
|
|
1285
|
-
// });
|
|
1286
|
-
// }
|
|
1287
|
-
// return result;
|
|
766
|
+
}, {
|
|
767
|
+
arrayFilters: [
|
|
768
|
+
{ 'offer.addOn.itemOffered.id': { $exists: true, $in: params.addOn.itemOffered.id.$in } }
|
|
769
|
+
]
|
|
770
|
+
})
|
|
771
|
+
.exec();
|
|
772
|
+
if (updatingOffers.length > 0) {
|
|
773
|
+
// no op
|
|
1288
774
|
}
|
|
775
|
+
return result;
|
|
1289
776
|
});
|
|
1290
777
|
}
|
|
1291
778
|
deleteById(params) {
|
|
1292
779
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
yield this.aggregateOfferModel.findOneAndRemove({ _id: { $eq: params.id } }, { projection: { _id: 1 } })
|
|
1296
|
-
.exec();
|
|
1297
|
-
// 同期タスク作成(2023-09-03~)
|
|
1298
|
-
yield this.saveSyncTask({
|
|
1299
|
-
project: { id: params.project.id },
|
|
1300
|
-
id: { $in: [params.id] },
|
|
1301
|
-
identifier: { $in: [] },
|
|
1302
|
-
isDeleted: true,
|
|
1303
|
-
typeOf: factory.offerType.AggregateOffer,
|
|
1304
|
-
options: { emitImmediately: true }
|
|
1305
|
-
});
|
|
1306
|
-
}
|
|
1307
|
-
else {
|
|
1308
|
-
throw new factory.errors.NotImplemented('useOffersAsPrimary prohibited');
|
|
1309
|
-
// await this.offerModel.findOneAndRemove(
|
|
1310
|
-
// { _id: { $eq: params.id } },
|
|
1311
|
-
// { projection: { _id: 1 } }
|
|
1312
|
-
// )
|
|
1313
|
-
// .exec();
|
|
1314
|
-
// // 同期タスク作成(2023-09-03~)
|
|
1315
|
-
// await this.saveSyncTask({
|
|
1316
|
-
// project: { id: params.project.id },
|
|
1317
|
-
// id: { $in: [params.id] },
|
|
1318
|
-
// identifier: { $in: [] },
|
|
1319
|
-
// isDeleted: true,
|
|
1320
|
-
// typeOf: factory.offerType.Offer,
|
|
1321
|
-
// options: { emitImmediately: true }
|
|
1322
|
-
// });
|
|
1323
|
-
}
|
|
780
|
+
yield this.aggregateOfferModel.findOneAndRemove({ _id: { $eq: params.id } }, { projection: { _id: 1 } })
|
|
781
|
+
.exec();
|
|
1324
782
|
});
|
|
1325
783
|
}
|
|
1326
|
-
// public async deleteByProject(params: {
|
|
1327
|
-
// project: { id: string };
|
|
1328
|
-
// }): Promise<void> {
|
|
1329
|
-
// await this.offerModel.deleteMany({
|
|
1330
|
-
// 'project.id': { $eq: params.project.id }
|
|
1331
|
-
// })
|
|
1332
|
-
// .exec();
|
|
1333
|
-
// }
|
|
1334
|
-
// public getCursor(conditions: any, projection: any) {
|
|
1335
|
-
// return this.offerModel.find(conditions, projection)
|
|
1336
|
-
// .sort({ 'priceSpecification.price': factory.sortType.Descending })
|
|
1337
|
-
// .cursor();
|
|
1338
|
-
// }
|
|
1339
|
-
// public async unsetUnnecessaryFields(params: {
|
|
1340
|
-
// filter: any;
|
|
1341
|
-
// $unset: any;
|
|
1342
|
-
// }) {
|
|
1343
|
-
// return this.offerModel.updateMany(
|
|
1344
|
-
// params.filter,
|
|
1345
|
-
// { $unset: params.$unset }
|
|
1346
|
-
// )
|
|
1347
|
-
// .exec();
|
|
1348
|
-
// }
|
|
1349
784
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length prefer-function-over-method
|
|
1350
785
|
sync2aggregateOffer(params) {
|
|
1351
786
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1352
787
|
if (params.typeOf === factory.offerType.Offer) {
|
|
1353
|
-
|
|
1354
|
-
// const idIn = params.id?.$in;
|
|
1355
|
-
// const identifierIn = params.identifier?.$in;
|
|
1356
|
-
// if (params.isDeleted === true) {
|
|
1357
|
-
// if (Array.isArray(idIn) && idIn.length > 0) {
|
|
1358
|
-
// await this.aggregateOfferModel.deleteMany({
|
|
1359
|
-
// 'project.id': { $eq: params.project.id },
|
|
1360
|
-
// _id: { $in: idIn }
|
|
1361
|
-
// })
|
|
1362
|
-
// .exec();
|
|
1363
|
-
// }
|
|
1364
|
-
// // コードで削除することは現状ない
|
|
1365
|
-
// } else {
|
|
1366
|
-
// let unitPriceOffers: (factory.unitPriceOffer.IUnitPriceOffer & { _id: string })[] = [];
|
|
1367
|
-
// if (Array.isArray(idIn) && idIn.length > 0) {
|
|
1368
|
-
// unitPriceOffers = await this.offerModel.find<Document<string, factory.unitPriceOffer.IUnitPriceOffer>>(
|
|
1369
|
-
// {
|
|
1370
|
-
// 'project.id': { $eq: params.project.id },
|
|
1371
|
-
// _id: { $in: idIn }
|
|
1372
|
-
// },
|
|
1373
|
-
// {
|
|
1374
|
-
// __v: 0,
|
|
1375
|
-
// createdAt: 0,
|
|
1376
|
-
// updatedAt: 0,
|
|
1377
|
-
// offers: 0,
|
|
1378
|
-
// availableAddOn: 0 // 廃止属性の残存が確認されたので(2023-09-04~)
|
|
1379
|
-
// }
|
|
1380
|
-
// )
|
|
1381
|
-
// .exec()
|
|
1382
|
-
// .then((docs) => docs.map((doc) => doc.toObject()));
|
|
1383
|
-
// }
|
|
1384
|
-
// if (Array.isArray(identifierIn) && identifierIn.length > 0) {
|
|
1385
|
-
// unitPriceOffers = await this.offerModel.find<Document<string, factory.unitPriceOffer.IUnitPriceOffer>>(
|
|
1386
|
-
// {
|
|
1387
|
-
// 'project.id': { $eq: params.project.id },
|
|
1388
|
-
// identifier: { $exists: true, $in: identifierIn }
|
|
1389
|
-
// },
|
|
1390
|
-
// {
|
|
1391
|
-
// __v: 0,
|
|
1392
|
-
// createdAt: 0,
|
|
1393
|
-
// updatedAt: 0,
|
|
1394
|
-
// offers: 0,
|
|
1395
|
-
// availableAddOn: 0 // 廃止属性の残存が確認されたので(2023-09-04~)
|
|
1396
|
-
// }
|
|
1397
|
-
// )
|
|
1398
|
-
// .exec()
|
|
1399
|
-
// .then((docs) => docs.map((doc) => doc.toObject()));
|
|
1400
|
-
// }
|
|
1401
|
-
// const bulkWriteOps: AnyBulkWriteOperation<factory.aggregateOffer.IAggregateOffer & { _id: string }>[] = [];
|
|
1402
|
-
// if (unitPriceOffers.length > 0) {
|
|
1403
|
-
// unitPriceOffers.forEach((unitPriceOffer) => {
|
|
1404
|
-
// const { _id, ...settingUnitPriceOffer } = unitPriceOffer;
|
|
1405
|
-
// const $set: factory.aggregateOffer.IAggregateOffer = {
|
|
1406
|
-
// project: unitPriceOffer.project,
|
|
1407
|
-
// typeOf: factory.offerType.AggregateOffer,
|
|
1408
|
-
// offers: [settingUnitPriceOffer]
|
|
1409
|
-
// };
|
|
1410
|
-
// bulkWriteOps.push({
|
|
1411
|
-
// updateOne: {
|
|
1412
|
-
// filter: {
|
|
1413
|
-
// 'project.id': { $eq: unitPriceOffer.project.id },
|
|
1414
|
-
// _id: { $eq: unitPriceOffer.id }
|
|
1415
|
-
// },
|
|
1416
|
-
// update: {
|
|
1417
|
-
// $set,
|
|
1418
|
-
// $setOnInsert: { _id: unitPriceOffer.id }
|
|
1419
|
-
// },
|
|
1420
|
-
// upsert: true
|
|
1421
|
-
// }
|
|
1422
|
-
// });
|
|
1423
|
-
// });
|
|
1424
|
-
// }
|
|
1425
|
-
// if (bulkWriteOps.length > 0) {
|
|
1426
|
-
// return this.aggregateOfferModel.bulkWrite(bulkWriteOps, { ordered: false });
|
|
1427
|
-
// }
|
|
1428
|
-
// }
|
|
788
|
+
// no op
|
|
1429
789
|
}
|
|
1430
790
|
else if (params.typeOf === factory.offerType.AggregateOffer) {
|
|
1431
791
|
// no op
|
|
1432
792
|
return;
|
|
1433
|
-
// USE_AGGREGATE_OFFERS_AS_PRIMARY対応(2023-09-05~)
|
|
1434
|
-
// const idIn = params.id?.$in;
|
|
1435
|
-
// const identifierIn = params.identifier?.$in;
|
|
1436
|
-
// if (params.isDeleted === true) {
|
|
1437
|
-
// if (Array.isArray(idIn) && idIn.length > 0) {
|
|
1438
|
-
// await this.offerModel.deleteMany({
|
|
1439
|
-
// 'project.id': { $eq: params.project.id },
|
|
1440
|
-
// _id: { $in: idIn }
|
|
1441
|
-
// })
|
|
1442
|
-
// .exec();
|
|
1443
|
-
// }
|
|
1444
|
-
// } else {
|
|
1445
|
-
// let aggregateOffers: { offer: factory.unitPriceOffer.IUnitPriceOffer }[] = [];
|
|
1446
|
-
// if (Array.isArray(idIn) && idIn.length > 0) {
|
|
1447
|
-
// aggregateOffers = await this.aggregateOfferModel.aggregate<{ offer: factory.unitPriceOffer.IUnitPriceOffer }>([
|
|
1448
|
-
// {
|
|
1449
|
-
// $unwind: {
|
|
1450
|
-
// path: '$offers'
|
|
1451
|
-
// }
|
|
1452
|
-
// },
|
|
1453
|
-
// {
|
|
1454
|
-
// $match: {
|
|
1455
|
-
// 'project.id': { $eq: params.project.id },
|
|
1456
|
-
// 'offers.id': { $in: idIn }
|
|
1457
|
-
// }
|
|
1458
|
-
// },
|
|
1459
|
-
// {
|
|
1460
|
-
// $project: {
|
|
1461
|
-
// _id: 0,
|
|
1462
|
-
// offer: '$offers'
|
|
1463
|
-
// }
|
|
1464
|
-
// }
|
|
1465
|
-
// ])
|
|
1466
|
-
// .exec();
|
|
1467
|
-
// }
|
|
1468
|
-
// if (Array.isArray(identifierIn) && identifierIn.length > 0) {
|
|
1469
|
-
// aggregateOffers = await this.aggregateOfferModel.aggregate<{ offer: factory.unitPriceOffer.IUnitPriceOffer }>([
|
|
1470
|
-
// {
|
|
1471
|
-
// $unwind: {
|
|
1472
|
-
// path: '$offers'
|
|
1473
|
-
// }
|
|
1474
|
-
// },
|
|
1475
|
-
// {
|
|
1476
|
-
// $match: {
|
|
1477
|
-
// 'project.id': { $eq: params.project.id },
|
|
1478
|
-
// 'offers.identifier': { $exists: true, $in: identifierIn }
|
|
1479
|
-
// }
|
|
1480
|
-
// },
|
|
1481
|
-
// {
|
|
1482
|
-
// $project: {
|
|
1483
|
-
// _id: 0,
|
|
1484
|
-
// offer: '$offers'
|
|
1485
|
-
// }
|
|
1486
|
-
// }
|
|
1487
|
-
// ])
|
|
1488
|
-
// .exec();
|
|
1489
|
-
// }
|
|
1490
|
-
// const bulkWriteOps: AnyBulkWriteOperation<factory.unitPriceOffer.IUnitPriceOffer & { _id: string }>[] = [];
|
|
1491
|
-
// if (aggregateOffers.length > 0) {
|
|
1492
|
-
// aggregateOffers.forEach((aggregateOffer) => {
|
|
1493
|
-
// const savingUnitPriceOffer: factory.unitPriceOffer.IUnitPriceOffer & { _id: string } = {
|
|
1494
|
-
// ...aggregateOffer.offer,
|
|
1495
|
-
// _id: String(aggregateOffer.offer.id)
|
|
1496
|
-
// };
|
|
1497
|
-
// const { id, ...replacement } = savingUnitPriceOffer;
|
|
1498
|
-
// bulkWriteOps.push({
|
|
1499
|
-
// replaceOne: {
|
|
1500
|
-
// filter: {
|
|
1501
|
-
// 'project.id': { $eq: savingUnitPriceOffer.project.id },
|
|
1502
|
-
// _id: { $eq: savingUnitPriceOffer.id }
|
|
1503
|
-
// },
|
|
1504
|
-
// replacement,
|
|
1505
|
-
// upsert: true
|
|
1506
|
-
// }
|
|
1507
|
-
// });
|
|
1508
|
-
// });
|
|
1509
|
-
// }
|
|
1510
|
-
// if (bulkWriteOps.length > 0) {
|
|
1511
|
-
// return this.offerModel.bulkWrite(bulkWriteOps, { ordered: false });
|
|
1512
|
-
// }
|
|
1513
|
-
// }
|
|
1514
|
-
}
|
|
1515
|
-
});
|
|
1516
|
-
}
|
|
1517
|
-
/**
|
|
1518
|
-
* オファー同期専用のタスク保管
|
|
1519
|
-
*/
|
|
1520
|
-
saveSyncTask(params) {
|
|
1521
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
1522
|
-
const syncAggregateOfferTask = {
|
|
1523
|
-
project: { id: params.project.id, typeOf: factory.organizationType.Project },
|
|
1524
|
-
name: factory.taskName.SyncAggregateOffer,
|
|
1525
|
-
status: factory.taskStatus.Ready,
|
|
1526
|
-
runsAt: new Date(),
|
|
1527
|
-
remainingNumberOfTries: 3,
|
|
1528
|
-
numberOfTried: 0,
|
|
1529
|
-
executionResults: [],
|
|
1530
|
-
data: {
|
|
1531
|
-
project: { id: params.project.id },
|
|
1532
|
-
id: params.id,
|
|
1533
|
-
identifier: params.identifier,
|
|
1534
|
-
isDeleted: params.isDeleted,
|
|
1535
|
-
typeOf: params.typeOf
|
|
1536
|
-
}
|
|
1537
|
-
};
|
|
1538
|
-
const taskAttributes = [syncAggregateOfferTask];
|
|
1539
|
-
const result = yield this.taskModel.insertMany(taskAttributes, { ordered: false, rawResult: true });
|
|
1540
|
-
if (result.insertedCount !== taskAttributes.length) {
|
|
1541
|
-
throw new factory.errors.ServiceUnavailable('all tasks not saved');
|
|
1542
|
-
}
|
|
1543
|
-
const savedTasks = Object.values(result.insertedIds)
|
|
1544
|
-
.map((objectId) => {
|
|
1545
|
-
return { id: objectId.toHexString() };
|
|
1546
|
-
});
|
|
1547
|
-
if (params.options.emitImmediately === true) {
|
|
1548
|
-
savedTasks.forEach((savedTask) => {
|
|
1549
|
-
task_2.taskEventEmitter.emitTaskStatusChanged({
|
|
1550
|
-
id: savedTask.id,
|
|
1551
|
-
status: factory.taskStatus.Ready
|
|
1552
|
-
});
|
|
1553
|
-
});
|
|
1554
793
|
}
|
|
1555
|
-
return savedTasks;
|
|
1556
794
|
});
|
|
1557
795
|
}
|
|
1558
796
|
searchFromAggregateOffer(params, projection) {
|