@things-factory/operato-hub 4.3.107 → 4.3.108

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 (326) hide show
  1. package/client/pages/bizplace/register.js +2 -0
  2. package/dist-server/controllers/bizplace-initializer/dataset/codes.js +1 -1
  3. package/dist-server/controllers/bizplace-initializer/dataset/codes.js.map +1 -1
  4. package/dist-server/graphql/resolvers/synchronization/sync-products-to-sellercraft.js +10 -9
  5. package/dist-server/graphql/resolvers/synchronization/sync-products-to-sellercraft.js.map +1 -1
  6. package/dist-server/middlewares/store-middleware.js.map +1 -1
  7. package/dist-server/routers/api/index.js +0 -1
  8. package/dist-server/routers/api/index.js.map +1 -1
  9. package/dist-server/routers/api/restful-apis/unstable/add-release-order.js +8 -8
  10. package/dist-server/routers/api/restful-apis/v1/company/add-contact-points.js +105 -0
  11. package/dist-server/routers/api/restful-apis/v1/company/add-contact-points.js.map +1 -0
  12. package/dist-server/routers/api/restful-apis/v1/company/add-marketplace-order.js +197 -0
  13. package/dist-server/routers/api/restful-apis/v1/company/add-marketplace-order.js.map +1 -0
  14. package/dist-server/routers/api/restful-apis/v1/company/add-products.js +69 -0
  15. package/dist-server/routers/api/restful-apis/v1/company/add-products.js.map +1 -0
  16. package/dist-server/routers/api/restful-apis/v1/company/cancel-marketplace-order.js +90 -0
  17. package/dist-server/routers/api/restful-apis/v1/company/cancel-marketplace-order.js.map +1 -0
  18. package/dist-server/routers/api/restful-apis/v1/company/get-bizplace-list.js +49 -0
  19. package/dist-server/routers/api/restful-apis/v1/company/get-bizplace-list.js.map +1 -0
  20. package/dist-server/routers/api/restful-apis/v1/company/get-contact-point-list.js +62 -0
  21. package/dist-server/routers/api/restful-apis/v1/company/get-contact-point-list.js.map +1 -0
  22. package/dist-server/routers/api/restful-apis/v1/company/get-marketplace-order-shipping-list.js +108 -0
  23. package/dist-server/routers/api/restful-apis/v1/company/get-marketplace-order-shipping-list.js.map +1 -0
  24. package/dist-server/routers/api/restful-apis/v1/company/get-marketplace-store-list.js +51 -0
  25. package/dist-server/routers/api/restful-apis/v1/company/get-marketplace-store-list.js.map +1 -0
  26. package/dist-server/routers/api/restful-apis/v1/company/get-partner-list.js +88 -0
  27. package/dist-server/routers/api/restful-apis/v1/company/get-partner-list.js.map +1 -0
  28. package/dist-server/routers/api/restful-apis/v1/company/get-product-list.js +98 -0
  29. package/dist-server/routers/api/restful-apis/v1/company/get-product-list.js.map +1 -0
  30. package/dist-server/routers/api/restful-apis/v1/company/index.js +15 -0
  31. package/dist-server/routers/api/restful-apis/v1/company/index.js.map +1 -0
  32. package/dist-server/routers/api/restful-apis/v1/company/update-marketplace-order-delivered.js +62 -0
  33. package/dist-server/routers/api/restful-apis/v1/company/update-marketplace-order-delivered.js.map +1 -0
  34. package/dist-server/routers/api/restful-apis/v1/company/update-marketplace-shipping-order.js +44 -0
  35. package/dist-server/routers/api/restful-apis/v1/company/update-marketplace-shipping-order.js.map +1 -0
  36. package/dist-server/routers/api/restful-apis/v1/index.js +2 -31
  37. package/dist-server/routers/api/restful-apis/v1/index.js.map +1 -1
  38. package/dist-server/routers/api/restful-apis/v1/middlewares/business-middleware.js +66 -0
  39. package/dist-server/routers/api/restful-apis/v1/middlewares/business-middleware.js.map +1 -0
  40. package/dist-server/routers/api/restful-apis/v1/middlewares/index.js +40 -0
  41. package/dist-server/routers/api/restful-apis/v1/middlewares/index.js.map +1 -0
  42. package/dist-server/routers/api/restful-apis/v1/middlewares/logging-middleware.js +23 -0
  43. package/dist-server/routers/api/restful-apis/v1/middlewares/logging-middleware.js.map +1 -0
  44. package/dist-server/routers/api/restful-apis/v1/middlewares/store-middleware.js +32 -0
  45. package/dist-server/routers/api/restful-apis/v1/middlewares/store-middleware.js.map +1 -0
  46. package/dist-server/routers/api/restful-apis/v1/middlewares/validation-middleware.js +118 -0
  47. package/dist-server/routers/api/restful-apis/v1/middlewares/validation-middleware.js.map +1 -0
  48. package/dist-server/routers/api/restful-apis/v1/middlewares/warehouse-middleware.js +31 -0
  49. package/dist-server/routers/api/restful-apis/v1/middlewares/warehouse-middleware.js.map +1 -0
  50. package/dist-server/routers/api/restful-apis/v1/utils/error-util.js +71 -0
  51. package/dist-server/routers/api/restful-apis/v1/utils/error-util.js.map +1 -0
  52. package/dist-server/routers/api/restful-apis/v1/utils/params.js +555 -0
  53. package/dist-server/routers/api/restful-apis/v1/utils/params.js.map +1 -0
  54. package/dist-server/routers/api/restful-apis/v1/utils/validate-util.js +60 -0
  55. package/dist-server/routers/api/restful-apis/v1/utils/validate-util.js.map +1 -0
  56. package/dist-server/routers/api/restful-apis/v1/warehouse/add-inbound-order.js +236 -0
  57. package/dist-server/routers/api/restful-apis/v1/warehouse/add-inbound-order.js.map +1 -0
  58. package/dist-server/routers/api/restful-apis/v1/warehouse/add-release-order.js +762 -0
  59. package/dist-server/routers/api/restful-apis/v1/warehouse/add-release-order.js.map +1 -0
  60. package/dist-server/routers/api/restful-apis/v1/warehouse/cancel-inbound-order.js +197 -0
  61. package/dist-server/routers/api/restful-apis/v1/warehouse/cancel-inbound-order.js.map +1 -0
  62. package/dist-server/routers/api/restful-apis/v1/warehouse/cancel-release-order.js +177 -0
  63. package/dist-server/routers/api/restful-apis/v1/warehouse/cancel-release-order.js.map +1 -0
  64. package/dist-server/routers/api/restful-apis/v1/warehouse/get-delivery-order-list.js +138 -0
  65. package/dist-server/routers/api/restful-apis/v1/warehouse/get-delivery-order-list.js.map +1 -0
  66. package/dist-server/routers/api/restful-apis/v1/warehouse/get-goods-received-note-list.js +97 -0
  67. package/dist-server/routers/api/restful-apis/v1/warehouse/get-goods-received-note-list.js.map +1 -0
  68. package/dist-server/routers/api/restful-apis/v1/warehouse/get-inbound-order-details.js +81 -0
  69. package/dist-server/routers/api/restful-apis/v1/warehouse/get-inbound-order-details.js.map +1 -0
  70. package/dist-server/routers/api/restful-apis/v1/warehouse/get-inbound-order-list.js +94 -0
  71. package/dist-server/routers/api/restful-apis/v1/warehouse/get-inbound-order-list.js.map +1 -0
  72. package/dist-server/routers/api/restful-apis/v1/warehouse/get-inventory-product-group-list.js +87 -0
  73. package/dist-server/routers/api/restful-apis/v1/warehouse/get-inventory-product-group-list.js.map +1 -0
  74. package/dist-server/routers/api/restful-apis/v1/warehouse/get-onhand-inventory-list.js +84 -0
  75. package/dist-server/routers/api/restful-apis/v1/warehouse/get-onhand-inventory-list.js.map +1 -0
  76. package/dist-server/routers/api/restful-apis/v1/warehouse/get-release-order-details.js +96 -0
  77. package/dist-server/routers/api/restful-apis/v1/warehouse/get-release-order-details.js.map +1 -0
  78. package/dist-server/routers/api/restful-apis/v1/warehouse/get-release-order-list.js +110 -0
  79. package/dist-server/routers/api/restful-apis/v1/warehouse/get-release-order-list.js.map +1 -0
  80. package/dist-server/routers/api/restful-apis/v1/warehouse/index.js +16 -0
  81. package/dist-server/routers/api/restful-apis/v1/warehouse/index.js.map +1 -0
  82. package/dist-server/routers/api/restful-apis/v1/warehouse/update-release-order-details.js +71 -0
  83. package/dist-server/routers/api/restful-apis/v1/warehouse/update-release-order-details.js.map +1 -0
  84. package/openapi/v1/Inventory.yaml +263 -0
  85. package/package.json +54 -54
  86. package/server/controllers/bizplace-initializer/dataset/codes.ts +1 -1
  87. package/server/graphql/resolvers/synchronization/sync-products-to-sellercraft.ts +25 -17
  88. package/server/middlewares/store-middleware.ts +1 -0
  89. package/server/routers/api/index.ts +0 -1
  90. package/server/routers/api/restful-apis/unstable/add-release-order.ts +8 -8
  91. package/server/routers/api/restful-apis/v1/company/add-contact-points.ts +111 -0
  92. package/server/routers/api/restful-apis/v1/company/add-marketplace-order.ts +234 -0
  93. package/server/routers/api/restful-apis/v1/company/add-products.ts +96 -0
  94. package/server/routers/api/restful-apis/v1/company/cancel-marketplace-order.ts +94 -0
  95. package/server/routers/api/restful-apis/v1/company/get-bizplace-list.ts +55 -0
  96. package/server/routers/api/restful-apis/v1/company/get-contact-point-list.ts +67 -0
  97. package/server/routers/api/restful-apis/v1/company/get-marketplace-order-shipping-list.ts +115 -0
  98. package/server/routers/api/restful-apis/v1/company/get-marketplace-store-list.ts +57 -0
  99. package/server/routers/api/restful-apis/v1/company/get-partner-list.ts +95 -0
  100. package/server/routers/api/restful-apis/v1/company/get-product-list.ts +103 -0
  101. package/server/routers/api/restful-apis/v1/company/index.ts +12 -0
  102. package/server/routers/api/restful-apis/v1/company/update-marketplace-order-delivered.ts +66 -0
  103. package/server/routers/api/restful-apis/v1/company/update-marketplace-shipping-order.ts +55 -0
  104. package/server/routers/api/restful-apis/v1/index.ts +2 -31
  105. package/server/routers/api/restful-apis/v1/middlewares/business-middleware.ts +68 -0
  106. package/server/routers/api/restful-apis/v1/middlewares/index.ts +26 -0
  107. package/server/routers/api/restful-apis/v1/middlewares/logging-middleware.ts +24 -0
  108. package/server/routers/api/restful-apis/v1/middlewares/store-middleware.ts +34 -0
  109. package/server/routers/api/restful-apis/v1/middlewares/validation-middleware.ts +116 -0
  110. package/server/routers/api/restful-apis/v1/middlewares/warehouse-middleware.ts +31 -0
  111. package/server/routers/api/restful-apis/v1/utils/error-util.ts +70 -0
  112. package/server/routers/api/restful-apis/v1/utils/params.ts +555 -0
  113. package/server/routers/api/restful-apis/v1/utils/validate-util.ts +53 -0
  114. package/server/routers/api/restful-apis/v1/warehouse/add-inbound-order.ts +324 -0
  115. package/server/routers/api/restful-apis/v1/warehouse/add-release-order.ts +941 -0
  116. package/server/routers/api/restful-apis/v1/warehouse/cancel-inbound-order.ts +261 -0
  117. package/server/routers/api/restful-apis/v1/warehouse/cancel-release-order.ts +258 -0
  118. package/server/routers/api/restful-apis/v1/warehouse/get-delivery-order-list.ts +141 -0
  119. package/server/routers/api/restful-apis/v1/warehouse/get-goods-received-note-list.ts +105 -0
  120. package/server/routers/api/restful-apis/v1/warehouse/get-inbound-order-details.ts +83 -0
  121. package/server/routers/api/restful-apis/v1/warehouse/get-inbound-order-list.ts +96 -0
  122. package/server/routers/api/restful-apis/v1/warehouse/get-inventory-product-group-list.ts +112 -0
  123. package/server/routers/api/restful-apis/v1/warehouse/get-onhand-inventory-list.ts +89 -0
  124. package/server/routers/api/restful-apis/v1/warehouse/get-release-order-details.ts +99 -0
  125. package/server/routers/api/restful-apis/v1/warehouse/get-release-order-list.ts +113 -0
  126. package/server/routers/api/restful-apis/v1/warehouse/index.ts +13 -0
  127. package/server/routers/api/restful-apis/v1/warehouse/update-release-order-details.ts +96 -0
  128. package/translations/en.json +2 -0
  129. package/translations/ko.json +2 -0
  130. package/translations/ms.json +2 -0
  131. package/translations/zh.json +2 -0
  132. package/dist-server/routers/api/restful-apis/v1/add-contact-point.js +0 -64
  133. package/dist-server/routers/api/restful-apis/v1/add-contact-point.js.map +0 -1
  134. package/dist-server/routers/api/restful-apis/v1/add-draft-release-order.js +0 -171
  135. package/dist-server/routers/api/restful-apis/v1/add-draft-release-order.js.map +0 -1
  136. package/dist-server/routers/api/restful-apis/v1/add-inbound-order.js +0 -213
  137. package/dist-server/routers/api/restful-apis/v1/add-inbound-order.js.map +0 -1
  138. package/dist-server/routers/api/restful-apis/v1/add-marketplace-order.js +0 -144
  139. package/dist-server/routers/api/restful-apis/v1/add-marketplace-order.js.map +0 -1
  140. package/dist-server/routers/api/restful-apis/v1/add-products.js +0 -88
  141. package/dist-server/routers/api/restful-apis/v1/add-products.js.map +0 -1
  142. package/dist-server/routers/api/restful-apis/v1/add-release-order.js +0 -774
  143. package/dist-server/routers/api/restful-apis/v1/add-release-order.js.map +0 -1
  144. package/dist-server/routers/api/restful-apis/v1/bizplace.js +0 -45
  145. package/dist-server/routers/api/restful-apis/v1/bizplace.js.map +0 -1
  146. package/dist-server/routers/api/restful-apis/v1/cancel-marketplace-order.js +0 -63
  147. package/dist-server/routers/api/restful-apis/v1/cancel-marketplace-order.js.map +0 -1
  148. package/dist-server/routers/api/restful-apis/v1/cancel-release-order.js +0 -66
  149. package/dist-server/routers/api/restful-apis/v1/cancel-release-order.js.map +0 -1
  150. package/dist-server/routers/api/restful-apis/v1/get-contact-point-list.js +0 -103
  151. package/dist-server/routers/api/restful-apis/v1/get-contact-point-list.js.map +0 -1
  152. package/dist-server/routers/api/restful-apis/v1/get-delivery-order-detail.js +0 -47
  153. package/dist-server/routers/api/restful-apis/v1/get-delivery-order-detail.js.map +0 -1
  154. package/dist-server/routers/api/restful-apis/v1/get-delivery-order-list.js +0 -124
  155. package/dist-server/routers/api/restful-apis/v1/get-delivery-order-list.js.map +0 -1
  156. package/dist-server/routers/api/restful-apis/v1/get-delivery-orders.js +0 -164
  157. package/dist-server/routers/api/restful-apis/v1/get-delivery-orders.js.map +0 -1
  158. package/dist-server/routers/api/restful-apis/v1/get-goods-received-notes.js +0 -120
  159. package/dist-server/routers/api/restful-apis/v1/get-goods-received-notes.js.map +0 -1
  160. package/dist-server/routers/api/restful-apis/v1/get-inbound-order-detail.js +0 -115
  161. package/dist-server/routers/api/restful-apis/v1/get-inbound-order-detail.js.map +0 -1
  162. package/dist-server/routers/api/restful-apis/v1/get-inbound-order-list.js +0 -125
  163. package/dist-server/routers/api/restful-apis/v1/get-inbound-order-list.js.map +0 -1
  164. package/dist-server/routers/api/restful-apis/v1/get-inventory-overall-product-group.js +0 -88
  165. package/dist-server/routers/api/restful-apis/v1/get-inventory-overall-product-group.js.map +0 -1
  166. package/dist-server/routers/api/restful-apis/v1/get-inventory-product-group.js +0 -101
  167. package/dist-server/routers/api/restful-apis/v1/get-inventory-product-group.js.map +0 -1
  168. package/dist-server/routers/api/restful-apis/v1/get-marketplace-order-shipping-list.js +0 -146
  169. package/dist-server/routers/api/restful-apis/v1/get-marketplace-order-shipping-list.js.map +0 -1
  170. package/dist-server/routers/api/restful-apis/v1/get-marketplace-store-list.js +0 -79
  171. package/dist-server/routers/api/restful-apis/v1/get-marketplace-store-list.js.map +0 -1
  172. package/dist-server/routers/api/restful-apis/v1/get-onhand-inventories.js +0 -110
  173. package/dist-server/routers/api/restful-apis/v1/get-onhand-inventories.js.map +0 -1
  174. package/dist-server/routers/api/restful-apis/v1/get-partners.js +0 -23
  175. package/dist-server/routers/api/restful-apis/v1/get-partners.js.map +0 -1
  176. package/dist-server/routers/api/restful-apis/v1/get-products.js +0 -210
  177. package/dist-server/routers/api/restful-apis/v1/get-products.js.map +0 -1
  178. package/dist-server/routers/api/restful-apis/v1/get-release-order-detail.js +0 -122
  179. package/dist-server/routers/api/restful-apis/v1/get-release-order-detail.js.map +0 -1
  180. package/dist-server/routers/api/restful-apis/v1/get-release-order-list.js +0 -191
  181. package/dist-server/routers/api/restful-apis/v1/get-release-order-list.js.map +0 -1
  182. package/dist-server/routers/api/restful-apis/v1/get-warehouses.js +0 -20
  183. package/dist-server/routers/api/restful-apis/v1/get-warehouses.js.map +0 -1
  184. package/dist-server/routers/api/restful-apis/v1/reject-inbound-order.js +0 -35
  185. package/dist-server/routers/api/restful-apis/v1/reject-inbound-order.js.map +0 -1
  186. package/dist-server/routers/api/restful-apis/v1/set-marketplace-order-delivered.js +0 -45
  187. package/dist-server/routers/api/restful-apis/v1/set-marketplace-order-delivered.js.map +0 -1
  188. package/dist-server/routers/api/restful-apis/v1/set-marketplace-order-failed-delivery.js +0 -45
  189. package/dist-server/routers/api/restful-apis/v1/set-marketplace-order-failed-delivery.js.map +0 -1
  190. package/dist-server/routers/api/restful-apis/v1/update-marketplace-order.js +0 -93
  191. package/dist-server/routers/api/restful-apis/v1/update-marketplace-order.js.map +0 -1
  192. package/dist-server/routers/api/restful-apis/v1/update-marketplace-shipping-order.js +0 -85
  193. package/dist-server/routers/api/restful-apis/v1/update-marketplace-shipping-order.js.map +0 -1
  194. package/dist-server/routers/api/restful-apis/v1/update-release-order-details.js +0 -82
  195. package/dist-server/routers/api/restful-apis/v1/update-release-order-details.js.map +0 -1
  196. package/dist-server/routers/api/restful-apis/v2/add-contact-point.js +0 -64
  197. package/dist-server/routers/api/restful-apis/v2/add-contact-point.js.map +0 -1
  198. package/dist-server/routers/api/restful-apis/v2/add-draft-release-order.js +0 -171
  199. package/dist-server/routers/api/restful-apis/v2/add-draft-release-order.js.map +0 -1
  200. package/dist-server/routers/api/restful-apis/v2/add-inbound-order.js +0 -213
  201. package/dist-server/routers/api/restful-apis/v2/add-inbound-order.js.map +0 -1
  202. package/dist-server/routers/api/restful-apis/v2/add-marketplace-order.js +0 -144
  203. package/dist-server/routers/api/restful-apis/v2/add-marketplace-order.js.map +0 -1
  204. package/dist-server/routers/api/restful-apis/v2/add-products.js +0 -88
  205. package/dist-server/routers/api/restful-apis/v2/add-products.js.map +0 -1
  206. package/dist-server/routers/api/restful-apis/v2/add-release-order.js +0 -774
  207. package/dist-server/routers/api/restful-apis/v2/add-release-order.js.map +0 -1
  208. package/dist-server/routers/api/restful-apis/v2/bizplace.js +0 -45
  209. package/dist-server/routers/api/restful-apis/v2/bizplace.js.map +0 -1
  210. package/dist-server/routers/api/restful-apis/v2/cancel-marketplace-order.js +0 -63
  211. package/dist-server/routers/api/restful-apis/v2/cancel-marketplace-order.js.map +0 -1
  212. package/dist-server/routers/api/restful-apis/v2/cancel-release-order.js +0 -66
  213. package/dist-server/routers/api/restful-apis/v2/cancel-release-order.js.map +0 -1
  214. package/dist-server/routers/api/restful-apis/v2/get-contact-point-list.js +0 -103
  215. package/dist-server/routers/api/restful-apis/v2/get-contact-point-list.js.map +0 -1
  216. package/dist-server/routers/api/restful-apis/v2/get-delivery-order-detail.js +0 -47
  217. package/dist-server/routers/api/restful-apis/v2/get-delivery-order-detail.js.map +0 -1
  218. package/dist-server/routers/api/restful-apis/v2/get-delivery-order-list.js +0 -124
  219. package/dist-server/routers/api/restful-apis/v2/get-delivery-order-list.js.map +0 -1
  220. package/dist-server/routers/api/restful-apis/v2/get-delivery-orders.js +0 -164
  221. package/dist-server/routers/api/restful-apis/v2/get-delivery-orders.js.map +0 -1
  222. package/dist-server/routers/api/restful-apis/v2/get-goods-received-notes.js +0 -120
  223. package/dist-server/routers/api/restful-apis/v2/get-goods-received-notes.js.map +0 -1
  224. package/dist-server/routers/api/restful-apis/v2/get-inbound-order-detail.js +0 -115
  225. package/dist-server/routers/api/restful-apis/v2/get-inbound-order-detail.js.map +0 -1
  226. package/dist-server/routers/api/restful-apis/v2/get-inbound-order-list.js +0 -125
  227. package/dist-server/routers/api/restful-apis/v2/get-inbound-order-list.js.map +0 -1
  228. package/dist-server/routers/api/restful-apis/v2/get-inventory-overall-product-group.js +0 -88
  229. package/dist-server/routers/api/restful-apis/v2/get-inventory-overall-product-group.js.map +0 -1
  230. package/dist-server/routers/api/restful-apis/v2/get-inventory-product-group.js +0 -101
  231. package/dist-server/routers/api/restful-apis/v2/get-inventory-product-group.js.map +0 -1
  232. package/dist-server/routers/api/restful-apis/v2/get-marketplace-order-shipping-list.js +0 -146
  233. package/dist-server/routers/api/restful-apis/v2/get-marketplace-order-shipping-list.js.map +0 -1
  234. package/dist-server/routers/api/restful-apis/v2/get-marketplace-store-list.js +0 -79
  235. package/dist-server/routers/api/restful-apis/v2/get-marketplace-store-list.js.map +0 -1
  236. package/dist-server/routers/api/restful-apis/v2/get-onhand-inventories.js +0 -110
  237. package/dist-server/routers/api/restful-apis/v2/get-onhand-inventories.js.map +0 -1
  238. package/dist-server/routers/api/restful-apis/v2/get-partners.js +0 -23
  239. package/dist-server/routers/api/restful-apis/v2/get-partners.js.map +0 -1
  240. package/dist-server/routers/api/restful-apis/v2/get-products.js +0 -210
  241. package/dist-server/routers/api/restful-apis/v2/get-products.js.map +0 -1
  242. package/dist-server/routers/api/restful-apis/v2/get-release-order-detail.js +0 -122
  243. package/dist-server/routers/api/restful-apis/v2/get-release-order-detail.js.map +0 -1
  244. package/dist-server/routers/api/restful-apis/v2/get-release-order-list.js +0 -191
  245. package/dist-server/routers/api/restful-apis/v2/get-release-order-list.js.map +0 -1
  246. package/dist-server/routers/api/restful-apis/v2/get-warehouses.js +0 -20
  247. package/dist-server/routers/api/restful-apis/v2/get-warehouses.js.map +0 -1
  248. package/dist-server/routers/api/restful-apis/v2/index.js +0 -34
  249. package/dist-server/routers/api/restful-apis/v2/index.js.map +0 -1
  250. package/dist-server/routers/api/restful-apis/v2/reject-inbound-order.js +0 -35
  251. package/dist-server/routers/api/restful-apis/v2/reject-inbound-order.js.map +0 -1
  252. package/dist-server/routers/api/restful-apis/v2/set-marketplace-order-delivered.js +0 -45
  253. package/dist-server/routers/api/restful-apis/v2/set-marketplace-order-delivered.js.map +0 -1
  254. package/dist-server/routers/api/restful-apis/v2/set-marketplace-order-failed-delivery.js +0 -45
  255. package/dist-server/routers/api/restful-apis/v2/set-marketplace-order-failed-delivery.js.map +0 -1
  256. package/dist-server/routers/api/restful-apis/v2/update-marketplace-order.js +0 -93
  257. package/dist-server/routers/api/restful-apis/v2/update-marketplace-order.js.map +0 -1
  258. package/dist-server/routers/api/restful-apis/v2/update-marketplace-shipping-order.js +0 -85
  259. package/dist-server/routers/api/restful-apis/v2/update-marketplace-shipping-order.js.map +0 -1
  260. package/dist-server/routers/api/restful-apis/v2/update-release-order-details.js +0 -82
  261. package/dist-server/routers/api/restful-apis/v2/update-release-order-details.js.map +0 -1
  262. package/server/routers/api/restful-apis/v1/add-contact-point.ts +0 -77
  263. package/server/routers/api/restful-apis/v1/add-draft-release-order.ts +0 -196
  264. package/server/routers/api/restful-apis/v1/add-inbound-order.ts +0 -242
  265. package/server/routers/api/restful-apis/v1/add-marketplace-order.ts +0 -172
  266. package/server/routers/api/restful-apis/v1/add-products.ts +0 -112
  267. package/server/routers/api/restful-apis/v1/add-release-order.ts +0 -967
  268. package/server/routers/api/restful-apis/v1/bizplace.ts +0 -45
  269. package/server/routers/api/restful-apis/v1/cancel-marketplace-order.ts +0 -81
  270. package/server/routers/api/restful-apis/v1/cancel-release-order.ts +0 -91
  271. package/server/routers/api/restful-apis/v1/get-contact-point-list.ts +0 -110
  272. package/server/routers/api/restful-apis/v1/get-delivery-order-detail.ts +0 -46
  273. package/server/routers/api/restful-apis/v1/get-delivery-order-list.ts +0 -121
  274. package/server/routers/api/restful-apis/v1/get-delivery-orders.ts +0 -178
  275. package/server/routers/api/restful-apis/v1/get-goods-received-notes.ts +0 -134
  276. package/server/routers/api/restful-apis/v1/get-inbound-order-detail.ts +0 -128
  277. package/server/routers/api/restful-apis/v1/get-inbound-order-list.ts +0 -126
  278. package/server/routers/api/restful-apis/v1/get-inventory-overall-product-group.ts +0 -99
  279. package/server/routers/api/restful-apis/v1/get-inventory-product-group.ts +0 -112
  280. package/server/routers/api/restful-apis/v1/get-marketplace-order-shipping-list.ts +0 -156
  281. package/server/routers/api/restful-apis/v1/get-marketplace-store-list.ts +0 -81
  282. package/server/routers/api/restful-apis/v1/get-onhand-inventories.ts +0 -125
  283. package/server/routers/api/restful-apis/v1/get-partners.ts +0 -24
  284. package/server/routers/api/restful-apis/v1/get-products.ts +0 -216
  285. package/server/routers/api/restful-apis/v1/get-release-order-detail.ts +0 -134
  286. package/server/routers/api/restful-apis/v1/get-release-order-list.ts +0 -198
  287. package/server/routers/api/restful-apis/v1/get-warehouses.ts +0 -18
  288. package/server/routers/api/restful-apis/v1/reject-inbound-order.ts +0 -46
  289. package/server/routers/api/restful-apis/v1/set-marketplace-order-delivered.ts +0 -60
  290. package/server/routers/api/restful-apis/v1/set-marketplace-order-failed-delivery.ts +0 -60
  291. package/server/routers/api/restful-apis/v1/update-marketplace-order.ts +0 -111
  292. package/server/routers/api/restful-apis/v1/update-marketplace-shipping-order.ts +0 -104
  293. package/server/routers/api/restful-apis/v1/update-release-order-details.ts +0 -94
  294. package/server/routers/api/restful-apis/v2/add-contact-point.ts +0 -77
  295. package/server/routers/api/restful-apis/v2/add-draft-release-order.ts +0 -196
  296. package/server/routers/api/restful-apis/v2/add-inbound-order.ts +0 -242
  297. package/server/routers/api/restful-apis/v2/add-marketplace-order.ts +0 -172
  298. package/server/routers/api/restful-apis/v2/add-products.ts +0 -112
  299. package/server/routers/api/restful-apis/v2/add-release-order.ts +0 -967
  300. package/server/routers/api/restful-apis/v2/bizplace.ts +0 -45
  301. package/server/routers/api/restful-apis/v2/cancel-marketplace-order.ts +0 -81
  302. package/server/routers/api/restful-apis/v2/cancel-release-order.ts +0 -91
  303. package/server/routers/api/restful-apis/v2/get-contact-point-list.ts +0 -110
  304. package/server/routers/api/restful-apis/v2/get-delivery-order-detail.ts +0 -46
  305. package/server/routers/api/restful-apis/v2/get-delivery-order-list.ts +0 -121
  306. package/server/routers/api/restful-apis/v2/get-delivery-orders.ts +0 -178
  307. package/server/routers/api/restful-apis/v2/get-goods-received-notes.ts +0 -134
  308. package/server/routers/api/restful-apis/v2/get-inbound-order-detail.ts +0 -128
  309. package/server/routers/api/restful-apis/v2/get-inbound-order-list.ts +0 -126
  310. package/server/routers/api/restful-apis/v2/get-inventory-overall-product-group.ts +0 -99
  311. package/server/routers/api/restful-apis/v2/get-inventory-product-group.ts +0 -112
  312. package/server/routers/api/restful-apis/v2/get-marketplace-order-shipping-list.ts +0 -156
  313. package/server/routers/api/restful-apis/v2/get-marketplace-store-list.ts +0 -81
  314. package/server/routers/api/restful-apis/v2/get-onhand-inventories.ts +0 -125
  315. package/server/routers/api/restful-apis/v2/get-partners.ts +0 -24
  316. package/server/routers/api/restful-apis/v2/get-products.ts +0 -216
  317. package/server/routers/api/restful-apis/v2/get-release-order-detail.ts +0 -134
  318. package/server/routers/api/restful-apis/v2/get-release-order-list.ts +0 -198
  319. package/server/routers/api/restful-apis/v2/get-warehouses.ts +0 -18
  320. package/server/routers/api/restful-apis/v2/index.ts +0 -31
  321. package/server/routers/api/restful-apis/v2/reject-inbound-order.ts +0 -46
  322. package/server/routers/api/restful-apis/v2/set-marketplace-order-delivered.ts +0 -60
  323. package/server/routers/api/restful-apis/v2/set-marketplace-order-failed-delivery.ts +0 -60
  324. package/server/routers/api/restful-apis/v2/update-marketplace-order.ts +0 -111
  325. package/server/routers/api/restful-apis/v2/update-marketplace-shipping-order.ts +0 -104
  326. package/server/routers/api/restful-apis/v2/update-release-order-details.ts +0 -94
@@ -0,0 +1,13 @@
1
+ import './cancel-inbound-order'
2
+ import './get-delivery-order-list'
3
+ import './get-goods-received-note-list'
4
+ import './get-inbound-order-details'
5
+ import './get-inbound-order-list'
6
+ import './get-inventory-product-group-list'
7
+ import './get-onhand-inventory-list'
8
+ import './get-release-order-details'
9
+ import './get-release-order-list'
10
+ import './add-release-order'
11
+ import './cancel-release-order'
12
+ import './update-release-order-details'
13
+ import './add-inbound-order'
@@ -0,0 +1,96 @@
1
+ import { getConnection, EntityManager, Not, In } from 'typeorm'
2
+
3
+ import { restfulApiRouter as router } from '@things-factory/api'
4
+ import { ReleaseGood, ShippingOrder, ORDER_STATUS } from '@things-factory/sales-base'
5
+ import { businessMiddleware, loggingMiddleware, validationMiddleware } from '../middlewares'
6
+ import { ApiError, ApiErrorHandler, throwInternalServerError } from '../utils/error-util'
7
+ import { OrderNoGenerator } from '@things-factory/sales-base'
8
+ import { getMyBizplace } from '@things-factory/biz-base'
9
+ import { User } from '@things-factory/auth-base'
10
+
11
+ const debug = require('debug')('things-factory:operato-hub:restful-api:v1:update-release-order-details')
12
+
13
+ router.post(
14
+ '/v1/warehouse/update-release-order-details',
15
+ businessMiddleware,
16
+ validationMiddleware,
17
+ loggingMiddleware,
18
+ async (context, next) => {
19
+ try {
20
+ const { domain } = context.state
21
+ const bodyReq = context.request.body.data
22
+ const { bizplaceId: customerBizplaceId } = bodyReq
23
+ const { user }: { user: User } = context.state
24
+
25
+ await getConnection().transaction(async (tx: EntityManager) => {
26
+ if (!customerBizplaceId) throw new ApiError('E04', 'warehouse id not found')
27
+
28
+ let patch: any = {}
29
+ patch.releaseGood = bodyReq.releaseGood
30
+
31
+ if (bodyReq?.shippingOrder) patch.shippingOrder = bodyReq.shippingOrder
32
+ else patch.shippingOrder = null
33
+
34
+ context.body = await updateReleaseGoodDetails(tx, domain, patch, user)
35
+ })
36
+ } catch (e) {
37
+ if (e instanceof ApiError) ApiErrorHandler(context, e)
38
+ else throwInternalServerError(context, e)
39
+ }
40
+ }
41
+ )
42
+
43
+ async function updateReleaseGoodDetails(tx, domain, patch, user) {
44
+ let { releaseGood, shippingOrder } = patch
45
+ let status = [ORDER_STATUS.DONE, ORDER_STATUS.CANCELLED, ORDER_STATUS.REJECTED]
46
+ let foundReleaseGood = await tx.getRepository(ReleaseGood).findOne({
47
+ where: {
48
+ id: releaseGood.roId,
49
+ domain
50
+ },
51
+ relations: ['shippingOrder']
52
+ })
53
+
54
+ if (!foundReleaseGood) {
55
+ throw new ApiError('E04', `release order: ${releaseGood.roId}`)
56
+ }
57
+
58
+ if (status.indexOf(foundReleaseGood.status) !== -1) {
59
+ throw new ApiError('E04', `release order status: ${foundReleaseGood.status}`)
60
+ }
61
+
62
+ // case to update existing shippingOrder
63
+ if (shippingOrder !== null) {
64
+ shippingOrder.remark = shippingOrder.exportRemark
65
+ shippingOrder.containerClosureDateTime = shippingOrder.containerClosureDate
66
+ ? new Date(shippingOrder?.containerClosureDate)
67
+ : null
68
+ delete shippingOrder.exportRemark
69
+ }
70
+
71
+ if (foundReleaseGood.shippingOrder && shippingOrder) {
72
+ await tx.getRepository(ShippingOrder).update(foundReleaseGood.shippingOrder.id, shippingOrder)
73
+ }
74
+ // case for new shippingOrder
75
+ else if (!foundReleaseGood.shippingOrder && shippingOrder) {
76
+ let newShippingOrder: ShippingOrder = await tx.getRepository(ShippingOrder).save({
77
+ ...shippingOrder,
78
+ name: OrderNoGenerator.shippingOrder(),
79
+ domain,
80
+ bizplace: await getMyBizplace(domain, user),
81
+ status: ORDER_STATUS.PENDING,
82
+ creator: user,
83
+ updater: user
84
+ })
85
+
86
+ releaseGood.shippingOrder = newShippingOrder
87
+ }
88
+
89
+ foundReleaseGood = await tx.getRepository(ReleaseGood).save({
90
+ ...foundReleaseGood,
91
+ ...releaseGood,
92
+ remark: releaseGood?.remark ? releaseGood.remark : null
93
+ })
94
+
95
+ return foundReleaseGood
96
+ }
@@ -37,6 +37,7 @@
37
37
  "label.warehouse": "warehouse",
38
38
 
39
39
  "text.are_you_sure_to_sync_product": "are you sure to sync product?",
40
+ "text.attachment_info_not_valid": "attachment info not valid",
40
41
  "text.nothing_to_sync": "no data available for synchronisation",
41
42
  "text.please_select_template_type": "please select template type",
42
43
  "text.please_wait": "please wait",
@@ -47,6 +48,7 @@
47
48
  "text.user_deleted_successfully": "user deleted successfully",
48
49
  "text.x_cannot_delete": "{x} cannot be deleted",
49
50
  "text.transform_to_x": "transform to {x}",
51
+ "text.contact_type_does_not_exist": "contact type does not exist",
50
52
 
51
53
  "error.company not found": "company not found",
52
54
  "error.eta date is invalid": "eta date is invalid",
@@ -17,6 +17,7 @@
17
17
  "label.state": "상태",
18
18
 
19
19
  "text.are_you_sure_to_sync_product": "상품을 동기화하시겠습니까?",
20
+ "text.attachment_info_not_valid": "첨부파일 정보 유효하지 않음",
20
21
  "text.nothing_to_sync": "[ko]no data available for synchronisation",
21
22
  "text.please_wait": "잠시만 기다려주세요.",
22
23
  "text.product_sync_to_accounting": "[ko]synchronising product to accounting platform",
@@ -55,6 +56,7 @@
55
56
  "text.transform_to_x": "{x}로 변경",
56
57
  "text.user_deleted_successfully": "성공적으로 사용자를 삭제하였습니다.",
57
58
  "text.x_cannot_delete": "{x}(은)는 삭제할 수 없습니다.",
59
+ "text.contact_type_does_not_exist": "[ko]contact type does not exist",
58
60
  "error.warehouse not found": "웨어하우스를 찾을 수 없습니다.",
59
61
  "error.warehouse not found in the company": "회사내에서 웨어하우스를 찾을 수 없습니다.",
60
62
 
@@ -32,12 +32,14 @@
32
32
  "label.warehouse": "[ms] warehouse",
33
33
 
34
34
  "text.are_you_sure_to_sync_product": "[ms] are you sure to sync product?",
35
+ "text.attachment_info_not_valid": "informasi lampiran tidak sah",
35
36
  "text.nothing_to_sync": "[ms] no data available for synchronisation",
36
37
  "text.please_select_template_type": "[ms] please select template type",
37
38
  "text.please_wait": "[ms] please wait",
38
39
  "text.product_sync_to_accounting": "[ms] synchronising product to accounting platform",
39
40
  "text.success": "[ms] success",
40
41
  "text.transform_to_x": "[ms] transform to {x}",
42
+ "text.contact_type_does_not_exist": "[ms]contact type does not exist",
41
43
 
42
44
  "error.company not found": "[ms] company not found",
43
45
  "error.eta date is invalid": "[ms] eta date is invalid",
@@ -36,12 +36,14 @@
36
36
  "label.warehouse": "仓库",
37
37
 
38
38
  "text.are_you_sure_to_sync_product": "您确定要同步产品信息吗?",
39
+ "text.attachment_info_not_valid": "attachment info not valid",
39
40
  "text.nothing_to_sync": "没有可用于同步的数据!",
40
41
  "text.please_select_template_type": "请选择模板类型!",
41
42
  "text.please_wait": "请等待",
42
43
  "text.product_sync_to_accounting": "正在将产品与会计平台同步",
43
44
  "text.success": "成功",
44
45
  "text.transform_to_x": "变更为{x}",
46
+ "text.contact_type_does_not_exist": "[zh]contact type does not exist",
45
47
 
46
48
  "error.company not found": "未找到公司信息。",
47
49
  "error.eta date is invalid": "[zh] eta date is invalid",
@@ -1,64 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.checkMandatoryKey = void 0;
7
- const api_1 = require("@things-factory/api");
8
- const graphql_tag_1 = __importDefault(require("graphql-tag"));
9
- const business_middleware_1 = require("../../../../middlewares/business-middleware");
10
- const warehouse_middleware_1 = require("../../../../middlewares/warehouse-middleware");
11
- const debug = require('debug')('things-factory:operato-hub:restful-api:v1:add-contact-point');
12
- api_1.restfulApiRouter.post('/v1/warehouse/:warehouseId/add-contact-point', business_middleware_1.businessMiddleware, warehouse_middleware_1.warehouseMiddleware, async (context, next) => {
13
- var _a;
14
- const { client, warehouse: bizplace, domain } = context.state;
15
- const { warehouseId } = context.params;
16
- const { t } = context;
17
- let bodyReq = context.request.body;
18
- if (!warehouseId)
19
- context.throw(404, t('error.warehouse id not found'));
20
- if (typeof bodyReq === undefined || !((_a = Object.keys(bodyReq)) === null || _a === void 0 ? void 0 : _a.length)) {
21
- context.throw(400, context.t('error.invalid body request format'));
22
- }
23
- await checkMandatoryKey(context, bodyReq);
24
- debug('post:/add-contact-point request.body', bodyReq);
25
- let patches = bodyReq.map(record => {
26
- let patch = Object.assign({}, record);
27
- patch.cuFlag = '+';
28
- return patch;
29
- });
30
- context.body = {
31
- result: (await client.query({
32
- query: (0, graphql_tag_1.default) `
33
- mutation updateMultipleContactPoint($patches: [ContactPointPatch]!) {
34
- updateMultipleContactPoint(patches: $patches) {
35
- name
36
- companyName
37
- phone
38
- address
39
- address2
40
- city
41
- state
42
- postalCode
43
- type
44
- fax
45
- email
46
- address
47
- billingAddress
48
- accountNo
49
- }
50
- }
51
- `,
52
- variables: { patches },
53
- context: Object.assign(Object.assign({}, context), { state: Object.assign(Object.assign({}, context.state), { bizplace,
54
- domain }) })
55
- })).data
56
- };
57
- });
58
- async function checkMandatoryKey(context, params) {
59
- let noparams = ['name', 'email', 'phone', 'address', 'billingAddress', 'type'].filter(param => !(param in params));
60
- if (noparams === null || noparams === void 0 ? void 0 : noparams.length)
61
- context.throw(400, context.t('error.required param x not found', { x: `${noparams.join(', ')}` }));
62
- }
63
- exports.checkMandatoryKey = checkMandatoryKey;
64
- //# sourceMappingURL=add-contact-point.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"add-contact-point.js","sourceRoot":"","sources":["../../../../../server/routers/api/restful-apis/v1/add-contact-point.ts"],"names":[],"mappings":";;;;;;AAAA,6CAAgE;AAChE,8DAA6B;AAC7B,qFAAgF;AAChF,uFAAkF;AAElF,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,6DAA6D,CAAC,CAAA;AAE7F,sBAAM,CAAC,IAAI,CACT,8CAA8C,EAC9C,wCAAkB,EAClB,0CAAmB,EACnB,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;;IACtB,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;IAC7D,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,MAAM,CAAA;IACtC,MAAM,EAAE,CAAC,EAAE,GAAG,OA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AAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,MAAM,CAAC,CAAC,CAAA;IAElH,IAAI,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM;QAClB,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,kCAAkC,EAAE,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;AACtG,CAAC;AALD,8CAKC"}
@@ -1,171 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.checkMandatoryKey = void 0;
7
- const graphql_tag_1 = __importDefault(require("graphql-tag"));
8
- const typeorm_1 = require("typeorm");
9
- const api_1 = require("@things-factory/api");
10
- const biz_base_1 = require("@things-factory/biz-base");
11
- const business_middleware_1 = require("../../../../middlewares/business-middleware");
12
- const warehouse_middleware_1 = require("../../../../middlewares/warehouse-middleware");
13
- const debug = require('debug')('things-factory:operato-hub:restful-api:unstable:add-draft-release-order');
14
- api_1.restfulApiRouter.post('/v1/warehouse/:warehouseId/add-draft-release-order', business_middleware_1.businessMiddleware, warehouse_middleware_1.warehouseMiddleware, async (context, next) => {
15
- return await (0, typeorm_1.getConnection)().transaction(async (tx) => {
16
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
17
- const { client, domain } = context.state;
18
- const { warehouseId: customerBizplaceId } = context.params;
19
- const { t } = context;
20
- if (!customerBizplaceId)
21
- context.throw(404, t('error.warehouse id not found'));
22
- let bodyReq = context.request.body;
23
- if (typeof bodyReq === undefined || !((_a = Object.keys(bodyReq)) === null || _a === void 0 ? void 0 : _a.length)) {
24
- context.throw(400, t('error.invalid body request format'));
25
- }
26
- debug('post:/add-draft-release-order request.body', bodyReq);
27
- await checkMandatoryKey(context, bodyReq);
28
- // get customer company's bizplace
29
- const customerBizplace = await tx.getRepository(biz_base_1.Bizplace).findOne({
30
- where: { id: customerBizplaceId }
31
- });
32
- const orderInventories = bodyReq.orderInventories;
33
- context.body = {
34
- result: (await client.mutate({
35
- mutation: (0, graphql_tag_1.default) `
36
- mutation upsertDraftReleaseGood(
37
- $draftReleaseGood: DraftReleaseGoodPatch!
38
- $orderProducts: [OrderProductPatch!]!
39
- $files: [Upload!]
40
- ) {
41
- upsertDraftReleaseGood(
42
- draftReleaseGood: $draftReleaseGood
43
- orderProducts: $orderProducts
44
- files: $files
45
- ) {
46
- id
47
- name
48
- refNo
49
- refNo2
50
- refNo3
51
- status
52
- truckNo
53
- ownTransport
54
- marketplaceOrderStatus
55
- billingAddress
56
- deliveryAddress1
57
- deliveryAddress2
58
- deliveryAddress3
59
- deliveryAddress4
60
- deliveryAddress5
61
- attentionTo
62
- attentionCompany
63
- city
64
- state
65
- postalCode
66
- country
67
- phone1
68
- phone2
69
- email
70
- type
71
- exportOption
72
- releaseDate
73
- collectionOrderNo
74
- bizplace {
75
- name
76
- }
77
- orderProducts {
78
- product {
79
- sku
80
- name
81
- description
82
- }
83
- packingType
84
- packingSize
85
- releaseQty
86
- }
87
- }
88
- }
89
- `,
90
- variables: {
91
- draftReleaseGood: {
92
- bizplace: {
93
- id: customerBizplace.id
94
- },
95
- courierOption: bodyReq.courierOption,
96
- collectionOrderNo: bodyReq.collectionOrderNo,
97
- exportOption: bodyReq.exportOption,
98
- ownTransport: bodyReq.ownTransport,
99
- packingOption: bodyReq.packingOption,
100
- refNo: bodyReq.refNo,
101
- refNo2: bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.refNo2,
102
- refNo3: bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.refNo3,
103
- releaseDate: bodyReq.releaseDate,
104
- type: bodyReq.type,
105
- marketplaceOrderStatus: bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.marketplaceOrderStatus,
106
- remark: (bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.remark) || null,
107
- billingAddress: ((_b = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.billTo) === null || _b === void 0 ? void 0 : _b.billingAddress) || null,
108
- deliveryAddress1: ((_c = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _c === void 0 ? void 0 : _c.deliveryAddress1) || null,
109
- deliveryAddress2: ((_d = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _d === void 0 ? void 0 : _d.deliveryAddress2) || null,
110
- deliveryAddress3: ((_e = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _e === void 0 ? void 0 : _e.deliveryAddress3) || null,
111
- deliveryAddress4: ((_f = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _f === void 0 ? void 0 : _f.deliveryAddress4) || null,
112
- deliveryAddress5: ((_g = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _g === void 0 ? void 0 : _g.deliveryAddress5) || null,
113
- attentionTo: ((_h = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _h === void 0 ? void 0 : _h.attentionTo) || null,
114
- attentionCompany: ((_j = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _j === void 0 ? void 0 : _j.attentionCompany) || null,
115
- city: ((_k = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _k === void 0 ? void 0 : _k.city) || null,
116
- state: ((_l = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _l === void 0 ? void 0 : _l.state) || null,
117
- postalCode: ((_m = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _m === void 0 ? void 0 : _m.postalCode) || null,
118
- country: ((_o = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _o === void 0 ? void 0 : _o.country) || null,
119
- phone1: ((_p = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _p === void 0 ? void 0 : _p.phone1) || null,
120
- phone2: ((_q = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _q === void 0 ? void 0 : _q.phone2) || null,
121
- email: ((_r = bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.deliverTo) === null || _r === void 0 ? void 0 : _r.email) || null
122
- },
123
- orderProducts: orderInventories,
124
- files: []
125
- },
126
- context: Object.assign(Object.assign({}, context), { hasUpload: true, state: Object.assign(Object.assign({}, context.state), { customerBizplace,
127
- domain, type: 'api' }) })
128
- })).data
129
- };
130
- });
131
- });
132
- async function checkMandatoryKey(context, params) {
133
- let noparams = ['releaseDate', 'exportOption'].filter(param => !(param in params));
134
- if ('ownTransport' in params) {
135
- if (params.ownTransport == true) {
136
- if (!params.hasOwnProperty('collectionOrderNo')) {
137
- noparams.push('collectionOrderNo');
138
- }
139
- }
140
- }
141
- else {
142
- noparams.push('ownTransport');
143
- }
144
- if ('exportOption' in params) {
145
- if (params.exportOption === true) {
146
- if (params.exportOption.filter(record => !record.containerNo || !record.containerArrivalDate || !record.containerLeavingDate || !record.shipName).length) {
147
- noparams.push('exportOption');
148
- }
149
- }
150
- }
151
- if ('orderInventories' in params) {
152
- params.orderInventories.forEach((param, key) => {
153
- let noSubParams = [];
154
- if (!(param === null || param === void 0 ? void 0 : param.releaseQty))
155
- noSubParams.push('releaseQty');
156
- if (!(param === null || param === void 0 ? void 0 : param.product))
157
- noSubParams.push('product');
158
- if (noSubParams === null || noSubParams === void 0 ? void 0 : noSubParams.length)
159
- context.throw(400, context.t('error.required param x not found', { x: `${noSubParams.join(', ')}` }));
160
- });
161
- }
162
- else {
163
- noparams.push('orderInventories');
164
- }
165
- if (noparams === null || noparams === void 0 ? void 0 : noparams.length) {
166
- context.throw(400, context.t('error.required param x not found', { x: `${noparams.join(', ')}` }));
167
- }
168
- return params;
169
- }
170
- exports.checkMandatoryKey = checkMandatoryKey;
171
- //# sourceMappingURL=add-draft-release-order.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"add-draft-release-order.js","sourceRoot":"","sources":["../../../../../server/routers/api/restful-apis/v1/add-draft-release-order.ts"],"names":[],"mappings":";;;;;;AAAA,8DAA6B;AAC7B,qCAAsD;AAEtD,6CAAgE;AAChE,uDAAmD;AAGnD,qFAAgF;AAChF,uFAAkF;AAElF,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,yEAAyE,CAAC,CAAA;AAEzG,sBAAM,CAAC,IAAI,CACT,oDAAoD,EACpD,wCAAkB,EAClB,0CAAmB,EACnB,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACtB,OAAO,MAAM,IAAA,uBAAa,GAAE,CAAC,WAAW,CAAC,KAAK,EAAE,EAAiB,EAAE,EAAE;;QACnE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QACxC,MAAM,EAAE,WAAW,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC,MAAM,CAAA;QAC1D,MAAM,EAAE,CAAC,EAAE,GAAG,OAAO,CAAA;QAErB,IAAI,CAAC,kBAAkB;YAAE,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,8BAA8B,CAAC,CAAC,CAAA;QAE9E,IAAI,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAA;QAClC,IAAI,OAAO,OAAO,KAAK,SAAS,IAAI,CAAC,CAAA,MAAA,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,0CAAE,MAAM,CAAA,EAAE;YACjE,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,mCAAmC,CAAC,CAAC,CAAA;SAC3D;QACD,KAAK,CAAC,4CAA4C,EAAE,OAAO,CAAC,CAAA;QAC5D,MAAM,iBAAiB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA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,MAAM,EACR;gBACA,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,CAAA;aAC9B;SACF;KACF;IAED,IAAI,kBAAkB,IAAI,MAAM,EAAE;QAChC,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;YAC7C,IAAI,WAAW,GAAG,EAAE,CAAA;YAEpB,IAAI,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,UAAU,CAAA;gBAAE,WAAW,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;YAEtD,IAAI,CAAC,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,OAAO,CAAA;gBAAE,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;YAEhD,IAAI,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,MAAM;gBACrB,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,kCAAkC,EAAE,EAAE,CAAC,EAAE,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;QACzG,CAAC,CAAC,CAAA;KACH;SAAM;QACL,QAAQ,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAA;KAClC;IAED,IAAI,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,EAAE;QACpB,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,kCAAkC,EAAE,EAAE,CAAC,EAAE,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;KACnG;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AA9CD,8CA8CC"}
@@ -1,213 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.checkMandatoryKey = void 0;
7
- const graphql_tag_1 = __importDefault(require("graphql-tag"));
8
- const typeorm_1 = require("typeorm");
9
- const api_1 = require("@things-factory/api");
10
- const biz_base_1 = require("@things-factory/biz-base");
11
- const product_base_1 = require("@things-factory/product-base");
12
- const business_middleware_1 = require("../../../../middlewares/business-middleware");
13
- const warehouse_middleware_1 = require("../../../../middlewares/warehouse-middleware");
14
- const debug = require('debug')('things-factory:operato-hub:restful-api:v1:add-inbound-order');
15
- api_1.restfulApiRouter.post('/v1/warehouse/:warehouseId/add-inbound-order', business_middleware_1.businessMiddleware, warehouse_middleware_1.warehouseMiddleware, async (context, next) => {
16
- var _a;
17
- const { client, domain } = context.state;
18
- const { warehouseId } = context.params;
19
- const { t } = context;
20
- const attachments = undefined;
21
- let bodyReq = context.request.body;
22
- if (!warehouseId)
23
- context.throw(404, t('error.warehouse id not found'));
24
- if (typeof bodyReq === undefined || !((_a = Object.keys(bodyReq)) === null || _a === void 0 ? void 0 : _a.length)) {
25
- context.throw(400, t('error.invalid body request format'));
26
- }
27
- await checkMandatoryKey(context, bodyReq);
28
- debug('post:/add-inbound-order request.body', bodyReq);
29
- // get customer company's bizplace
30
- const custCompanyBizplace = await (0, biz_base_1.getCompanyBizplace)(null, null, warehouseId);
31
- const customerBizplace = await (0, typeorm_1.getRepository)(biz_base_1.Bizplace).findOne({
32
- where: { id: warehouseId }
33
- });
34
- //#1 to get all product list
35
- const productDetails = await (0, typeorm_1.getRepository)(product_base_1.ProductDetail).find({
36
- where: {
37
- domain: custCompanyBizplace.domain,
38
- refCode: (0, typeorm_1.In)(bodyReq.orderProducts.map(orderProduct => orderProduct.product.sku))
39
- },
40
- relations: ['product']
41
- });
42
- //#2 assign product id found to order product
43
- bodyReq.orderProducts = bodyReq.orderProducts.map(orderProduct => {
44
- productDetails.forEach(productDetail => {
45
- const product = productDetail.product;
46
- const packingType = productDetail.packingType;
47
- const packingSize = productDetail.packingSize;
48
- if (orderProduct.product.sku === productDetail.refCode) {
49
- orderProduct.product.id = product.id;
50
- if (packingType) {
51
- orderProduct.packingType = packingType;
52
- orderProduct.packingSize = packingSize;
53
- orderProduct.uom = productDetail.uom;
54
- orderProduct.uomValue = productDetail.uomValue;
55
- orderProduct.totalUomValue = `${(productDetail.uomValue * orderProduct.packQty).toFixed(2)} ${productDetail.uom}`;
56
- }
57
- else {
58
- productDetail = productDetails.find(productDetail => productDetail.isDefault);
59
- orderProduct.packingType = productDetail.packingType;
60
- orderProduct.packingSize = productDetail.packingSize;
61
- orderProduct.uom = productDetail.uom;
62
- orderProduct.uomValue = productDetail.uomValue;
63
- orderProduct.totalUomValue = `${(productDetail.uomValue * orderProduct.packQty).toFixed(2)} ${productDetail.uom}`;
64
- }
65
- }
66
- });
67
- return orderProduct;
68
- });
69
- //#3 check if product is not found
70
- bodyReq.orderProducts.forEach(orderProduct => {
71
- var _a;
72
- if (!((_a = orderProduct.product) === null || _a === void 0 ? void 0 : _a.id))
73
- context.throw(404, t(`error.sku code ${orderProduct.product.sku} is not exist`));
74
- });
75
- //#4 include supplier id if there's any
76
- if (bodyReq === null || bodyReq === void 0 ? void 0 : bodyReq.supplier) {
77
- const supplierInfo = bodyReq.supplier;
78
- const foundSupplier = await (0, typeorm_1.getRepository)(biz_base_1.ContactPoint).findOne({
79
- where: {
80
- domain,
81
- bizplace: warehouseId,
82
- name: supplierInfo.name,
83
- companyName: supplierInfo.companyName,
84
- email: supplierInfo.email,
85
- accountNo: supplierInfo.accountNo,
86
- type: 'SUPPLIER'
87
- }
88
- });
89
- if (foundSupplier)
90
- bodyReq.supplier = foundSupplier.id;
91
- else
92
- context.throw(404, t('error.supplier not found'));
93
- }
94
- context.body = {
95
- result: (await client.mutate({
96
- mutation: (0, graphql_tag_1.default) `
97
- mutation addArrivalNotice($arrivalNotice: NewArrivalNotice!, $attachments: Upload) {
98
- addArrivalNotice(arrivalNotice: $arrivalNotice, file: $attachments) {
99
- name
100
- refNo
101
- etaDate
102
- containerNo
103
- ownTransport
104
- crossDocking
105
- releaseGood {
106
- name
107
- }
108
- etaDate
109
- looseItem
110
- deliveryOrderNo
111
- status
112
- truckNo
113
- refNo
114
- importCargo
115
- orderProducts {
116
- batchId
117
- product {
118
- sku
119
- name
120
- description
121
- packingType
122
- type
123
- }
124
- packingType
125
- uom
126
- uomValue
127
- packQty
128
- totalUomValue
129
- palletQty
130
- }
131
- orderVass {
132
- vas {
133
- name
134
- operationGuide
135
- operationGuideType
136
- }
137
- set
138
- targetType
139
- targetBatchId
140
- targetProduct {
141
- name
142
- description
143
- }
144
- packingType
145
- qty
146
- uomValue
147
- otherTarget
148
- description
149
- remark
150
- operationGuide
151
- }
152
- supplier {
153
- companyName
154
- name
155
- phone
156
- email
157
- address
158
- }
159
- }
160
- }
161
- `,
162
- variables: { arrivalNotice: Object.assign(Object.assign({}, bodyReq), { warehouseId }), attachments },
163
- context: Object.assign(Object.assign({}, context), { hasUpload: true, state: Object.assign(Object.assign({}, context.state), { bizplace: customerBizplace, domain, type: 'api' }) })
164
- })).data
165
- };
166
- });
167
- function checkMandatoryKey(context, params) {
168
- let noparams = [];
169
- if ('container' in params) {
170
- if (params.container === true) {
171
- if (!params.hasOwnProperty('containerNo') || !params.hasOwnProperty('containerSize')) {
172
- noparams.push('containerInfo');
173
- }
174
- }
175
- }
176
- if ('orderProducts' in params) {
177
- params.orderProducts.forEach((param, key) => {
178
- let noSubParams = [];
179
- if (!param.batchId)
180
- noSubParams.push('batchId');
181
- if (!param.packQty)
182
- noSubParams.push('packQty');
183
- if (!param.product.sku)
184
- noSubParams.push('sku');
185
- if (noSubParams === null || noSubParams === void 0 ? void 0 : noSubParams.length)
186
- context.throw(400, context.t('error.required param x not found', { x: `${noSubParams.join(', ')}` }));
187
- });
188
- }
189
- else {
190
- noparams.push('orderProducts');
191
- }
192
- if ('etaDate' in params) {
193
- const etaDate = new Date(params.etaDate);
194
- if (isNaN(etaDate.getDate()))
195
- context.throw(400, context.t('error.eta date is invalid'));
196
- }
197
- if ('supplier' in params) {
198
- const supplierInfo = params.supplier;
199
- if (!(supplierInfo === null || supplierInfo === void 0 ? void 0 : supplierInfo.name))
200
- context.throw(400, context.t('error.required param x not found', { x: 'supplierInfo.name' }));
201
- if (!(supplierInfo === null || supplierInfo === void 0 ? void 0 : supplierInfo.companyName))
202
- context.throw(400, context.t('error.required param x not found', { x: 'supplierInfo.companyName' }));
203
- if (!(supplierInfo === null || supplierInfo === void 0 ? void 0 : supplierInfo.email))
204
- context.throw(400, context.t('error.required param x not found', { x: 'supplierInfo.email' }));
205
- if (!(supplierInfo === null || supplierInfo === void 0 ? void 0 : supplierInfo.accountNo))
206
- context.throw(400, context.t('error.required param x not found', { x: 'supplierInfo.accountNo' }));
207
- }
208
- if (noparams.length > 0) {
209
- context.throw(400, context.t('error.required param x not found', { x: `${noparams.join(', ')}` }));
210
- }
211
- }
212
- exports.checkMandatoryKey = checkMandatoryKey;
213
- //# sourceMappingURL=add-inbound-order.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"add-inbound-order.js","sourceRoot":"","sources":["../../../../../server/routers/api/restful-apis/v1/add-inbound-order.ts"],"names":[],"mappings":";;;;;;AAAA,8DAA6B;AAC7B,qCAA2C;AAE3C,6CAAgE;AAChE,uDAAqF;AACrF,+DAAqE;AAErE,qFAAgF;AAChF,uFAAkF;AAElF,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,6DAA6D,CAAC,CAAA;AAE7F,sBAAM,CAAC,IAAI,CACT,8CAA8C,EAC9C,wCAAkB,EAClB,0CAAmB,EACnB,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;;IACtB,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;IACxC,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,MAAM,CAAA;IACtC,MAAM,EAAE,CAAC,EAAE,GAAG,OAAO,CAAA;IACrB,MAAM,WAAW,GAAG,SAAS,CAAA;IAC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