@chevre/domain 21.8.0-alpha.37 → 21.8.0-alpha.39
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.
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import * as mongoose from 'mongoose';
|
|
3
|
+
|
|
4
|
+
import { chevre } from '../../../lib/index';
|
|
5
|
+
|
|
6
|
+
async function main() {
|
|
7
|
+
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
|
|
8
|
+
|
|
9
|
+
const offerRepo = new chevre.repository.Offer(mongoose.connection);
|
|
10
|
+
|
|
11
|
+
const result = await offerRepo.pullAddOns({
|
|
12
|
+
project: { id: String(process.env.PROJECT_ID) },
|
|
13
|
+
addOn: {
|
|
14
|
+
itemOffered: {
|
|
15
|
+
id: {
|
|
16
|
+
$in: ['xxx']
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
console.log(result);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
main()
|
|
25
|
+
.then(console.log)
|
|
26
|
+
.catch(console.error);
|
package/lib/chevre/repo/offer.js
CHANGED
|
@@ -1158,10 +1158,14 @@ class MongoRepository {
|
|
|
1158
1158
|
}, { id: 1 });
|
|
1159
1159
|
const result = yield this.aggregateOfferModel.updateMany(conditions, {
|
|
1160
1160
|
$pull: {
|
|
1161
|
-
'offers.addOn': {
|
|
1161
|
+
'offers.$[offer].addOn': {
|
|
1162
1162
|
'itemOffered.id': { $in: params.addOn.itemOffered.id.$in }
|
|
1163
1163
|
}
|
|
1164
1164
|
}
|
|
1165
|
+
}, {
|
|
1166
|
+
arrayFilters: [
|
|
1167
|
+
{ 'offer.addOn.itemOffered.id': { $exists: true, $in: params.addOn.itemOffered.id.$in } }
|
|
1168
|
+
]
|
|
1165
1169
|
})
|
|
1166
1170
|
.exec();
|
|
1167
1171
|
// 同期タスク作成(2023-09-05~)
|
|
@@ -1319,11 +1323,11 @@ class MongoRepository {
|
|
|
1319
1323
|
const bulkWriteOps = [];
|
|
1320
1324
|
if (unitPriceOffers.length > 0) {
|
|
1321
1325
|
unitPriceOffers.forEach((unitPriceOffer) => {
|
|
1322
|
-
|
|
1326
|
+
const { _id } = unitPriceOffer, settingUnitPriceOffer = __rest(unitPriceOffer, ["_id"]);
|
|
1323
1327
|
const $set = {
|
|
1324
1328
|
project: unitPriceOffer.project,
|
|
1325
1329
|
typeOf: factory.offerType.AggregateOffer,
|
|
1326
|
-
offers: [
|
|
1330
|
+
offers: [settingUnitPriceOffer]
|
|
1327
1331
|
};
|
|
1328
1332
|
bulkWriteOps.push({
|
|
1329
1333
|
updateOne: {
|
|
@@ -301,44 +301,40 @@ function acceptedOfferWithoutDetail2acceptedOffer(params) {
|
|
|
301
301
|
transaction: params.transaction
|
|
302
302
|
});
|
|
303
303
|
const acceptedAppliesToMovieTicket = (_a = offerWithoutDetail.priceSpecification) === null || _a === void 0 ? void 0 : _a.appliesToMovieTicket;
|
|
304
|
-
// let movieTicketIdentifire: string | undefined;
|
|
305
|
-
// if (Array.isArray(acceptedAppliesToMovieTicket)) {
|
|
306
|
-
// // throw new factory.errors.NotImplemented('multiple appliesToMovieTicket not implemented');
|
|
307
|
-
// // no op
|
|
308
|
-
// } else if (typeof acceptedAppliesToMovieTicket?.identifier === 'string') {
|
|
309
|
-
// movieTicketIdentifire = acceptedAppliesToMovieTicket.identifier;
|
|
310
|
-
// }
|
|
311
304
|
// 承認アクションオブジェクトのacceptedOfferにappliesToMovieTicketを連携する(2022-08-02~)
|
|
312
305
|
const priceSpecification = Object.assign(Object.assign({}, offer.priceSpecification), (Array.isArray(acceptedAppliesToMovieTicket) || typeof (acceptedAppliesToMovieTicket === null || acceptedAppliesToMovieTicket === void 0 ? void 0 : acceptedAppliesToMovieTicket.identifier) === 'string')
|
|
313
306
|
? { appliesToMovieTicket: acceptedAppliesToMovieTicket }
|
|
314
307
|
: undefined);
|
|
308
|
+
const acceptedAddOns = (Array.isArray(offerWithoutDetail.addOn))
|
|
309
|
+
? offerWithoutDetail.addOn.map((acceptedAddOnOffer) => {
|
|
310
|
+
var _a, _b;
|
|
311
|
+
if (typeof acceptedAddOnOffer.id !== 'string' || acceptedAddOnOffer.id.length === 0) {
|
|
312
|
+
throw new factory.errors.ArgumentNull('object.acceptedOffer.addOn.id');
|
|
313
|
+
}
|
|
314
|
+
const addOnOfferReferenceQuantityValue = (_b = (_a = acceptedAddOnOffer.priceSpecification) === null || _a === void 0 ? void 0 : _a.referenceQuantity) === null || _b === void 0 ? void 0 : _b.value;
|
|
315
|
+
return Object.assign({
|
|
316
|
+
// typeOf: <factory.offerType.Offer>factory.offerType.Offer,
|
|
317
|
+
id: acceptedAddOnOffer.id }, (typeof addOnOfferReferenceQuantityValue === 'number')
|
|
318
|
+
? { priceSpecification: { referenceQuantity: { value: addOnOfferReferenceQuantityValue } } }
|
|
319
|
+
: undefined);
|
|
320
|
+
})
|
|
321
|
+
: [];
|
|
315
322
|
const acceptedOffer = {
|
|
316
323
|
// オファーの中身を最適化する(必要最低限の情報のみに)
|
|
317
324
|
id: String(offer.id),
|
|
318
325
|
identifier: offer.identifier,
|
|
319
326
|
priceSpecification,
|
|
320
|
-
// project: offer.project,
|
|
321
327
|
typeOf: offer.typeOf,
|
|
322
328
|
priceCurrency: offer.priceCurrency,
|
|
323
329
|
itemOffered: Object.assign({ typeOf: factory.product.ProductType.EventService, serviceOutput: (offerWithoutDetail.itemOffered !== undefined && offerWithoutDetail.itemOffered !== null)
|
|
324
330
|
? offerWithoutDetail.itemOffered.serviceOutput
|
|
325
331
|
: undefined }, (pointAward !== undefined) ? { pointAward } : undefined),
|
|
326
|
-
addOn:
|
|
327
|
-
? offerWithoutDetail.addOn.map((a) => {
|
|
328
|
-
return {
|
|
329
|
-
typeOf: factory.offerType.Offer,
|
|
330
|
-
id: String(a.id),
|
|
331
|
-
priceCurrency: offer.priceCurrency
|
|
332
|
-
};
|
|
333
|
-
})
|
|
334
|
-
: [],
|
|
332
|
+
addOn: acceptedAddOns,
|
|
335
333
|
// 追加属性をマージ
|
|
336
334
|
additionalProperty: [
|
|
337
335
|
...(Array.isArray(offerWithoutDetail.additionalProperty)) ? offerWithoutDetail.additionalProperty : [],
|
|
338
336
|
...(Array.isArray(offer.additionalProperty)) ? offer.additionalProperty : []
|
|
339
337
|
]
|
|
340
|
-
// movieTicketIdentifireの不要を確認後に廃止(2022-09-09以降)(2022-11-02+)
|
|
341
|
-
// ...(typeof movieTicketIdentifire === 'string') ? { movieTicketIdentifire } : undefined
|
|
342
338
|
};
|
|
343
339
|
let offeredThrough = (_b = params.event.offers) === null || _b === void 0 ? void 0 : _b.offeredThrough;
|
|
344
340
|
if (typeof (offeredThrough === null || offeredThrough === void 0 ? void 0 : offeredThrough.typeOf) !== 'string') {
|
package/package.json
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.329.0-alpha.
|
|
13
|
-
"@cinerino/sdk": "3.166.0
|
|
12
|
+
"@chevre/factory": "4.329.0-alpha.8",
|
|
13
|
+
"@cinerino/sdk": "3.166.0",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
16
16
|
"@sendgrid/mail": "6.4.0",
|
|
@@ -117,5 +117,5 @@
|
|
|
117
117
|
"postversion": "git push origin --tags",
|
|
118
118
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
119
119
|
},
|
|
120
|
-
"version": "21.8.0-alpha.
|
|
120
|
+
"version": "21.8.0-alpha.39"
|
|
121
121
|
}
|