@chevre/domain 22.14.0-alpha.27 → 22.14.0-alpha.29
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.
|
@@ -9,10 +9,12 @@ async function main() {
|
|
|
9
9
|
const roleRepo = await chevre.repository.Role.createInstance(mongoose.connection);
|
|
10
10
|
|
|
11
11
|
let roleNames = [
|
|
12
|
-
chevre.factory.role.organizationRole.RoleName.InventoryManager
|
|
12
|
+
chevre.factory.role.organizationRole.RoleName.InventoryManager,
|
|
13
|
+
chevre.factory.role.organizationRole.RoleName.SellersOwner,
|
|
14
|
+
chevre.factory.role.organizationRole.RoleName.SellersInventoryManager
|
|
13
15
|
];
|
|
14
16
|
let permissions = [
|
|
15
|
-
'admin.productOffers.*'
|
|
17
|
+
'admin.sellers.productOffers.*'
|
|
16
18
|
];
|
|
17
19
|
for (const roleName of roleNames) {
|
|
18
20
|
for (const permission of permissions) {
|
|
@@ -25,12 +27,10 @@ async function main() {
|
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
roleNames = [
|
|
28
|
-
chevre.factory.role.organizationRole.RoleName.SellersOwner,
|
|
29
|
-
chevre.factory.role.organizationRole.RoleName.SellersInventoryManager,
|
|
30
30
|
chevre.factory.role.organizationRole.RoleName.TicketClerk
|
|
31
31
|
];
|
|
32
32
|
permissions = [
|
|
33
|
-
'admin.productOffers.read'
|
|
33
|
+
'admin.sellers.productOffers.read'
|
|
34
34
|
];
|
|
35
35
|
for (const roleName of roleNames) {
|
|
36
36
|
for (const permission of permissions) {
|
|
@@ -33,7 +33,7 @@ class ProductOfferRepo {
|
|
|
33
33
|
this.productOfferModel = connection.model(productOffer_1.modelName, (0, productOffer_1.createSchema)());
|
|
34
34
|
}
|
|
35
35
|
static CREATE_MONGO_CONDITIONS(params) {
|
|
36
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
36
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
37
37
|
const andConditions = [];
|
|
38
38
|
const idEq = (_a = params.id) === null || _a === void 0 ? void 0 : _a.$eq;
|
|
39
39
|
if (typeof idEq === 'string') {
|
|
@@ -63,15 +63,19 @@ class ProductOfferRepo {
|
|
|
63
63
|
if (typeof offeredByIdEq === 'string') {
|
|
64
64
|
andConditions.push({ 'offeredBy.id': { $eq: offeredByIdEq } });
|
|
65
65
|
}
|
|
66
|
-
const
|
|
66
|
+
const sellerByIdEq = (_o = (_m = params.seller) === null || _m === void 0 ? void 0 : _m.id) === null || _o === void 0 ? void 0 : _o.$eq;
|
|
67
|
+
if (typeof sellerByIdEq === 'string') {
|
|
68
|
+
andConditions.push({ 'offeredBy.id': { $eq: sellerByIdEq } });
|
|
69
|
+
}
|
|
70
|
+
const validForMemberTierIdentifierEq = (_q = (_p = params.validForMemberTier) === null || _p === void 0 ? void 0 : _p.identifier) === null || _q === void 0 ? void 0 : _q.$eq;
|
|
67
71
|
if (typeof validForMemberTierIdentifierEq === 'string') {
|
|
68
72
|
andConditions.push({ 'validForMemberTier.identifier': { $exists: true, $eq: validForMemberTierIdentifierEq } });
|
|
69
73
|
}
|
|
70
|
-
const validFromLte = (
|
|
74
|
+
const validFromLte = (_r = params.validFrom) === null || _r === void 0 ? void 0 : _r.$lte;
|
|
71
75
|
if (validFromLte instanceof Date) {
|
|
72
76
|
andConditions.push({ validFrom: { $lte: validFromLte } });
|
|
73
77
|
}
|
|
74
|
-
const validThroughGte = (
|
|
78
|
+
const validThroughGte = (_s = params.validThrough) === null || _s === void 0 ? void 0 : _s.$gte;
|
|
75
79
|
if (validThroughGte instanceof Date) {
|
|
76
80
|
andConditions.push({ validThrough: { $gte: validThroughGte } });
|
|
77
81
|
}
|
|
@@ -78,6 +78,10 @@ function validateMemberTier(params) {
|
|
|
78
78
|
if (memberProgramIdentifier !== memberProgramIdentifierMustBe) {
|
|
79
79
|
throw new factory.errors.Argument('reservationFor.offers.validForMemberTier', 'member program not matched');
|
|
80
80
|
}
|
|
81
|
+
const sellerId = event.offers.seller.id;
|
|
82
|
+
if (typeof sellerId !== 'string' || sellerId === '') {
|
|
83
|
+
throw new factory.errors.NotFound('event.offers.seller.id');
|
|
84
|
+
}
|
|
81
85
|
// 有効なプロダクトオファーを検証
|
|
82
86
|
const productOfferForMemberTier = (yield repos.productOffer.findProductOffers({
|
|
83
87
|
limit: 1,
|
|
@@ -87,7 +91,8 @@ function validateMemberTier(params) {
|
|
|
87
91
|
itemOffered: { identifier: { $eq: aggregateOfferIdentifier } }, // オファーコレクションコード
|
|
88
92
|
validForMemberTier: { identifier: { $eq: tierIdentifier } },
|
|
89
93
|
validFrom: { $lte: acceptedDate.toDate() },
|
|
90
|
-
validThrough: { $gte: acceptedDate.toDate() }
|
|
94
|
+
validThrough: { $gte: acceptedDate.toDate() },
|
|
95
|
+
offeredBy: { id: { $eq: sellerId } } // オファー提供者も検証する
|
|
91
96
|
}, ['identifier'])).shift();
|
|
92
97
|
if (productOfferForMemberTier === undefined) {
|
|
93
98
|
throw new factory.errors.NotFound(factory.offerType.Offer, 'valid product offers for member tier not found');
|
package/package.json
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.600.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.600.0",
|
|
14
|
-
"@chevre/factory": "4.399.0-alpha.
|
|
15
|
-
"@cinerino/sdk": "12.
|
|
14
|
+
"@chevre/factory": "4.399.0-alpha.24",
|
|
15
|
+
"@cinerino/sdk": "12.4.0",
|
|
16
16
|
"@motionpicture/coa-service": "9.6.0",
|
|
17
17
|
"@motionpicture/gmo-service": "5.4.0-alpha.1",
|
|
18
18
|
"@sendgrid/client": "8.1.4",
|
|
@@ -115,5 +115,5 @@
|
|
|
115
115
|
"postversion": "git push origin --tags",
|
|
116
116
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
117
117
|
},
|
|
118
|
-
"version": "22.14.0-alpha.
|
|
118
|
+
"version": "22.14.0-alpha.29"
|
|
119
119
|
}
|