@things-factory/operato-hub 4.3.110 → 4.3.112
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/config.development.js +15 -30
- package/dist-server/graphql/resolvers/synchronization/sync-products-to-sellercraft.js +9 -7
- package/dist-server/graphql/resolvers/synchronization/sync-products-to-sellercraft.js.map +1 -1
- package/package.json +54 -54
- package/server/graphql/resolvers/synchronization/sync-products-to-sellercraft.ts +25 -16
package/config.development.js
CHANGED
|
@@ -4,47 +4,32 @@ module.exports = {
|
|
|
4
4
|
useVirtualHostBasedDomain: false,
|
|
5
5
|
fallbackRoute: '/',
|
|
6
6
|
subdomainOffset: 2,
|
|
7
|
-
port:
|
|
7
|
+
port: 1200,
|
|
8
8
|
inspect: '9260',
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
// extra: { poolSize: 30 }
|
|
21
|
-
//},
|
|
9
|
+
ormconfig: {
|
|
10
|
+
name: 'default',
|
|
11
|
+
type: 'postgres',
|
|
12
|
+
database: 'dev3',
|
|
13
|
+
username: 'postgres',
|
|
14
|
+
password: 'hatio',
|
|
15
|
+
host: '192.168.0.153',
|
|
16
|
+
port: 15432,
|
|
17
|
+
synchronize: true,
|
|
18
|
+
logging: true
|
|
19
|
+
},
|
|
22
20
|
// ormconfig: {
|
|
23
21
|
// name: 'default',
|
|
24
22
|
// type: 'postgres',
|
|
25
|
-
// database: 'dev',
|
|
26
|
-
// username: 'postgres',
|
|
27
|
-
// password: 'hatio',
|
|
28
23
|
// host: 'operatov3.cluster-cijhm4n1hbst.ap-southeast-1.rds.amazonaws.com',
|
|
29
24
|
// port: 55432,
|
|
25
|
+
// database: 'postgres',
|
|
26
|
+
// username: 'postgres',
|
|
27
|
+
// password: 'abcd1234',
|
|
30
28
|
// synchronize: false,
|
|
31
29
|
// logging: true,
|
|
32
30
|
// connectTimeoutMS: 30000,
|
|
33
31
|
// extra: { poolSize: 30 }
|
|
34
32
|
// },
|
|
35
|
-
ormconfig: {
|
|
36
|
-
name: 'default',
|
|
37
|
-
type: 'postgres',
|
|
38
|
-
host: 'operatov3.cluster-cijhm4n1hbst.ap-southeast-1.rds.amazonaws.com',
|
|
39
|
-
port: 55432,
|
|
40
|
-
database: 'dev',
|
|
41
|
-
username: 'postgres',
|
|
42
|
-
password: 'abcd1234',
|
|
43
|
-
synchronize: false,
|
|
44
|
-
logging: true,
|
|
45
|
-
connectTimeoutMS: 30000,
|
|
46
|
-
extra: { poolSize: 30 }
|
|
47
|
-
},
|
|
48
33
|
password: {
|
|
49
34
|
lowerCase: true,
|
|
50
35
|
upperCase: false,
|
|
@@ -13,7 +13,9 @@ exports.syncProductsToSellercraftResolver = {
|
|
|
13
13
|
let page = 0;
|
|
14
14
|
let hasMorePage = true;
|
|
15
15
|
const limit = 50;
|
|
16
|
-
const sellercraft = await tx
|
|
16
|
+
const sellercraft = await tx
|
|
17
|
+
.getRepository(integration_sellercraft_1.Sellercraft)
|
|
18
|
+
.findOne({ where: { id: sellercraftId }, relations: ['domain'] });
|
|
17
19
|
const customerDomain = sellercraft.domain;
|
|
18
20
|
const fulfilmentCenter = await integration_fulfillment_1.FulfillmentAPI.getFulfillmentCenter(fulfillmentCenterId);
|
|
19
21
|
const customerBizplace = await tx.getRepository(biz_base_1.Bizplace).findOne({ where: { domain: customerDomain } });
|
|
@@ -66,11 +68,11 @@ exports.syncProductsToSellercraftResolver = {
|
|
|
66
68
|
quantity_reserved: item.reserved_qty * packingSize < 0 ? 0 : item.reserved_qty * packingSize,
|
|
67
69
|
unit_of_measure: 'EA'
|
|
68
70
|
},
|
|
69
|
-
package_weight_gm: item.nett_weight
|
|
71
|
+
package_weight_gm: item.nett_weight < 1 ? 1 : item.nett_weight,
|
|
70
72
|
package_dimensions: {
|
|
71
|
-
length_mm: item.depth
|
|
72
|
-
width_mm: item.width
|
|
73
|
-
height_mm: item.height
|
|
73
|
+
length_mm: item.depth < 1 ? 1 : item.depth,
|
|
74
|
+
width_mm: item.width < 1 ? 1 : item.width,
|
|
75
|
+
height_mm: item.height < 1 ? 1 : item.height
|
|
74
76
|
}
|
|
75
77
|
});
|
|
76
78
|
});
|
|
@@ -78,9 +80,9 @@ exports.syncProductsToSellercraftResolver = {
|
|
|
78
80
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
79
81
|
};
|
|
80
82
|
await delay(500);
|
|
81
|
-
await integration_sellercraft_1.SellercraftAPI.updateProduct(sellercraft, { context, accountId: sellercraft.accountId, sellercraftInv });
|
|
82
83
|
page++;
|
|
83
|
-
hasMorePage = (((_a = total[0]) === null || _a === void 0 ? void 0 : _a.count) || 0) >
|
|
84
|
+
hasMorePage = (((_a = total[0]) === null || _a === void 0 ? void 0 : _a.count) || 0) > page * limit;
|
|
85
|
+
await integration_sellercraft_1.SellercraftAPI.updateProduct(sellercraft, { context, accountId: sellercraft.accountId, sellercraftInv });
|
|
84
86
|
}
|
|
85
87
|
catch (e) {
|
|
86
88
|
env_1.logger.error(`[syncProductsToSellercraftResolver] sellercraftID:${sellercraftId} fulfillmentCenterId:${fulfillmentCenterId} page:${page} - ${e}`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync-products-to-sellercraft.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/synchronization/sync-products-to-sellercraft.ts"],"names":[],"mappings":";;;AAEA,uDAAmD;AACnD,6CAA4C;AAC5C,qFAA2F;AAC3F,qFAAqF;
|
|
1
|
+
{"version":3,"file":"sync-products-to-sellercraft.js","sourceRoot":"","sources":["../../../../server/graphql/resolvers/synchronization/sync-products-to-sellercraft.ts"],"names":[],"mappings":";;;AAEA,uDAAmD;AACnD,6CAA4C;AAC5C,qFAA2F;AAC3F,qFAAqF;AAIxE,QAAA,iCAAiC,GAAG;IAC/C,KAAK,CAAC,yBAAyB,CAC7B,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
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -56,66 +56,66 @@
|
|
|
56
56
|
"@operato/scene-tab": "^0.1.8",
|
|
57
57
|
"@operato/scene-table": "^0.1.8",
|
|
58
58
|
"@operato/scene-wheel-sorter": "^0.1.8",
|
|
59
|
-
"@things-factory/api": "^4.3.
|
|
60
|
-
"@things-factory/apptool-ui": "^4.3.
|
|
61
|
-
"@things-factory/attachment-base": "^4.3.
|
|
62
|
-
"@things-factory/auth-base": "^4.3.
|
|
63
|
-
"@things-factory/auth-ui": "^4.3.
|
|
64
|
-
"@things-factory/biz-base": "^4.3.
|
|
65
|
-
"@things-factory/biz-ui": "^4.3.
|
|
66
|
-
"@things-factory/board-service": "^4.3.
|
|
67
|
-
"@things-factory/board-ui": "^4.3.
|
|
68
|
-
"@things-factory/code-ui": "^4.3.
|
|
69
|
-
"@things-factory/component-ui": "^4.3.
|
|
70
|
-
"@things-factory/context-ui": "^4.3.
|
|
71
|
-
"@things-factory/document-template-ui": "^4.3.
|
|
72
|
-
"@things-factory/export-ui": "^4.3.
|
|
73
|
-
"@things-factory/export-ui-csv": "^4.3.
|
|
74
|
-
"@things-factory/export-ui-excel": "^4.3.
|
|
75
|
-
"@things-factory/grist-ui": "^4.3.
|
|
76
|
-
"@things-factory/help": "^4.3.
|
|
77
|
-
"@things-factory/i18n-base": "^4.3.
|
|
78
|
-
"@things-factory/import-ui": "^4.3.
|
|
79
|
-
"@things-factory/import-ui-excel": "^4.3.
|
|
80
|
-
"@things-factory/integration-accounting": "^4.3.
|
|
81
|
-
"@things-factory/integration-fulfillment": "^4.3.
|
|
82
|
-
"@things-factory/integration-lmd": "^4.3.
|
|
83
|
-
"@things-factory/integration-marketplace": "^4.3.
|
|
84
|
-
"@things-factory/integration-pos": "^4.3.
|
|
85
|
-
"@things-factory/integration-sellercraft": "^4.3.
|
|
86
|
-
"@things-factory/integration-sftp": "^4.3.
|
|
87
|
-
"@things-factory/lite-menu": "^4.3.
|
|
88
|
-
"@things-factory/more-ui": "^4.3.
|
|
89
|
-
"@things-factory/notification": "^4.3.
|
|
90
|
-
"@things-factory/pdf": "^4.3.
|
|
91
|
-
"@things-factory/product-ui": "^4.3.
|
|
92
|
-
"@things-factory/resource-ui": "^4.3.
|
|
93
|
-
"@things-factory/sales-base": "^4.3.
|
|
94
|
-
"@things-factory/scene-data-transform": "^4.3.
|
|
95
|
-
"@things-factory/scene-excel": "^4.3.
|
|
96
|
-
"@things-factory/scene-firebase": "^4.3.
|
|
97
|
-
"@things-factory/scene-form": "^4.3.
|
|
98
|
-
"@things-factory/scene-google-map": "^4.3.
|
|
99
|
-
"@things-factory/scene-graphql": "^4.3.
|
|
100
|
-
"@things-factory/scene-label": "^4.3.
|
|
101
|
-
"@things-factory/scene-marker": "^4.3.
|
|
102
|
-
"@things-factory/scene-mqtt": "^4.3.
|
|
103
|
-
"@things-factory/scene-restful": "^4.3.
|
|
104
|
-
"@things-factory/scene-visualizer": "^4.3.
|
|
105
|
-
"@things-factory/setting-ui": "^4.3.
|
|
106
|
-
"@things-factory/shell": "^4.3.
|
|
107
|
-
"@things-factory/system-ui": "^4.3.
|
|
108
|
-
"@things-factory/warehouse-base": "^4.3.
|
|
109
|
-
"@things-factory/worksheet-base": "^4.3.
|
|
59
|
+
"@things-factory/api": "^4.3.111",
|
|
60
|
+
"@things-factory/apptool-ui": "^4.3.111",
|
|
61
|
+
"@things-factory/attachment-base": "^4.3.111",
|
|
62
|
+
"@things-factory/auth-base": "^4.3.111",
|
|
63
|
+
"@things-factory/auth-ui": "^4.3.111",
|
|
64
|
+
"@things-factory/biz-base": "^4.3.111",
|
|
65
|
+
"@things-factory/biz-ui": "^4.3.111",
|
|
66
|
+
"@things-factory/board-service": "^4.3.111",
|
|
67
|
+
"@things-factory/board-ui": "^4.3.111",
|
|
68
|
+
"@things-factory/code-ui": "^4.3.111",
|
|
69
|
+
"@things-factory/component-ui": "^4.3.111",
|
|
70
|
+
"@things-factory/context-ui": "^4.3.111",
|
|
71
|
+
"@things-factory/document-template-ui": "^4.3.111",
|
|
72
|
+
"@things-factory/export-ui": "^4.3.111",
|
|
73
|
+
"@things-factory/export-ui-csv": "^4.3.111",
|
|
74
|
+
"@things-factory/export-ui-excel": "^4.3.111",
|
|
75
|
+
"@things-factory/grist-ui": "^4.3.111",
|
|
76
|
+
"@things-factory/help": "^4.3.111",
|
|
77
|
+
"@things-factory/i18n-base": "^4.3.111",
|
|
78
|
+
"@things-factory/import-ui": "^4.3.111",
|
|
79
|
+
"@things-factory/import-ui-excel": "^4.3.111",
|
|
80
|
+
"@things-factory/integration-accounting": "^4.3.111",
|
|
81
|
+
"@things-factory/integration-fulfillment": "^4.3.111",
|
|
82
|
+
"@things-factory/integration-lmd": "^4.3.111",
|
|
83
|
+
"@things-factory/integration-marketplace": "^4.3.111",
|
|
84
|
+
"@things-factory/integration-pos": "^4.3.111",
|
|
85
|
+
"@things-factory/integration-sellercraft": "^4.3.112",
|
|
86
|
+
"@things-factory/integration-sftp": "^4.3.111",
|
|
87
|
+
"@things-factory/lite-menu": "^4.3.111",
|
|
88
|
+
"@things-factory/more-ui": "^4.3.111",
|
|
89
|
+
"@things-factory/notification": "^4.3.111",
|
|
90
|
+
"@things-factory/pdf": "^4.3.111",
|
|
91
|
+
"@things-factory/product-ui": "^4.3.111",
|
|
92
|
+
"@things-factory/resource-ui": "^4.3.111",
|
|
93
|
+
"@things-factory/sales-base": "^4.3.112",
|
|
94
|
+
"@things-factory/scene-data-transform": "^4.3.111",
|
|
95
|
+
"@things-factory/scene-excel": "^4.3.111",
|
|
96
|
+
"@things-factory/scene-firebase": "^4.3.111",
|
|
97
|
+
"@things-factory/scene-form": "^4.3.111",
|
|
98
|
+
"@things-factory/scene-google-map": "^4.3.111",
|
|
99
|
+
"@things-factory/scene-graphql": "^4.3.111",
|
|
100
|
+
"@things-factory/scene-label": "^4.3.111",
|
|
101
|
+
"@things-factory/scene-marker": "^4.3.111",
|
|
102
|
+
"@things-factory/scene-mqtt": "^4.3.111",
|
|
103
|
+
"@things-factory/scene-restful": "^4.3.111",
|
|
104
|
+
"@things-factory/scene-visualizer": "^4.3.111",
|
|
105
|
+
"@things-factory/setting-ui": "^4.3.111",
|
|
106
|
+
"@things-factory/shell": "^4.3.111",
|
|
107
|
+
"@things-factory/system-ui": "^4.3.111",
|
|
108
|
+
"@things-factory/warehouse-base": "^4.3.112",
|
|
109
|
+
"@things-factory/worksheet-base": "^4.3.112",
|
|
110
110
|
"koa2-swagger-ui": "^5.0.2",
|
|
111
111
|
"swagger-jsdoc": "^5.0.0",
|
|
112
112
|
"yamljs": "^0.3.0"
|
|
113
113
|
},
|
|
114
114
|
"devDependencies": {
|
|
115
|
-
"@things-factory/builder": "^4.3.
|
|
115
|
+
"@things-factory/builder": "^4.3.111"
|
|
116
116
|
},
|
|
117
117
|
"resolutions": {
|
|
118
118
|
"core-js": "^3.16.0"
|
|
119
119
|
},
|
|
120
|
-
"gitHead": "
|
|
120
|
+
"gitHead": "f4c818e06686edfec9a3ca80e1f818254fcc1593"
|
|
121
121
|
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { EntityManager
|
|
1
|
+
import { EntityManager } from 'typeorm'
|
|
2
2
|
|
|
3
3
|
import { Bizplace } from '@things-factory/biz-base'
|
|
4
4
|
import { logger } from '@things-factory/env'
|
|
5
5
|
import { FulfillmentAPI, FulfillmentCenter } from '@things-factory/integration-fulfillment'
|
|
6
6
|
import { Sellercraft, SellercraftAPI } from '@things-factory/integration-sellercraft'
|
|
7
|
-
import {
|
|
8
|
-
import { WarehouseBizplaceOnhandInventory } from '@things-factory/worksheet-base'
|
|
7
|
+
import { ProductDetail } from '@things-factory/product-base'
|
|
9
8
|
import { Domain } from '@things-factory/shell'
|
|
10
9
|
|
|
11
10
|
export const syncProductsToSellercraftResolver = {
|
|
@@ -24,12 +23,15 @@ export const syncProductsToSellercraftResolver = {
|
|
|
24
23
|
let hasMorePage: boolean = true
|
|
25
24
|
const limit: number = 50
|
|
26
25
|
|
|
27
|
-
const sellercraft: Sellercraft = await tx
|
|
26
|
+
const sellercraft: Sellercraft = await tx
|
|
27
|
+
.getRepository(Sellercraft)
|
|
28
|
+
.findOne({ where: { id: sellercraftId }, relations: ['domain'] })
|
|
28
29
|
const customerDomain: Domain = sellercraft.domain
|
|
29
30
|
const fulfilmentCenter: FulfillmentCenter = await FulfillmentAPI.getFulfillmentCenter(fulfillmentCenterId)
|
|
30
31
|
const customerBizplace: Bizplace = await tx.getRepository(Bizplace).findOne({ where: { domain: customerDomain } })
|
|
31
32
|
|
|
32
|
-
await tx.query(
|
|
33
|
+
await tx.query(
|
|
34
|
+
`
|
|
33
35
|
create temp table temp_warehouse_product_inventory ON COMMIT DROP as (
|
|
34
36
|
select p.id, p.sku as product_sku, p.name as product_name, p.description as product_description,
|
|
35
37
|
pd.gtin, pd.uom, pd.packing_size, coalesce(pd.nett_weight, 0) as nett_weight, pd.width, pd."depth", pd.height,
|
|
@@ -52,7 +54,9 @@ export const syncProductsToSellercraftResolver = {
|
|
|
52
54
|
where b.id = $2
|
|
53
55
|
and pd."is_default" = true
|
|
54
56
|
)
|
|
55
|
-
`,
|
|
57
|
+
`,
|
|
58
|
+
[fulfilmentCenter.id, customerBizplace.id]
|
|
59
|
+
)
|
|
56
60
|
|
|
57
61
|
let total = await tx.query(`
|
|
58
62
|
select count(*) from temp_warehouse_product_inventory
|
|
@@ -67,9 +71,12 @@ export const syncProductsToSellercraftResolver = {
|
|
|
67
71
|
// paginationOffset: page
|
|
68
72
|
// })
|
|
69
73
|
|
|
70
|
-
const items = await tx.query(
|
|
74
|
+
const items = await tx.query(
|
|
75
|
+
`
|
|
71
76
|
select * from temp_warehouse_product_inventory limit $1 offset $2
|
|
72
|
-
`,
|
|
77
|
+
`,
|
|
78
|
+
[limit, page * limit]
|
|
79
|
+
)
|
|
73
80
|
|
|
74
81
|
let sellercraftInv: any[] = []
|
|
75
82
|
|
|
@@ -84,11 +91,11 @@ export const syncProductsToSellercraftResolver = {
|
|
|
84
91
|
quantity_reserved: item.reserved_qty * packingSize < 0 ? 0 : item.reserved_qty * packingSize,
|
|
85
92
|
unit_of_measure: 'EA'
|
|
86
93
|
},
|
|
87
|
-
package_weight_gm: item.nett_weight
|
|
94
|
+
package_weight_gm: item.nett_weight < 1 ? 1 : item.nett_weight,
|
|
88
95
|
package_dimensions: {
|
|
89
|
-
length_mm: item.depth
|
|
90
|
-
width_mm: item.width
|
|
91
|
-
height_mm: item.height
|
|
96
|
+
length_mm: item.depth < 1 ? 1 : item.depth,
|
|
97
|
+
width_mm: item.width < 1 ? 1 : item.width,
|
|
98
|
+
height_mm: item.height < 1 ? 1 : item.height
|
|
92
99
|
}
|
|
93
100
|
})
|
|
94
101
|
})
|
|
@@ -99,12 +106,14 @@ export const syncProductsToSellercraftResolver = {
|
|
|
99
106
|
|
|
100
107
|
await delay(500)
|
|
101
108
|
|
|
102
|
-
await SellercraftAPI.updateProduct(sellercraft, { context, accountId: sellercraft.accountId, sellercraftInv })
|
|
103
|
-
|
|
104
109
|
page++
|
|
105
|
-
hasMorePage = (total[0]?.count || 0) >
|
|
110
|
+
hasMorePage = (total[0]?.count || 0) > page * limit
|
|
111
|
+
|
|
112
|
+
await SellercraftAPI.updateProduct(sellercraft, { context, accountId: sellercraft.accountId, sellercraftInv })
|
|
106
113
|
} catch (e) {
|
|
107
|
-
logger.error(
|
|
114
|
+
logger.error(
|
|
115
|
+
`[syncProductsToSellercraftResolver] sellercraftID:${sellercraftId} fulfillmentCenterId:${fulfillmentCenterId} page:${page} - ${e}`
|
|
116
|
+
)
|
|
108
117
|
}
|
|
109
118
|
}
|
|
110
119
|
} catch (e) {
|