@things-factory/operato-hub 6.1.83 → 6.1.84
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/tsconfig.tsbuildinfo +1 -1
- package/package.json +46 -46
- package/server/controllers/bizplace-initializer/codes.ts +0 -32
- package/server/controllers/bizplace-initializer/dataset/codes.ts +0 -398
- package/server/controllers/bizplace-initializer/dataset/groups.ts +0 -21
- package/server/controllers/bizplace-initializer/dataset/index.ts +0 -5
- package/server/controllers/bizplace-initializer/dataset/menus.ts +0 -500
- package/server/controllers/bizplace-initializer/dataset/roles-privileges.ts +0 -402
- package/server/controllers/bizplace-initializer/dataset/settings.ts +0 -91
- package/server/controllers/bizplace-initializer/generate-bizplace-domain-roles.ts +0 -29
- package/server/controllers/bizplace-initializer/generate-bizplace-domain.ts +0 -56
- package/server/controllers/bizplace-initializer/groups.ts +0 -19
- package/server/controllers/bizplace-initializer/index.ts +0 -5
- package/server/controllers/bizplace-initializer/menus.ts +0 -42
- package/server/controllers/bizplace-initializer/settings.ts +0 -20
- package/server/controllers/company-initializer/business-register.ts +0 -59
- package/server/controllers/company-initializer/codes.ts +0 -147
- package/server/controllers/company-initializer/generate-company-roles.ts +0 -119
- package/server/controllers/company-initializer/index.ts +0 -6
- package/server/controllers/company-initializer/menus.ts +0 -359
- package/server/controllers/company-initializer/settings.ts +0 -33
- package/server/controllers/company-initializer/transporter.ts +0 -20
- package/server/controllers/index.ts +0 -0
- package/server/controllers/invitation.ts +0 -132
- package/server/controllers/utils/make-invitation-token.ts +0 -5
- package/server/controllers/utils/save-invitation-token.ts +0 -9
- package/server/entities/index.ts +0 -0
- package/server/errors/index.ts +0 -1
- package/server/errors/validation-error.ts +0 -17
- package/server/graphql/index.ts +0 -7
- package/server/graphql/resolvers/generators/generate-bizplace.ts +0 -40
- package/server/graphql/resolvers/generators/generate-company.ts +0 -76
- package/server/graphql/resolvers/generators/index.ts +0 -9
- package/server/graphql/resolvers/generators/update-domain-extType.ts +0 -55
- package/server/graphql/resolvers/index.ts +0 -8
- package/server/graphql/resolvers/invitations/index.ts +0 -5
- package/server/graphql/resolvers/invitations/partner-invitation.ts +0 -62
- package/server/graphql/resolvers/oauth2/company-roles-by-scope.ts +0 -38
- package/server/graphql/resolvers/oauth2/index.ts +0 -5
- package/server/graphql/resolvers/synchronization/auto-update-all-marketplace-product-variation-quantity.ts +0 -180
- package/server/graphql/resolvers/synchronization/create-dat-shipments.ts +0 -64
- package/server/graphql/resolvers/synchronization/fetch-sync-invoices.ts +0 -52
- package/server/graphql/resolvers/synchronization/fetch-sync-products.ts +0 -99
- package/server/graphql/resolvers/synchronization/fetch-sync-purchase-orders.ts +0 -75
- package/server/graphql/resolvers/synchronization/index.ts +0 -26
- package/server/graphql/resolvers/synchronization/sellercraft-pack-marketplace-order.ts +0 -91
- package/server/graphql/resolvers/synchronization/sync-all-products-to-sellercraft.ts +0 -39
- package/server/graphql/resolvers/synchronization/sync-products-from-account.ts +0 -40
- package/server/graphql/resolvers/synchronization/sync-products-to-account.ts +0 -64
- package/server/graphql/resolvers/synchronization/sync-products-to-sellercraft.ts +0 -176
- package/server/graphql/types/generators/generate-bizplace-input.ts +0 -11
- package/server/graphql/types/generators/generate-company-input.ts +0 -11
- package/server/graphql/types/generators/index.ts +0 -11
- package/server/graphql/types/generators/update-domain-type-input.ts +0 -8
- package/server/graphql/types/index.ts +0 -10
- package/server/graphql/types/invitations/index.ts +0 -5
- package/server/graphql/types/oauth2/company-role.ts +0 -8
- package/server/graphql/types/oauth2/index.ts +0 -7
- package/server/graphql/types/synchronization/index.ts +0 -33
- package/server/graphql/types/synchronization/sync-invoice-list.ts +0 -8
- package/server/graphql/types/synchronization/sync-invoice-set.ts +0 -38
- package/server/graphql/types/synchronization/sync-product-list.ts +0 -8
- package/server/graphql/types/synchronization/sync-product-set.ts +0 -8
- package/server/graphql/types/synchronization/sync-purchase-order-list.ts +0 -8
- package/server/graphql/types/synchronization/sync-purchase-order-set.ts +0 -28
- package/server/index.ts +0 -37
- package/server/middlewares/business-middleware.ts +0 -32
- package/server/middlewares/index.ts +0 -20
- package/server/middlewares/store-middleware.ts +0 -36
- package/server/middlewares/warehouse-middleware.ts +0 -36
- package/server/migrations/1597668478399-SeedBusinessDomain.ts +0 -34
- package/server/migrations/1597668478401-SeedBusinessRoles.ts +0 -377
- package/server/migrations/1608009991065-SeedUser.ts +0 -64
- package/server/migrations/index.ts +0 -9
- package/server/routers/api/index.ts +0 -3
- package/server/routers/api/restful-apis/unstable/add-contact-point.ts +0 -89
- package/server/routers/api/restful-apis/unstable/add-draft-release-order.ts +0 -198
- package/server/routers/api/restful-apis/unstable/add-inbound-order.ts +0 -246
- package/server/routers/api/restful-apis/unstable/add-marketplace-order.ts +0 -171
- package/server/routers/api/restful-apis/unstable/add-products.ts +0 -112
- package/server/routers/api/restful-apis/unstable/add-release-order.ts +0 -1061
- package/server/routers/api/restful-apis/unstable/add-sales-invoice.ts +0 -144
- package/server/routers/api/restful-apis/unstable/bizplace.ts +0 -45
- package/server/routers/api/restful-apis/unstable/cancel-marketplace-order.ts +0 -81
- package/server/routers/api/restful-apis/unstable/cancel-release-order.ts +0 -91
- package/server/routers/api/restful-apis/unstable/get-contact-point-list.ts +0 -110
- package/server/routers/api/restful-apis/unstable/get-delivery-order-detail.ts +0 -46
- package/server/routers/api/restful-apis/unstable/get-delivery-order-list.ts +0 -121
- package/server/routers/api/restful-apis/unstable/get-delivery-orders.ts +0 -178
- package/server/routers/api/restful-apis/unstable/get-goods-received-notes.ts +0 -134
- package/server/routers/api/restful-apis/unstable/get-inbound-order-detail.ts +0 -128
- package/server/routers/api/restful-apis/unstable/get-inbound-order-list.ts +0 -126
- package/server/routers/api/restful-apis/unstable/get-inventory-overall-product-group.ts +0 -99
- package/server/routers/api/restful-apis/unstable/get-inventory-product-group.ts +0 -107
- package/server/routers/api/restful-apis/unstable/get-marketplace-order-shipping-list.ts +0 -156
- package/server/routers/api/restful-apis/unstable/get-marketplace-store-list.ts +0 -81
- package/server/routers/api/restful-apis/unstable/get-onhand-inventories.ts +0 -125
- package/server/routers/api/restful-apis/unstable/get-partners.ts +0 -26
- package/server/routers/api/restful-apis/unstable/get-products.ts +0 -216
- package/server/routers/api/restful-apis/unstable/get-release-order-detail.ts +0 -138
- package/server/routers/api/restful-apis/unstable/get-release-order-list.ts +0 -199
- package/server/routers/api/restful-apis/unstable/get-warehouses.ts +0 -19
- package/server/routers/api/restful-apis/unstable/index.ts +0 -32
- package/server/routers/api/restful-apis/unstable/reject-inbound-order.ts +0 -46
- package/server/routers/api/restful-apis/unstable/set-marketplace-order-delivered.ts +0 -60
- package/server/routers/api/restful-apis/unstable/set-marketplace-order-failed-delivery.ts +0 -60
- package/server/routers/api/restful-apis/unstable/update-marketplace-order.ts +0 -111
- package/server/routers/api/restful-apis/unstable/update-marketplace-shipping-order.ts +0 -107
- package/server/routers/api/restful-apis/unstable/update-release-order-details.ts +0 -94
- package/server/routers/api/restful-apis/v1/add-contact-point.ts +0 -77
- package/server/routers/api/restful-apis/v1/add-draft-release-order.ts +0 -196
- package/server/routers/api/restful-apis/v1/add-inbound-order.ts +0 -243
- package/server/routers/api/restful-apis/v1/add-marketplace-order.ts +0 -172
- package/server/routers/api/restful-apis/v1/add-products.ts +0 -112
- package/server/routers/api/restful-apis/v1/add-release-order.ts +0 -967
- package/server/routers/api/restful-apis/v1/bizplace.ts +0 -45
- package/server/routers/api/restful-apis/v1/cancel-marketplace-order.ts +0 -81
- package/server/routers/api/restful-apis/v1/cancel-release-order.ts +0 -91
- package/server/routers/api/restful-apis/v1/get-contact-point-list.ts +0 -110
- package/server/routers/api/restful-apis/v1/get-delivery-order-detail.ts +0 -46
- package/server/routers/api/restful-apis/v1/get-delivery-order-list.ts +0 -121
- package/server/routers/api/restful-apis/v1/get-delivery-orders.ts +0 -178
- package/server/routers/api/restful-apis/v1/get-goods-received-notes.ts +0 -134
- package/server/routers/api/restful-apis/v1/get-inbound-order-detail.ts +0 -128
- package/server/routers/api/restful-apis/v1/get-inbound-order-list.ts +0 -126
- package/server/routers/api/restful-apis/v1/get-inventory-overall-product-group.ts +0 -99
- package/server/routers/api/restful-apis/v1/get-inventory-product-group.ts +0 -112
- package/server/routers/api/restful-apis/v1/get-marketplace-order-shipping-list.ts +0 -156
- package/server/routers/api/restful-apis/v1/get-marketplace-store-list.ts +0 -81
- package/server/routers/api/restful-apis/v1/get-onhand-inventories.ts +0 -125
- package/server/routers/api/restful-apis/v1/get-partners.ts +0 -26
- package/server/routers/api/restful-apis/v1/get-products.ts +0 -216
- package/server/routers/api/restful-apis/v1/get-release-order-detail.ts +0 -134
- package/server/routers/api/restful-apis/v1/get-release-order-list.ts +0 -198
- package/server/routers/api/restful-apis/v1/get-warehouses.ts +0 -19
- package/server/routers/api/restful-apis/v1/index.ts +0 -31
- package/server/routers/api/restful-apis/v1/reject-inbound-order.ts +0 -46
- package/server/routers/api/restful-apis/v1/set-marketplace-order-delivered.ts +0 -60
- package/server/routers/api/restful-apis/v1/set-marketplace-order-failed-delivery.ts +0 -60
- package/server/routers/api/restful-apis/v1/update-marketplace-order.ts +0 -111
- package/server/routers/api/restful-apis/v1/update-marketplace-shipping-order.ts +0 -104
- package/server/routers/api/restful-apis/v1/update-release-order-details.ts +0 -94
- package/server/routers/api/restful-apis/v2/add-contact-point.ts +0 -77
- package/server/routers/api/restful-apis/v2/add-draft-release-order.ts +0 -196
- package/server/routers/api/restful-apis/v2/add-inbound-order.ts +0 -243
- package/server/routers/api/restful-apis/v2/add-marketplace-order.ts +0 -172
- package/server/routers/api/restful-apis/v2/add-products.ts +0 -112
- package/server/routers/api/restful-apis/v2/add-release-order.ts +0 -967
- package/server/routers/api/restful-apis/v2/bizplace.ts +0 -45
- package/server/routers/api/restful-apis/v2/cancel-marketplace-order.ts +0 -81
- package/server/routers/api/restful-apis/v2/cancel-release-order.ts +0 -91
- package/server/routers/api/restful-apis/v2/get-contact-point-list.ts +0 -110
- package/server/routers/api/restful-apis/v2/get-delivery-order-detail.ts +0 -46
- package/server/routers/api/restful-apis/v2/get-delivery-order-list.ts +0 -121
- package/server/routers/api/restful-apis/v2/get-delivery-orders.ts +0 -178
- package/server/routers/api/restful-apis/v2/get-goods-received-notes.ts +0 -134
- package/server/routers/api/restful-apis/v2/get-inbound-order-detail.ts +0 -128
- package/server/routers/api/restful-apis/v2/get-inbound-order-list.ts +0 -126
- package/server/routers/api/restful-apis/v2/get-inventory-overall-product-group.ts +0 -99
- package/server/routers/api/restful-apis/v2/get-inventory-product-group.ts +0 -112
- package/server/routers/api/restful-apis/v2/get-marketplace-order-shipping-list.ts +0 -156
- package/server/routers/api/restful-apis/v2/get-marketplace-store-list.ts +0 -81
- package/server/routers/api/restful-apis/v2/get-onhand-inventories.ts +0 -125
- package/server/routers/api/restful-apis/v2/get-partners.ts +0 -26
- package/server/routers/api/restful-apis/v2/get-products.ts +0 -216
- package/server/routers/api/restful-apis/v2/get-release-order-detail.ts +0 -134
- package/server/routers/api/restful-apis/v2/get-release-order-list.ts +0 -198
- package/server/routers/api/restful-apis/v2/get-warehouses.ts +0 -19
- package/server/routers/api/restful-apis/v2/index.ts +0 -31
- package/server/routers/api/restful-apis/v2/reject-inbound-order.ts +0 -46
- package/server/routers/api/restful-apis/v2/set-marketplace-order-delivered.ts +0 -60
- package/server/routers/api/restful-apis/v2/set-marketplace-order-failed-delivery.ts +0 -60
- package/server/routers/api/restful-apis/v2/update-marketplace-order.ts +0 -111
- package/server/routers/api/restful-apis/v2/update-marketplace-shipping-order.ts +0 -104
- package/server/routers/api/restful-apis/v2/update-release-order-details.ts +0 -94
- package/server/routers/auth-invitation-router.ts +0 -25
- package/server/routers/business/bizplace-register-router.ts +0 -31
- package/server/routers/business/business-register-router.ts +0 -32
- package/server/routers/business/index.ts +0 -3
- package/server/routers/business/path-base-business-router.ts +0 -15
- package/server/routes.ts +0 -28
- package/server/templates/account-unlock-email.ts +0 -64
- package/server/templates/invitation-email.ts +0 -65
- package/server/templates/reset-password-email.ts +0 -64
- package/server/templates/verification-email.ts +0 -65
- package/server/utils/build-map.ts +0 -18
- package/server/utils/get-warehouses.ts +0 -115
- package/server/utils/index.ts +0 -3
- package/server/utils/order-no-generator.ts +0 -8
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import gql from 'graphql-tag'
|
|
2
|
-
|
|
3
|
-
import { restfulApiRouter as router } from '@things-factory/api'
|
|
4
|
-
import { Bizplace, getCompanyBizplace } from '@things-factory/biz-base'
|
|
5
|
-
|
|
6
|
-
import { businessMiddleware } from '../../../../middlewares/business-middleware'
|
|
7
|
-
import { warehouseMiddleware } from '../../../../middlewares/warehouse-middleware'
|
|
8
|
-
|
|
9
|
-
const debug = require('debug')('things-factory:operato-hub:restful-api:unstable:add-products')
|
|
10
|
-
|
|
11
|
-
router.post(
|
|
12
|
-
'/unstable/warehouse/:warehouseId/add-products',
|
|
13
|
-
businessMiddleware,
|
|
14
|
-
warehouseMiddleware,
|
|
15
|
-
async (context, next) => {
|
|
16
|
-
const { client, domain } = context.state
|
|
17
|
-
const { warehouseId } = context.params
|
|
18
|
-
const { t } = context
|
|
19
|
-
const bodyReq = context.request.body
|
|
20
|
-
|
|
21
|
-
if (!warehouseId) context.throw(404, t('error.warehouse id not found'))
|
|
22
|
-
|
|
23
|
-
if (typeof bodyReq === undefined || !Object.keys(bodyReq)?.length) {
|
|
24
|
-
context.throw(400, context.t('error.invalid body request format'))
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const custCompanyBizplace: Bizplace = await getCompanyBizplace(null, null, warehouseId)
|
|
28
|
-
|
|
29
|
-
await checkMandatoryKey(context, bodyReq)
|
|
30
|
-
debug('post:/add-product request.body', bodyReq)
|
|
31
|
-
|
|
32
|
-
let products = checkProductDetails(bodyReq)
|
|
33
|
-
|
|
34
|
-
context.body = {
|
|
35
|
-
result: (
|
|
36
|
-
await client.mutate({
|
|
37
|
-
mutation: gql`
|
|
38
|
-
mutation createProducts($products: [NewProduct!]!) {
|
|
39
|
-
createProducts(products: $products) {
|
|
40
|
-
id
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
`,
|
|
44
|
-
variables: { products },
|
|
45
|
-
context: {
|
|
46
|
-
...context,
|
|
47
|
-
state: {
|
|
48
|
-
...context.state,
|
|
49
|
-
bizplace: custCompanyBizplace,
|
|
50
|
-
domain: custCompanyBizplace?.domain
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
} as any)
|
|
54
|
-
).data
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
export async function checkMandatoryKey(context, params) {
|
|
60
|
-
params.forEach((param, key) => {
|
|
61
|
-
let noparams = []
|
|
62
|
-
|
|
63
|
-
if (!param.sku) noparams.push('sku')
|
|
64
|
-
|
|
65
|
-
if (!param.name) noparams.push('name')
|
|
66
|
-
|
|
67
|
-
if (!param.type) noparams.push('type')
|
|
68
|
-
|
|
69
|
-
if (param?.productDetails) {
|
|
70
|
-
let noSubParams = []
|
|
71
|
-
if (param.productDetails.length == 0) {
|
|
72
|
-
context.throw(
|
|
73
|
-
400,
|
|
74
|
-
context.t('error.required param {x} not found in productDetails', {
|
|
75
|
-
x: 'gtin, packingType, packingSize, uom, uomValue'
|
|
76
|
-
})
|
|
77
|
-
)
|
|
78
|
-
} else {
|
|
79
|
-
param.productDetails.forEach((subParam, key) => {
|
|
80
|
-
if (!subParam.gtin) noSubParams.push('gtin')
|
|
81
|
-
|
|
82
|
-
if (!subParam.packingType) noSubParams.push('packingType')
|
|
83
|
-
|
|
84
|
-
if (!subParam.packingSize) noSubParams.push('packingSize')
|
|
85
|
-
|
|
86
|
-
if (!subParam.uom) noSubParams.push('uom')
|
|
87
|
-
|
|
88
|
-
if (!subParam.uomValue) noSubParams.push('uomValue')
|
|
89
|
-
|
|
90
|
-
if (noSubParams?.length)
|
|
91
|
-
context.throw(
|
|
92
|
-
400,
|
|
93
|
-
context.t('error.required param {x} not found in productDetails', { x: `${noSubParams.join(', ')}` })
|
|
94
|
-
)
|
|
95
|
-
})
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
if (noparams?.length)
|
|
100
|
-
context.throw(400, context.t('error.required param {x} not found', { x: `${noparams.join(', ')}` }))
|
|
101
|
-
})
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function checkProductDetails(params) {
|
|
105
|
-
params.forEach(param => {
|
|
106
|
-
if (!param?.productDetails.some(pd => pd.isDefault)) {
|
|
107
|
-
param.productDetails[0].isDefault = true
|
|
108
|
-
}
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
return params
|
|
112
|
-
}
|