@things-factory/product-base 6.2.126 → 6.2.133
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/product-base",
|
|
3
|
-
"version": "6.2.
|
|
3
|
+
"version": "6.2.133",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"migration:create": "node ../../node_modules/typeorm/cli.js migration:create -d ./server/migrations"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@things-factory/biz-base": "^6.2.
|
|
27
|
+
"@things-factory/biz-base": "^6.2.133",
|
|
28
28
|
"@things-factory/env": "^6.2.122",
|
|
29
|
-
"@things-factory/routing-base": "^6.2.
|
|
29
|
+
"@things-factory/routing-base": "^6.2.133"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "3a8ec24c20c710cb36bdac0e34394f08d5169f92"
|
|
32
32
|
}
|
|
@@ -54,10 +54,7 @@ export class ProductDetailQuery {
|
|
|
54
54
|
const { domains } = user
|
|
55
55
|
|
|
56
56
|
const params = { filters, pagination }
|
|
57
|
-
const productInfoFilters = params.filters.find(
|
|
58
|
-
x =>
|
|
59
|
-
x.name == 'product_info' || x.name == 'sku' || x.name == 'name' || x.name == 'description' || x.name == 'type'
|
|
60
|
-
)
|
|
57
|
+
const productInfoFilters = params.filters.find(x => x.name == 'product_info' || x.name == 'sku' || x.name == 'name' || x.name == 'description' || x.name == 'type')
|
|
61
58
|
|
|
62
59
|
const bizplaceFilter = params.filters.find(x => x.name == 'bizplace_id')
|
|
63
60
|
const productFilter = params.filters.find(x => x.name == 'product')
|
|
@@ -120,27 +117,22 @@ export class ProductDetailQuery {
|
|
|
120
117
|
})
|
|
121
118
|
const companiesBizplaces: Bizplace[] = await getCompaniesBizplaces(domains, warehouseDomain)
|
|
122
119
|
const partnersCompanyBizplaces: Bizplace[] = await getPartnersCompanyBizplaces(domain, user)
|
|
123
|
-
bizplaceIds = [
|
|
124
|
-
...bizplaceIds,
|
|
125
|
-
myBizplace.id,
|
|
126
|
-
...companiesBizplaces.map(biz => biz.id),
|
|
127
|
-
...partnersCompanyBizplaces.map(biz => biz.id)
|
|
128
|
-
]
|
|
120
|
+
bizplaceIds = [...bizplaceIds, myBizplace.id, ...companiesBizplaces.map(biz => biz.id), ...partnersCompanyBizplaces.map(biz => biz.id)]
|
|
129
121
|
} else {
|
|
130
122
|
const companiesBizplaces: Bizplace[] = await getCompaniesBizplaces(domains, warehouseDomain)
|
|
131
123
|
const partnersCompanyBizplaces: Bizplace[] = await getPartnersCompanyBizplaces(domain, user)
|
|
132
|
-
bizplaceIds = [
|
|
133
|
-
...bizplaceIds,
|
|
134
|
-
...companiesBizplaces.map(biz => biz.id),
|
|
135
|
-
...partnersCompanyBizplaces.map(biz => biz.id)
|
|
136
|
-
]
|
|
124
|
+
bizplaceIds = [...bizplaceIds, ...companiesBizplaces.map(biz => biz.id), ...partnersCompanyBizplaces.map(biz => biz.id)]
|
|
137
125
|
}
|
|
138
126
|
|
|
139
127
|
qb.andWhere('Product.bizplace_id IN (:...bizplaceIds)', { bizplaceIds: bizplaceIds })
|
|
140
128
|
}
|
|
141
129
|
|
|
142
130
|
if (productFilter?.value) {
|
|
143
|
-
|
|
131
|
+
if (productFilter.operator === 'eq') {
|
|
132
|
+
qb.andWhere('ProductDetail.product_id = :productId', { productId: productFilter.value })
|
|
133
|
+
} else if (productFilter.operator === 'in') {
|
|
134
|
+
qb.andWhere('ProductDetail.product_id in(:...productId)', { productId: productFilter.value })
|
|
135
|
+
}
|
|
144
136
|
}
|
|
145
137
|
|
|
146
138
|
if (productInfoFilters?.value) {
|
|
@@ -148,14 +140,7 @@ export class ProductDetailQuery {
|
|
|
148
140
|
qb.andWhere(
|
|
149
141
|
new Brackets(qb2 => {
|
|
150
142
|
productInfoFilterColumns.forEach(filter => {
|
|
151
|
-
const condition = buildCondition(
|
|
152
|
-
'Product',
|
|
153
|
-
filter,
|
|
154
|
-
productInfo.operator,
|
|
155
|
-
productInfo.value,
|
|
156
|
-
productInfo.relation,
|
|
157
|
-
Object.keys(qb.getParameters()).length
|
|
158
|
-
)
|
|
143
|
+
const condition = buildCondition('Product', filter, productInfo.operator, productInfo.value, productInfo.relation, Object.keys(qb.getParameters()).length)
|
|
159
144
|
|
|
160
145
|
qb2.orWhere(condition.clause, condition.parameters)
|
|
161
146
|
})
|
|
@@ -164,9 +149,7 @@ export class ProductDetailQuery {
|
|
|
164
149
|
}
|
|
165
150
|
|
|
166
151
|
if (createArrivalNotice?.value) {
|
|
167
|
-
qb.andWhere(
|
|
168
|
-
'(Product.isRequireSerialNumberScanning = false OR (Product.isRequireSerialNumberScanning = true AND ProductDetail.isDefault = true))'
|
|
169
|
-
)
|
|
152
|
+
qb.andWhere('(Product.isRequireSerialNumberScanning = false OR (Product.isRequireSerialNumberScanning = true AND ProductDetail.isDefault = true))')
|
|
170
153
|
}
|
|
171
154
|
|
|
172
155
|
let [items, total] = await qb.getManyAndCount()
|