@things-factory/operato-hub 4.3.231 → 4.3.232
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 +76 -105
- package/dist-server/routers/api/restful-apis/v1/utils/params.js +2 -0
- package/dist-server/routers/api/restful-apis/v1/utils/params.js.map +1 -1
- package/dist-server/routers/api/restful-apis/v1/warehouse/add-release-order.js +5 -1
- package/dist-server/routers/api/restful-apis/v1/warehouse/add-release-order.js.map +1 -1
- package/dist-server/routers/api/restful-apis/v1/warehouse/get-release-order-details.js +1 -0
- package/dist-server/routers/api/restful-apis/v1/warehouse/get-release-order-details.js.map +1 -1
- package/dist-server/routers/api/restful-apis/v1/warehouse/get-release-order-list.js +1 -0
- package/dist-server/routers/api/restful-apis/v1/warehouse/get-release-order-list.js.map +1 -1
- package/dist-server/routers/internal/powrup-router.js +73 -0
- package/dist-server/routers/internal/powrup-router.js.map +1 -1
- package/openapi/v1/outbound.yaml +409 -390
- package/package.json +4 -4
- package/server/routers/api/restful-apis/v1/utils/params.ts +2 -0
- package/server/routers/api/restful-apis/v1/warehouse/add-release-order.ts +8 -4
- package/server/routers/api/restful-apis/v1/warehouse/get-release-order-details.ts +1 -0
- package/server/routers/api/restful-apis/v1/warehouse/get-release-order-list.ts +1 -0
- package/server/routers/internal/powrup-router.ts +88 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/operato-hub",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.232",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"@things-factory/pdf": "^4.3.227",
|
|
92
92
|
"@things-factory/product-ui": "^4.3.227",
|
|
93
93
|
"@things-factory/resource-ui": "^4.3.227",
|
|
94
|
-
"@things-factory/sales-base": "^4.3.
|
|
94
|
+
"@things-factory/sales-base": "^4.3.232",
|
|
95
95
|
"@things-factory/scene-data-transform": "^4.3.227",
|
|
96
96
|
"@things-factory/scene-excel": "^4.3.227",
|
|
97
97
|
"@things-factory/scene-firebase": "^4.3.227",
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"@things-factory/shell": "^4.3.227",
|
|
108
108
|
"@things-factory/system-ui": "^4.3.227",
|
|
109
109
|
"@things-factory/warehouse-base": "^4.3.229",
|
|
110
|
-
"@things-factory/worksheet-base": "^4.3.
|
|
110
|
+
"@things-factory/worksheet-base": "^4.3.232",
|
|
111
111
|
"cron-parser": "^4.7.0",
|
|
112
112
|
"koa2-swagger-ui": "^5.0.2",
|
|
113
113
|
"swagger-jsdoc": "^5.0.0",
|
|
@@ -119,5 +119,5 @@
|
|
|
119
119
|
"resolutions": {
|
|
120
120
|
"core-js": "^3.16.0"
|
|
121
121
|
},
|
|
122
|
-
"gitHead": "
|
|
122
|
+
"gitHead": "14c591b96b1519e7a118103205053185cf7a1305"
|
|
123
123
|
}
|
|
@@ -268,6 +268,7 @@ export const params = {
|
|
|
268
268
|
'refNo',
|
|
269
269
|
'refNo2',
|
|
270
270
|
'refNo3',
|
|
271
|
+
'refOrderId',
|
|
271
272
|
'type',
|
|
272
273
|
'transporter',
|
|
273
274
|
'trackingNo',
|
|
@@ -339,6 +340,7 @@ export const params = {
|
|
|
339
340
|
'releaseGood.refNo',
|
|
340
341
|
'releaseGood.refNo2',
|
|
341
342
|
'releaseGood.refNo3',
|
|
343
|
+
'releaseGood.refOrderId',
|
|
342
344
|
'releaseGood.marketplaceOrderStatus',
|
|
343
345
|
'releaseGood.billingAddress',
|
|
344
346
|
'releaseGood.deliveryAddress1',
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
|
+
Brackets,
|
|
2
3
|
EntityManager,
|
|
3
4
|
getConnection,
|
|
4
5
|
getRepository,
|
|
6
|
+
ILike,
|
|
5
7
|
In,
|
|
6
8
|
Not,
|
|
7
9
|
Repository,
|
|
8
|
-
SelectQueryBuilder
|
|
9
|
-
ILike,
|
|
10
|
-
Brackets
|
|
10
|
+
SelectQueryBuilder
|
|
11
11
|
} from 'typeorm'
|
|
12
12
|
import { v4 as uuidv4 } from 'uuid'
|
|
13
13
|
|
|
@@ -16,6 +16,7 @@ import { User } from '@things-factory/auth-base'
|
|
|
16
16
|
import { Bizplace, getCompanyBizplace } from '@things-factory/biz-base'
|
|
17
17
|
import { GeoCountry } from '@things-factory/geography'
|
|
18
18
|
import { generateId } from '@things-factory/id-rule-base'
|
|
19
|
+
import { LastMileDelivery } from '@things-factory/integration-lmd'
|
|
19
20
|
import { Sellercraft } from '@things-factory/integration-sellercraft'
|
|
20
21
|
import { MarketplaceOrder } from '@things-factory/marketplace-base'
|
|
21
22
|
import { ProductBundle, ProductDetail } from '@things-factory/product-base'
|
|
@@ -39,7 +40,6 @@ import {
|
|
|
39
40
|
import { Setting } from '@things-factory/setting-base'
|
|
40
41
|
import { Domain } from '@things-factory/shell'
|
|
41
42
|
import { Inventory, INVENTORY_STATUS, LOCATION_TYPE } from '@things-factory/warehouse-base'
|
|
42
|
-
import { LastMileDelivery } from '@things-factory/integration-lmd'
|
|
43
43
|
|
|
44
44
|
import { businessMiddleware, loggingMiddleware, validationMiddleware } from '../middlewares'
|
|
45
45
|
import { ApiError, ApiErrorHandler, throwInternalServerError } from '../utils/error-util'
|
|
@@ -96,6 +96,7 @@ router.post(
|
|
|
96
96
|
refNo: bodyReq.refNo,
|
|
97
97
|
refNo2: bodyReq?.refNo2,
|
|
98
98
|
refNo3: bodyReq?.refNo3,
|
|
99
|
+
refOrderId: bodyReq?.refOrderId,
|
|
99
100
|
releaseDate: bodyReq.releaseDate,
|
|
100
101
|
type: bodyReq.type,
|
|
101
102
|
marketplaceOrderStatus: bodyReq?.marketplaceOrderStatus,
|
|
@@ -207,6 +208,7 @@ router.post(
|
|
|
207
208
|
refNo: result.refNo,
|
|
208
209
|
refNo2: result.refNo2,
|
|
209
210
|
refNo3: result.refNo3,
|
|
211
|
+
refOrderId: result.refOrderId,
|
|
210
212
|
status: result.status,
|
|
211
213
|
truckNo: result.truckNo,
|
|
212
214
|
ownTransport: result.ownTransport,
|
|
@@ -262,6 +264,7 @@ router.post(
|
|
|
262
264
|
refNo: result.refNo,
|
|
263
265
|
refNo2: result.refNo2,
|
|
264
266
|
refNo3: result.refNo3,
|
|
267
|
+
refOrderId: result.refOrderId,
|
|
265
268
|
status: result.status,
|
|
266
269
|
truckNo: result.truckNo,
|
|
267
270
|
ownTransport: result.ownTransport,
|
|
@@ -474,6 +477,7 @@ async function createReleaseGood(
|
|
|
474
477
|
refNo: releaseGood.refNo,
|
|
475
478
|
refNo2: releaseGood.refNo2 || null,
|
|
476
479
|
refNo3: releaseGood.refNo3 || null,
|
|
480
|
+
refOrderId: releaseGood?.refOrderId || null,
|
|
477
481
|
remark: releaseGood?.remark || null,
|
|
478
482
|
releaseDate: releaseGood.releaseDate,
|
|
479
483
|
truckNo: releaseGood.truckNo,
|
|
@@ -52,6 +52,7 @@ router.get(
|
|
|
52
52
|
refNo: releaseGood.refNo,
|
|
53
53
|
refNo2: releaseGood.refNo2,
|
|
54
54
|
refNo3: releaseGood.refNo3,
|
|
55
|
+
refOrderId: releaseGood.refOrderId,
|
|
55
56
|
type: releaseGood.type,
|
|
56
57
|
releaseDate: releaseGood.releaseDate,
|
|
57
58
|
collectionOrderNo: releaseGood.collectionOrderNo,
|
|
@@ -62,6 +62,7 @@ router.get(
|
|
|
62
62
|
refNo: releaseGood.refNo,
|
|
63
63
|
refNo2: releaseGood.refNo2,
|
|
64
64
|
refNo3: releaseGood.refNo3,
|
|
65
|
+
refOrderId: releaseGood.refOrderId,
|
|
65
66
|
type: releaseGood.type,
|
|
66
67
|
releaseDate: releaseGood.releaseDate,
|
|
67
68
|
collectionOrderNo: releaseGood.collectionOrderNo,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import Router from 'koa-router'
|
|
2
2
|
import { EntityManager, getConnection } from 'typeorm'
|
|
3
3
|
|
|
4
|
+
import { Bizplace } from '@things-factory/biz-base'
|
|
4
5
|
import { Integration } from '@things-factory/integration-base'
|
|
5
6
|
|
|
6
7
|
import * as API from './apis'
|
|
@@ -195,6 +196,93 @@ powrupRouter.post('/internal/account/terminate-user', validationMiddleware, asyn
|
|
|
195
196
|
}
|
|
196
197
|
})
|
|
197
198
|
|
|
199
|
+
powrupRouter.post('/integration/create', validationMiddleware, async (context, next) => {
|
|
200
|
+
try {
|
|
201
|
+
await getConnection().transaction(async (tx: EntityManager) => {
|
|
202
|
+
const { body } = context.request
|
|
203
|
+
|
|
204
|
+
const { bizplaceId, name, description } = body
|
|
205
|
+
|
|
206
|
+
const bizplace: Bizplace = await tx
|
|
207
|
+
.getRepository(Bizplace)
|
|
208
|
+
.findOne({ where: { id: bizplaceId }, relations: ['domain'] })
|
|
209
|
+
|
|
210
|
+
if (!bizplace) {
|
|
211
|
+
throw new ApiError('E04', `${bizplaceId} not found`)
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
let existingIntegration: Integration = await tx
|
|
215
|
+
.getRepository(Integration)
|
|
216
|
+
.findOne({ where: { name, domain: bizplace.domain } })
|
|
217
|
+
|
|
218
|
+
if (existingIntegration) {
|
|
219
|
+
throw new ApiError('E04', `${name} already exist`)
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
let integration: Integration = {
|
|
223
|
+
name,
|
|
224
|
+
description,
|
|
225
|
+
platform: 'powrup',
|
|
226
|
+
active: true,
|
|
227
|
+
domain: bizplace.domain
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
let createdIntegration: Integration = await tx.getRepository(Integration).create(integration)
|
|
231
|
+
|
|
232
|
+
let data = {
|
|
233
|
+
id: createdIntegration.id,
|
|
234
|
+
name: createdIntegration.name
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
context.body = {
|
|
238
|
+
result: { data }
|
|
239
|
+
}
|
|
240
|
+
})
|
|
241
|
+
} catch (e) {
|
|
242
|
+
if (e instanceof ApiError) ApiErrorHandler(context, e)
|
|
243
|
+
else throwInternalServerError(context, e)
|
|
244
|
+
}
|
|
245
|
+
})
|
|
246
|
+
|
|
247
|
+
powrupRouter.post('/integration/update', validationMiddleware, async (context, next) => {
|
|
248
|
+
try {
|
|
249
|
+
await getConnection().transaction(async (tx: EntityManager) => {
|
|
250
|
+
const { body } = context.request
|
|
251
|
+
|
|
252
|
+
const { id, name, description, active } = body
|
|
253
|
+
|
|
254
|
+
let existingIntegration: Integration = await tx.getRepository(Integration).findOne(id)
|
|
255
|
+
|
|
256
|
+
if (!existingIntegration) {
|
|
257
|
+
throw new ApiError('E04', `${id} not found`)
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
await tx.getRepository(Integration).update(
|
|
261
|
+
{ id: existingIntegration.id },
|
|
262
|
+
{
|
|
263
|
+
name: name || existingIntegration.name,
|
|
264
|
+
description: description || existingIntegration.description,
|
|
265
|
+
active: active || existingIntegration.active
|
|
266
|
+
}
|
|
267
|
+
)
|
|
268
|
+
|
|
269
|
+
let updatedIntegration: Integration = await tx.getRepository(Integration).findOne(existingIntegration.id)
|
|
270
|
+
|
|
271
|
+
let data = {
|
|
272
|
+
id: updatedIntegration.id,
|
|
273
|
+
name: updatedIntegration.name
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
context.body = {
|
|
277
|
+
result: { data }
|
|
278
|
+
}
|
|
279
|
+
})
|
|
280
|
+
} catch (e) {
|
|
281
|
+
if (e instanceof ApiError) ApiErrorHandler(context, e)
|
|
282
|
+
else throwInternalServerError(context, e)
|
|
283
|
+
}
|
|
284
|
+
})
|
|
285
|
+
|
|
198
286
|
async function getIntegration(context, tx) {
|
|
199
287
|
const integration: Integration = await tx.getRepository(Integration).findOne({
|
|
200
288
|
where: { name: context.request.body.apiKey }
|