@things-factory/sales-base 3.8.19 → 3.8.21
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/dist-server/controllers/ecommerce/ecommerce-controller.js +14 -4
- package/dist-server/controllers/ecommerce/ecommerce-controller.js.map +1 -1
- package/dist-server/controllers/ecommerce/sellercraft-controller.js +12 -3
- package/dist-server/controllers/ecommerce/sellercraft-controller.js.map +1 -1
- package/package.json +3 -3
- package/server/controllers/ecommerce/ecommerce-controller.ts +19 -7
- package/server/controllers/ecommerce/sellercraft-controller.ts +15 -6
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EcommerceController = void 0;
|
|
4
|
-
const product_base_1 = require("@things-factory/product-base");
|
|
5
|
-
const warehouse_base_1 = require("@things-factory/warehouse-base");
|
|
6
4
|
const integration_marketplace_1 = require("@things-factory/integration-marketplace");
|
|
7
5
|
const marketplace_base_1 = require("@things-factory/marketplace-base");
|
|
6
|
+
const product_base_1 = require("@things-factory/product-base");
|
|
7
|
+
const warehouse_base_1 = require("@things-factory/warehouse-base");
|
|
8
8
|
const order_controller_1 = require("../order-controller");
|
|
9
9
|
class EcommerceController extends order_controller_1.OrderController {
|
|
10
10
|
async updateProductVariationStock(marketplaceStores, productIds, companyDomain) {
|
|
11
11
|
var _a;
|
|
12
12
|
const inventoryProducts = await Promise.all(productIds.map(async (productId) => {
|
|
13
13
|
const product = await this.trxMgr.getRepository(product_base_1.Product).findOne(productId);
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
let qb = await this.trxMgr.getRepository(warehouse_base_1.Inventory).createQueryBuilder('inv');
|
|
15
|
+
qb.leftJoinAndSelect('inv.location', 'loc')
|
|
16
|
+
.andWhere('"inv"."domain_id" = :domainId')
|
|
17
|
+
.andWhere('"inv"."product_id" = :productId')
|
|
18
|
+
.andWhere('"inv"."status" != :status')
|
|
19
|
+
.andWhere('"loc"."type" NOT IN (:...locationTypes)')
|
|
20
|
+
.setParameters({
|
|
21
|
+
domainId: this.domain.id,
|
|
22
|
+
productId: product.id,
|
|
23
|
+
status: warehouse_base_1.INVENTORY_STATUS.TERMINATED,
|
|
24
|
+
locationTypes: [warehouse_base_1.LOCATION_TYPE.QUARANTINE, warehouse_base_1.LOCATION_TYPE.RESERVE]
|
|
16
25
|
});
|
|
26
|
+
let inventories = await qb.getMany();
|
|
17
27
|
const inventoryQty = inventories.reduce((total, currentValue) => {
|
|
18
28
|
total += currentValue.qty;
|
|
19
29
|
return total;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecommerce-controller.js","sourceRoot":"","sources":["../../../server/controllers/ecommerce/ecommerce-controller.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"ecommerce-controller.js","sourceRoot":"","sources":["../../../server/controllers/ecommerce/ecommerce-controller.ts"],"names":[],"mappings":";;;AAAA,qFAAwG;AACxG,uEAA8E;AAC9E,+DAAsD;AAEtD,mEAA2F;AAE3F,0DAAqD;AAErD,MAAa,mBAAoB,SAAQ,kCAAe;IACtD,KAAK,CAAC,2BAA2B,CAC/B,iBAAqC,EACrC,UAAoB,EACpB,aAAqB;;QAErB,MAAM,iBAAiB,GAAU,MAAM,OAAO,CAAC,GAAG,CAChD,UAAU,CAAC,GAAG,CAAC,KAAK,EAAC,SAAS,EAAC,EAAE;YAC/B,MAAM,OAAO,GAAY,MAAM,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,sBAAO,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;YACpF,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,0BAAS,CAAC,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAA;YAC7E,EAAE,CAAC,iBAAiB,CAAC,cAAc,EAAE,KAAK,CAAC;iBACxC,QAAQ,CAAC,+BAA+B,CAAC;iBACzC,QAAQ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AAG,CAAA;wBACvD,IAAI,MAAA,WAAW,CAAC,CAAC,CAAC,0CAAE,WAAW;4BAAE,0BAA0B,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAA;qBACzF;oBAED,IAAI,4BAA4B,GAAU,EAAE,CAAA;oBAC5C,IAAI,gBAAgB,CAAC,uBAAuB,EAAE;wBAC5C,4BAA4B,GAAG,gBAAgB,CAAC,uBAAuB,CAAC,MAAM,CAC5E,WAAW,CAAC,EAAE,CAAC,WAAW,CAAC,MAAM,KAAK,QAAQ,CAC/C,CAAA;qBACF;oBAED,MAAM,kCAAQ,CAAC,gCAAgC,CAAC,gBAAgB,EAAE;wBAChE;4BACE,MAAM,EAAE,2BAA2B,CAAC,kBAAkB,CAAC,MAAM;4BAC7D,WAAW,EAAE,2BAA2B,CAAC,WAAW;4BACpD,YAAY,EAAE,2BAA2B,CAAC,YAAY;4BACtD,GAAG,EAAE,SAAS;4BACd,UAAU,EAAE,0BAA0B;4BACtC,eAAe,EAAE,2BAA2B,CAAC,eAAe;4BAC5D,YAAY,EAAE,4BAA4B;yBAC3C;qBACF,CAAC,CAAA;oBAEF,2BAA2B,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,GAAG,GAAG,CAAC,eAAe,GAAG,GAAG,CAAC,CAAC,CAAA;oBAC5F,2BAA2B,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAA;oBAC/C,MAAM,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,8CAA2B,CAAC,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAA;iBAC/F;aACF;SACF;IACH,CAAC;CACF;AApGD,kDAoGC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SellercraftController = void 0;
|
|
4
|
-
const typeorm_1 = require("typeorm");
|
|
5
4
|
const integration_sellercraft_1 = require("@things-factory/integration-sellercraft");
|
|
6
5
|
const warehouse_base_1 = require("@things-factory/warehouse-base");
|
|
7
6
|
const constants_1 = require("../../constants");
|
|
@@ -44,9 +43,19 @@ class SellercraftController extends order_controller_1.OrderController {
|
|
|
44
43
|
return total;
|
|
45
44
|
}, 0);
|
|
46
45
|
}
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
let qb = await this.trxMgr.getRepository(warehouse_base_1.Inventory).createQueryBuilder('inv');
|
|
47
|
+
qb.leftJoinAndSelect('inv.location', 'loc')
|
|
48
|
+
.andWhere('"inv"."domain_id" = :domainId')
|
|
49
|
+
.andWhere('"inv"."product_id" = :productId')
|
|
50
|
+
.andWhere('"inv"."status" != :status')
|
|
51
|
+
.andWhere('"loc"."type" NOT IN (:...locationTypes)')
|
|
52
|
+
.setParameters({
|
|
53
|
+
domainId: this.domain.id,
|
|
54
|
+
productId: product.id,
|
|
55
|
+
status: warehouse_base_1.INVENTORY_STATUS.TERMINATED,
|
|
56
|
+
locationTypes: [warehouse_base_1.LOCATION_TYPE.QUARANTINE, warehouse_base_1.LOCATION_TYPE.RESERVE]
|
|
49
57
|
});
|
|
58
|
+
let inventories = await qb.getMany();
|
|
50
59
|
let defaultProductDetail;
|
|
51
60
|
const sellercraftInvs = await Promise.all(inventories.map(async (inventory) => {
|
|
52
61
|
const inventoryPackingType = inventory.packingType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sellercraft-controller.js","sourceRoot":"","sources":["../../../server/controllers/ecommerce/sellercraft-controller.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"sellercraft-controller.js","sourceRoot":"","sources":["../../../server/controllers/ecommerce/sellercraft-controller.ts"],"names":[],"mappings":";;;AAAA,qFAAqF;AAErF,mEAA2F;AAE3F,+CAAsD;AACtD,6CAA0D;AAC1D,0DAAqD;AAErD,MAAa,qBAAsB,SAAQ,kCAAe;IACxD,KAAK,CAAC,SAAS,CAAC,WAAwB,EAAE,WAAwB;QACh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AAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,KAAK;oBACvE,KAAK,EAAE,oBAAoB,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,KAAK;oBACtE,MAAM,EAAE,oBAAoB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC,MAAM;iBAC1E;aACF,CAAA;YAED,MAAM,wCAAc,CAAC,aAAa,CAAC,WAAW,EAAE,EAAE,cAAc,EAAE,CAAC,CAAA;SACpE;IACH,CAAC;IAED,KAAK,CAAC,wBAAwB,CAAC,WAAwB,EAAE,WAAwB;QAC/E,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,WAAW,CAAA;QACrC,MAAM,gBAAgB,GAAgB,MAAM,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,sBAAW,CAAC,CAAC,OAAO,CAAC;YACzF,KAAK,EAAE,EAAE,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;SACrD,CAAC,CAAA;QAEF,IAAI,gBAAgB;YAClB,MAAM,IAAI,KAAK,CACb,+GAA+G,CAChH,CAAA;IACL,CAAC;CACF;AAzHD,sDAyHC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/sales-base",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.21",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@things-factory/setting-base": "^3.8.0",
|
|
34
34
|
"@things-factory/shell": "^3.8.0",
|
|
35
35
|
"@things-factory/transport-base": "^3.8.0",
|
|
36
|
-
"@things-factory/warehouse-base": "^3.8.
|
|
36
|
+
"@things-factory/warehouse-base": "^3.8.21"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "38e4bc33b7191c172a8516aac6ab3019fa12dac1"
|
|
39
39
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Product } from '@things-factory/product-base'
|
|
3
|
-
import { Inventory } from '@things-factory/warehouse-base'
|
|
4
|
-
import { MarketplaceStore, MarketplaceSetting, StoreAPI } from '@things-factory/integration-marketplace'
|
|
1
|
+
import { MarketplaceSetting, MarketplaceStore, StoreAPI } from '@things-factory/integration-marketplace'
|
|
5
2
|
import { MarketplaceProductVariation } from '@things-factory/marketplace-base'
|
|
3
|
+
import { Product } from '@things-factory/product-base'
|
|
4
|
+
import { Domain } from '@things-factory/shell'
|
|
5
|
+
import { Inventory, INVENTORY_STATUS, LOCATION_TYPE } from '@things-factory/warehouse-base'
|
|
6
|
+
|
|
6
7
|
import { OrderController } from '../order-controller'
|
|
7
8
|
|
|
8
9
|
export class EcommerceController extends OrderController {
|
|
@@ -14,9 +15,20 @@ export class EcommerceController extends OrderController {
|
|
|
14
15
|
const inventoryProducts: any[] = await Promise.all(
|
|
15
16
|
productIds.map(async productId => {
|
|
16
17
|
const product: Product = await this.trxMgr.getRepository(Product).findOne(productId)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
let qb = await this.trxMgr.getRepository(Inventory).createQueryBuilder('inv')
|
|
19
|
+
qb.leftJoinAndSelect('inv.location', 'loc')
|
|
20
|
+
.andWhere('"inv"."domain_id" = :domainId')
|
|
21
|
+
.andWhere('"inv"."product_id" = :productId')
|
|
22
|
+
.andWhere('"inv"."status" != :status')
|
|
23
|
+
.andWhere('"loc"."type" NOT IN (:...locationTypes)')
|
|
24
|
+
.setParameters({
|
|
25
|
+
domainId: this.domain.id,
|
|
26
|
+
productId: product.id,
|
|
27
|
+
status: INVENTORY_STATUS.TERMINATED,
|
|
28
|
+
locationTypes: [LOCATION_TYPE.QUARANTINE, LOCATION_TYPE.RESERVE]
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
let inventories: Inventory[] = await qb.getMany()
|
|
20
32
|
|
|
21
33
|
const inventoryQty: number = inventories.reduce((total, currentValue) => {
|
|
22
34
|
total += currentValue.qty
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { Equal, Not } from 'typeorm'
|
|
2
|
-
|
|
3
1
|
import { Sellercraft, SellercraftAPI } from '@things-factory/integration-sellercraft'
|
|
4
2
|
import { Product, ProductDetail } from '@things-factory/product-base'
|
|
5
|
-
import { Inventory, INVENTORY_STATUS } from '@things-factory/warehouse-base'
|
|
3
|
+
import { Inventory, INVENTORY_STATUS, LOCATION_TYPE } from '@things-factory/warehouse-base'
|
|
6
4
|
|
|
7
5
|
import { ORDER_PRODUCT_STATUS } from '../../constants'
|
|
8
6
|
import { OrderProduct, ReleaseGood } from '../../entities'
|
|
@@ -54,9 +52,20 @@ export class SellercraftController extends OrderController {
|
|
|
54
52
|
}, 0)
|
|
55
53
|
}
|
|
56
54
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
let qb = await this.trxMgr.getRepository(Inventory).createQueryBuilder('inv')
|
|
56
|
+
qb.leftJoinAndSelect('inv.location', 'loc')
|
|
57
|
+
.andWhere('"inv"."domain_id" = :domainId')
|
|
58
|
+
.andWhere('"inv"."product_id" = :productId')
|
|
59
|
+
.andWhere('"inv"."status" != :status')
|
|
60
|
+
.andWhere('"loc"."type" NOT IN (:...locationTypes)')
|
|
61
|
+
.setParameters({
|
|
62
|
+
domainId: this.domain.id,
|
|
63
|
+
productId: product.id,
|
|
64
|
+
status: INVENTORY_STATUS.TERMINATED,
|
|
65
|
+
locationTypes: [LOCATION_TYPE.QUARANTINE, LOCATION_TYPE.RESERVE]
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
let inventories: Inventory[] = await qb.getMany()
|
|
60
69
|
|
|
61
70
|
let defaultProductDetail: ProductDetail
|
|
62
71
|
const sellercraftInvs: any[] = await Promise.all(
|