@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.
Files changed (189) hide show
  1. package/dist-server/tsconfig.tsbuildinfo +1 -1
  2. package/package.json +46 -46
  3. package/server/controllers/bizplace-initializer/codes.ts +0 -32
  4. package/server/controllers/bizplace-initializer/dataset/codes.ts +0 -398
  5. package/server/controllers/bizplace-initializer/dataset/groups.ts +0 -21
  6. package/server/controllers/bizplace-initializer/dataset/index.ts +0 -5
  7. package/server/controllers/bizplace-initializer/dataset/menus.ts +0 -500
  8. package/server/controllers/bizplace-initializer/dataset/roles-privileges.ts +0 -402
  9. package/server/controllers/bizplace-initializer/dataset/settings.ts +0 -91
  10. package/server/controllers/bizplace-initializer/generate-bizplace-domain-roles.ts +0 -29
  11. package/server/controllers/bizplace-initializer/generate-bizplace-domain.ts +0 -56
  12. package/server/controllers/bizplace-initializer/groups.ts +0 -19
  13. package/server/controllers/bizplace-initializer/index.ts +0 -5
  14. package/server/controllers/bizplace-initializer/menus.ts +0 -42
  15. package/server/controllers/bizplace-initializer/settings.ts +0 -20
  16. package/server/controllers/company-initializer/business-register.ts +0 -59
  17. package/server/controllers/company-initializer/codes.ts +0 -147
  18. package/server/controllers/company-initializer/generate-company-roles.ts +0 -119
  19. package/server/controllers/company-initializer/index.ts +0 -6
  20. package/server/controllers/company-initializer/menus.ts +0 -359
  21. package/server/controllers/company-initializer/settings.ts +0 -33
  22. package/server/controllers/company-initializer/transporter.ts +0 -20
  23. package/server/controllers/index.ts +0 -0
  24. package/server/controllers/invitation.ts +0 -132
  25. package/server/controllers/utils/make-invitation-token.ts +0 -5
  26. package/server/controllers/utils/save-invitation-token.ts +0 -9
  27. package/server/entities/index.ts +0 -0
  28. package/server/errors/index.ts +0 -1
  29. package/server/errors/validation-error.ts +0 -17
  30. package/server/graphql/index.ts +0 -7
  31. package/server/graphql/resolvers/generators/generate-bizplace.ts +0 -40
  32. package/server/graphql/resolvers/generators/generate-company.ts +0 -76
  33. package/server/graphql/resolvers/generators/index.ts +0 -9
  34. package/server/graphql/resolvers/generators/update-domain-extType.ts +0 -55
  35. package/server/graphql/resolvers/index.ts +0 -8
  36. package/server/graphql/resolvers/invitations/index.ts +0 -5
  37. package/server/graphql/resolvers/invitations/partner-invitation.ts +0 -62
  38. package/server/graphql/resolvers/oauth2/company-roles-by-scope.ts +0 -38
  39. package/server/graphql/resolvers/oauth2/index.ts +0 -5
  40. package/server/graphql/resolvers/synchronization/auto-update-all-marketplace-product-variation-quantity.ts +0 -180
  41. package/server/graphql/resolvers/synchronization/create-dat-shipments.ts +0 -64
  42. package/server/graphql/resolvers/synchronization/fetch-sync-invoices.ts +0 -52
  43. package/server/graphql/resolvers/synchronization/fetch-sync-products.ts +0 -99
  44. package/server/graphql/resolvers/synchronization/fetch-sync-purchase-orders.ts +0 -75
  45. package/server/graphql/resolvers/synchronization/index.ts +0 -26
  46. package/server/graphql/resolvers/synchronization/sellercraft-pack-marketplace-order.ts +0 -91
  47. package/server/graphql/resolvers/synchronization/sync-all-products-to-sellercraft.ts +0 -39
  48. package/server/graphql/resolvers/synchronization/sync-products-from-account.ts +0 -40
  49. package/server/graphql/resolvers/synchronization/sync-products-to-account.ts +0 -64
  50. package/server/graphql/resolvers/synchronization/sync-products-to-sellercraft.ts +0 -176
  51. package/server/graphql/types/generators/generate-bizplace-input.ts +0 -11
  52. package/server/graphql/types/generators/generate-company-input.ts +0 -11
  53. package/server/graphql/types/generators/index.ts +0 -11
  54. package/server/graphql/types/generators/update-domain-type-input.ts +0 -8
  55. package/server/graphql/types/index.ts +0 -10
  56. package/server/graphql/types/invitations/index.ts +0 -5
  57. package/server/graphql/types/oauth2/company-role.ts +0 -8
  58. package/server/graphql/types/oauth2/index.ts +0 -7
  59. package/server/graphql/types/synchronization/index.ts +0 -33
  60. package/server/graphql/types/synchronization/sync-invoice-list.ts +0 -8
  61. package/server/graphql/types/synchronization/sync-invoice-set.ts +0 -38
  62. package/server/graphql/types/synchronization/sync-product-list.ts +0 -8
  63. package/server/graphql/types/synchronization/sync-product-set.ts +0 -8
  64. package/server/graphql/types/synchronization/sync-purchase-order-list.ts +0 -8
  65. package/server/graphql/types/synchronization/sync-purchase-order-set.ts +0 -28
  66. package/server/index.ts +0 -37
  67. package/server/middlewares/business-middleware.ts +0 -32
  68. package/server/middlewares/index.ts +0 -20
  69. package/server/middlewares/store-middleware.ts +0 -36
  70. package/server/middlewares/warehouse-middleware.ts +0 -36
  71. package/server/migrations/1597668478399-SeedBusinessDomain.ts +0 -34
  72. package/server/migrations/1597668478401-SeedBusinessRoles.ts +0 -377
  73. package/server/migrations/1608009991065-SeedUser.ts +0 -64
  74. package/server/migrations/index.ts +0 -9
  75. package/server/routers/api/index.ts +0 -3
  76. package/server/routers/api/restful-apis/unstable/add-contact-point.ts +0 -89
  77. package/server/routers/api/restful-apis/unstable/add-draft-release-order.ts +0 -198
  78. package/server/routers/api/restful-apis/unstable/add-inbound-order.ts +0 -246
  79. package/server/routers/api/restful-apis/unstable/add-marketplace-order.ts +0 -171
  80. package/server/routers/api/restful-apis/unstable/add-products.ts +0 -112
  81. package/server/routers/api/restful-apis/unstable/add-release-order.ts +0 -1061
  82. package/server/routers/api/restful-apis/unstable/add-sales-invoice.ts +0 -144
  83. package/server/routers/api/restful-apis/unstable/bizplace.ts +0 -45
  84. package/server/routers/api/restful-apis/unstable/cancel-marketplace-order.ts +0 -81
  85. package/server/routers/api/restful-apis/unstable/cancel-release-order.ts +0 -91
  86. package/server/routers/api/restful-apis/unstable/get-contact-point-list.ts +0 -110
  87. package/server/routers/api/restful-apis/unstable/get-delivery-order-detail.ts +0 -46
  88. package/server/routers/api/restful-apis/unstable/get-delivery-order-list.ts +0 -121
  89. package/server/routers/api/restful-apis/unstable/get-delivery-orders.ts +0 -178
  90. package/server/routers/api/restful-apis/unstable/get-goods-received-notes.ts +0 -134
  91. package/server/routers/api/restful-apis/unstable/get-inbound-order-detail.ts +0 -128
  92. package/server/routers/api/restful-apis/unstable/get-inbound-order-list.ts +0 -126
  93. package/server/routers/api/restful-apis/unstable/get-inventory-overall-product-group.ts +0 -99
  94. package/server/routers/api/restful-apis/unstable/get-inventory-product-group.ts +0 -107
  95. package/server/routers/api/restful-apis/unstable/get-marketplace-order-shipping-list.ts +0 -156
  96. package/server/routers/api/restful-apis/unstable/get-marketplace-store-list.ts +0 -81
  97. package/server/routers/api/restful-apis/unstable/get-onhand-inventories.ts +0 -125
  98. package/server/routers/api/restful-apis/unstable/get-partners.ts +0 -26
  99. package/server/routers/api/restful-apis/unstable/get-products.ts +0 -216
  100. package/server/routers/api/restful-apis/unstable/get-release-order-detail.ts +0 -138
  101. package/server/routers/api/restful-apis/unstable/get-release-order-list.ts +0 -199
  102. package/server/routers/api/restful-apis/unstable/get-warehouses.ts +0 -19
  103. package/server/routers/api/restful-apis/unstable/index.ts +0 -32
  104. package/server/routers/api/restful-apis/unstable/reject-inbound-order.ts +0 -46
  105. package/server/routers/api/restful-apis/unstable/set-marketplace-order-delivered.ts +0 -60
  106. package/server/routers/api/restful-apis/unstable/set-marketplace-order-failed-delivery.ts +0 -60
  107. package/server/routers/api/restful-apis/unstable/update-marketplace-order.ts +0 -111
  108. package/server/routers/api/restful-apis/unstable/update-marketplace-shipping-order.ts +0 -107
  109. package/server/routers/api/restful-apis/unstable/update-release-order-details.ts +0 -94
  110. package/server/routers/api/restful-apis/v1/add-contact-point.ts +0 -77
  111. package/server/routers/api/restful-apis/v1/add-draft-release-order.ts +0 -196
  112. package/server/routers/api/restful-apis/v1/add-inbound-order.ts +0 -243
  113. package/server/routers/api/restful-apis/v1/add-marketplace-order.ts +0 -172
  114. package/server/routers/api/restful-apis/v1/add-products.ts +0 -112
  115. package/server/routers/api/restful-apis/v1/add-release-order.ts +0 -967
  116. package/server/routers/api/restful-apis/v1/bizplace.ts +0 -45
  117. package/server/routers/api/restful-apis/v1/cancel-marketplace-order.ts +0 -81
  118. package/server/routers/api/restful-apis/v1/cancel-release-order.ts +0 -91
  119. package/server/routers/api/restful-apis/v1/get-contact-point-list.ts +0 -110
  120. package/server/routers/api/restful-apis/v1/get-delivery-order-detail.ts +0 -46
  121. package/server/routers/api/restful-apis/v1/get-delivery-order-list.ts +0 -121
  122. package/server/routers/api/restful-apis/v1/get-delivery-orders.ts +0 -178
  123. package/server/routers/api/restful-apis/v1/get-goods-received-notes.ts +0 -134
  124. package/server/routers/api/restful-apis/v1/get-inbound-order-detail.ts +0 -128
  125. package/server/routers/api/restful-apis/v1/get-inbound-order-list.ts +0 -126
  126. package/server/routers/api/restful-apis/v1/get-inventory-overall-product-group.ts +0 -99
  127. package/server/routers/api/restful-apis/v1/get-inventory-product-group.ts +0 -112
  128. package/server/routers/api/restful-apis/v1/get-marketplace-order-shipping-list.ts +0 -156
  129. package/server/routers/api/restful-apis/v1/get-marketplace-store-list.ts +0 -81
  130. package/server/routers/api/restful-apis/v1/get-onhand-inventories.ts +0 -125
  131. package/server/routers/api/restful-apis/v1/get-partners.ts +0 -26
  132. package/server/routers/api/restful-apis/v1/get-products.ts +0 -216
  133. package/server/routers/api/restful-apis/v1/get-release-order-detail.ts +0 -134
  134. package/server/routers/api/restful-apis/v1/get-release-order-list.ts +0 -198
  135. package/server/routers/api/restful-apis/v1/get-warehouses.ts +0 -19
  136. package/server/routers/api/restful-apis/v1/index.ts +0 -31
  137. package/server/routers/api/restful-apis/v1/reject-inbound-order.ts +0 -46
  138. package/server/routers/api/restful-apis/v1/set-marketplace-order-delivered.ts +0 -60
  139. package/server/routers/api/restful-apis/v1/set-marketplace-order-failed-delivery.ts +0 -60
  140. package/server/routers/api/restful-apis/v1/update-marketplace-order.ts +0 -111
  141. package/server/routers/api/restful-apis/v1/update-marketplace-shipping-order.ts +0 -104
  142. package/server/routers/api/restful-apis/v1/update-release-order-details.ts +0 -94
  143. package/server/routers/api/restful-apis/v2/add-contact-point.ts +0 -77
  144. package/server/routers/api/restful-apis/v2/add-draft-release-order.ts +0 -196
  145. package/server/routers/api/restful-apis/v2/add-inbound-order.ts +0 -243
  146. package/server/routers/api/restful-apis/v2/add-marketplace-order.ts +0 -172
  147. package/server/routers/api/restful-apis/v2/add-products.ts +0 -112
  148. package/server/routers/api/restful-apis/v2/add-release-order.ts +0 -967
  149. package/server/routers/api/restful-apis/v2/bizplace.ts +0 -45
  150. package/server/routers/api/restful-apis/v2/cancel-marketplace-order.ts +0 -81
  151. package/server/routers/api/restful-apis/v2/cancel-release-order.ts +0 -91
  152. package/server/routers/api/restful-apis/v2/get-contact-point-list.ts +0 -110
  153. package/server/routers/api/restful-apis/v2/get-delivery-order-detail.ts +0 -46
  154. package/server/routers/api/restful-apis/v2/get-delivery-order-list.ts +0 -121
  155. package/server/routers/api/restful-apis/v2/get-delivery-orders.ts +0 -178
  156. package/server/routers/api/restful-apis/v2/get-goods-received-notes.ts +0 -134
  157. package/server/routers/api/restful-apis/v2/get-inbound-order-detail.ts +0 -128
  158. package/server/routers/api/restful-apis/v2/get-inbound-order-list.ts +0 -126
  159. package/server/routers/api/restful-apis/v2/get-inventory-overall-product-group.ts +0 -99
  160. package/server/routers/api/restful-apis/v2/get-inventory-product-group.ts +0 -112
  161. package/server/routers/api/restful-apis/v2/get-marketplace-order-shipping-list.ts +0 -156
  162. package/server/routers/api/restful-apis/v2/get-marketplace-store-list.ts +0 -81
  163. package/server/routers/api/restful-apis/v2/get-onhand-inventories.ts +0 -125
  164. package/server/routers/api/restful-apis/v2/get-partners.ts +0 -26
  165. package/server/routers/api/restful-apis/v2/get-products.ts +0 -216
  166. package/server/routers/api/restful-apis/v2/get-release-order-detail.ts +0 -134
  167. package/server/routers/api/restful-apis/v2/get-release-order-list.ts +0 -198
  168. package/server/routers/api/restful-apis/v2/get-warehouses.ts +0 -19
  169. package/server/routers/api/restful-apis/v2/index.ts +0 -31
  170. package/server/routers/api/restful-apis/v2/reject-inbound-order.ts +0 -46
  171. package/server/routers/api/restful-apis/v2/set-marketplace-order-delivered.ts +0 -60
  172. package/server/routers/api/restful-apis/v2/set-marketplace-order-failed-delivery.ts +0 -60
  173. package/server/routers/api/restful-apis/v2/update-marketplace-order.ts +0 -111
  174. package/server/routers/api/restful-apis/v2/update-marketplace-shipping-order.ts +0 -104
  175. package/server/routers/api/restful-apis/v2/update-release-order-details.ts +0 -94
  176. package/server/routers/auth-invitation-router.ts +0 -25
  177. package/server/routers/business/bizplace-register-router.ts +0 -31
  178. package/server/routers/business/business-register-router.ts +0 -32
  179. package/server/routers/business/index.ts +0 -3
  180. package/server/routers/business/path-base-business-router.ts +0 -15
  181. package/server/routes.ts +0 -28
  182. package/server/templates/account-unlock-email.ts +0 -64
  183. package/server/templates/invitation-email.ts +0 -65
  184. package/server/templates/reset-password-email.ts +0 -64
  185. package/server/templates/verification-email.ts +0 -65
  186. package/server/utils/build-map.ts +0 -18
  187. package/server/utils/get-warehouses.ts +0 -115
  188. package/server/utils/index.ts +0 -3
  189. 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
- }