@things-factory/operato-hub 4.3.0-alpha.1 → 4.3.2

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 (63) hide show
  1. package/client/pages/constants/setting.js +1 -0
  2. package/dist-server/controllers/bizplace-initializer/dataset/codes.js +9 -0
  3. package/dist-server/controllers/bizplace-initializer/dataset/codes.js.map +1 -1
  4. package/dist-server/controllers/bizplace-initializer/dataset/index.js +1 -5
  5. package/dist-server/controllers/bizplace-initializer/dataset/index.js.map +1 -1
  6. package/dist-server/controllers/bizplace-initializer/dataset/settings.js +10 -0
  7. package/dist-server/controllers/bizplace-initializer/dataset/settings.js.map +1 -1
  8. package/dist-server/controllers/bizplace-initializer/index.js +1 -5
  9. package/dist-server/controllers/bizplace-initializer/index.js.map +1 -1
  10. package/dist-server/controllers/company-initializer/index.js +1 -5
  11. package/dist-server/controllers/company-initializer/index.js.map +1 -1
  12. package/dist-server/graphql/index.js +1 -5
  13. package/dist-server/graphql/index.js.map +1 -1
  14. package/dist-server/graphql/resolvers/index.js +1 -5
  15. package/dist-server/graphql/resolvers/index.js.map +1 -1
  16. package/dist-server/graphql/types/index.js +1 -5
  17. package/dist-server/graphql/types/index.js.map +1 -1
  18. package/dist-server/index.js +1 -5
  19. package/dist-server/index.js.map +1 -1
  20. package/dist-server/routers/api/restful-apis/unstable/add-draft-release-order.js +171 -0
  21. package/dist-server/routers/api/restful-apis/unstable/add-draft-release-order.js.map +1 -0
  22. package/dist-server/routers/api/restful-apis/unstable/add-marketplace-order.js +85 -75
  23. package/dist-server/routers/api/restful-apis/unstable/add-marketplace-order.js.map +1 -1
  24. package/dist-server/routers/api/restful-apis/unstable/add-release-order.js +147 -35
  25. package/dist-server/routers/api/restful-apis/unstable/add-release-order.js.map +1 -1
  26. package/dist-server/routers/api/restful-apis/unstable/index.js +1 -0
  27. package/dist-server/routers/api/restful-apis/unstable/index.js.map +1 -1
  28. package/dist-server/routers/api/restful-apis/v1/add-draft-release-order.js +171 -0
  29. package/dist-server/routers/api/restful-apis/v1/add-draft-release-order.js.map +1 -0
  30. package/dist-server/routers/api/restful-apis/v1/add-marketplace-order.js +85 -75
  31. package/dist-server/routers/api/restful-apis/v1/add-marketplace-order.js.map +1 -1
  32. package/dist-server/routers/api/restful-apis/v1/add-release-order.js +146 -34
  33. package/dist-server/routers/api/restful-apis/v1/add-release-order.js.map +1 -1
  34. package/dist-server/routers/api/restful-apis/v1/index.js +1 -0
  35. package/dist-server/routers/api/restful-apis/v1/index.js.map +1 -1
  36. package/dist-server/routers/api/restful-apis/v2/add-draft-release-order.js +171 -0
  37. package/dist-server/routers/api/restful-apis/v2/add-draft-release-order.js.map +1 -0
  38. package/dist-server/routers/api/restful-apis/v2/add-marketplace-order.js +85 -75
  39. package/dist-server/routers/api/restful-apis/v2/add-marketplace-order.js.map +1 -1
  40. package/dist-server/routers/api/restful-apis/v2/add-release-order.js +149 -34
  41. package/dist-server/routers/api/restful-apis/v2/add-release-order.js.map +1 -1
  42. package/dist-server/routers/api/restful-apis/v2/index.js +1 -0
  43. package/dist-server/routers/api/restful-apis/v2/index.js.map +1 -1
  44. package/dist-server/routers/business/index.js +1 -5
  45. package/dist-server/routers/business/index.js.map +1 -1
  46. package/dist-server/utils/index.js +1 -5
  47. package/dist-server/utils/index.js.map +1 -1
  48. package/package.json +54 -54
  49. package/server/controllers/bizplace-initializer/dataset/codes.ts +9 -0
  50. package/server/controllers/bizplace-initializer/dataset/settings.ts +10 -0
  51. package/server/routers/api/restful-apis/unstable/add-draft-release-order.ts +196 -0
  52. package/server/routers/api/restful-apis/unstable/add-marketplace-order.ts +97 -85
  53. package/server/routers/api/restful-apis/unstable/add-release-order.ts +211 -28
  54. package/server/routers/api/restful-apis/unstable/index.ts +1 -0
  55. package/server/routers/api/restful-apis/v1/add-draft-release-order.ts +196 -0
  56. package/server/routers/api/restful-apis/v1/add-marketplace-order.ts +97 -85
  57. package/server/routers/api/restful-apis/v1/add-release-order.ts +209 -26
  58. package/server/routers/api/restful-apis/v1/index.ts +1 -0
  59. package/server/routers/api/restful-apis/v2/add-draft-release-order.ts +196 -0
  60. package/server/routers/api/restful-apis/v2/add-marketplace-order.ts +97 -85
  61. package/server/routers/api/restful-apis/v2/add-release-order.ts +212 -26
  62. package/server/routers/api/restful-apis/v2/index.ts +1 -0
  63. package/config.development.js +0 -71
@@ -0,0 +1,196 @@
1
+ import gql from 'graphql-tag'
2
+ import { EntityManager, getConnection } from 'typeorm'
3
+
4
+ import { restfulApiRouter as router } from '@things-factory/api'
5
+ import { Bizplace } from '@things-factory/biz-base'
6
+ import { OrderInventory } from '@things-factory/sales-base'
7
+
8
+ import { businessMiddleware } from '../../../../middlewares/business-middleware'
9
+ import { warehouseMiddleware } from '../../../../middlewares/warehouse-middleware'
10
+
11
+ const debug = require('debug')('things-factory:operato-hub:restful-api:unstable:add-draft-release-order')
12
+
13
+ router.post(
14
+ '/v1/warehouse/:warehouseId/add-draft-release-order',
15
+ businessMiddleware,
16
+ warehouseMiddleware,
17
+ async (context, next) => {
18
+ return await getConnection().transaction(async (tx: EntityManager) => {
19
+ const { client, domain } = context.state
20
+ const { warehouseId: customerBizplaceId } = context.params
21
+ const { t } = context
22
+
23
+ if (!customerBizplaceId) context.throw(404, t('error.warehouse id not found'))
24
+
25
+ let bodyReq = context.request.body
26
+ if (typeof bodyReq === undefined || !Object.keys(bodyReq)?.length) {
27
+ context.throw(400, t('error.invalid body request format'))
28
+ }
29
+ debug('post:/add-draft-release-order request.body', bodyReq)
30
+ await checkMandatoryKey(context, bodyReq)
31
+
32
+ // get customer company's bizplace
33
+ const customerBizplace: Bizplace = await tx.getRepository(Bizplace).findOne({
34
+ where: { id: customerBizplaceId }
35
+ })
36
+
37
+ const orderInventories: OrderInventory[] = bodyReq.orderInventories
38
+
39
+ context.body = {
40
+ result: (
41
+ await client.mutate({
42
+ mutation: gql`
43
+ mutation upsertDraftReleaseGood(
44
+ $draftReleaseGood: DraftReleaseGoodPatch!
45
+ $orderProducts: [OrderProductPatch!]!
46
+ $files: [Upload!]
47
+ ) {
48
+ upsertDraftReleaseGood(
49
+ draftReleaseGood: $draftReleaseGood
50
+ orderProducts: $orderProducts
51
+ files: $files
52
+ ) {
53
+ id
54
+ name
55
+ refNo
56
+ refNo2
57
+ refNo3
58
+ status
59
+ truckNo
60
+ ownTransport
61
+ marketplaceOrderStatus
62
+ billingAddress
63
+ deliveryAddress1
64
+ deliveryAddress2
65
+ deliveryAddress3
66
+ deliveryAddress4
67
+ deliveryAddress5
68
+ attentionTo
69
+ attentionCompany
70
+ city
71
+ state
72
+ postalCode
73
+ country
74
+ phone1
75
+ phone2
76
+ email
77
+ type
78
+ exportOption
79
+ releaseDate
80
+ collectionOrderNo
81
+ bizplace {
82
+ name
83
+ }
84
+ orderProducts {
85
+ product {
86
+ sku
87
+ name
88
+ description
89
+ }
90
+ packingType
91
+ packingSize
92
+ releaseQty
93
+ }
94
+ }
95
+ }
96
+ `,
97
+ variables: {
98
+ draftReleaseGood: {
99
+ bizplace: {
100
+ id: customerBizplace.id
101
+ },
102
+ courierOption: bodyReq.courierOption,
103
+ collectionOrderNo: bodyReq.collectionOrderNo,
104
+ exportOption: bodyReq.exportOption,
105
+ ownTransport: bodyReq.ownTransport,
106
+ packingOption: bodyReq.packingOption,
107
+ refNo: bodyReq.refNo,
108
+ refNo2: bodyReq?.refNo2,
109
+ refNo3: bodyReq?.refNo3,
110
+ releaseDate: bodyReq.releaseDate,
111
+ type: bodyReq.type,
112
+ marketplaceOrderStatus: bodyReq?.marketplaceOrderStatus,
113
+ remark: bodyReq?.remark || null,
114
+ billingAddress: bodyReq?.billTo?.billingAddress || null,
115
+ deliveryAddress1: bodyReq?.deliverTo?.deliveryAddress1 || null,
116
+ deliveryAddress2: bodyReq?.deliverTo?.deliveryAddress2 || null,
117
+ deliveryAddress3: bodyReq?.deliverTo?.deliveryAddress3 || null,
118
+ deliveryAddress4: bodyReq?.deliverTo?.deliveryAddress4 || null,
119
+ deliveryAddress5: bodyReq?.deliverTo?.deliveryAddress5 || null,
120
+ attentionTo: bodyReq?.deliverTo?.attentionTo || null,
121
+ attentionCompany: bodyReq?.deliverTo?.attentionCompany || null,
122
+ city: bodyReq?.deliverTo?.city || null,
123
+ state: bodyReq?.deliverTo?.state || null,
124
+ postalCode: bodyReq?.deliverTo?.postalCode || null,
125
+ country: bodyReq?.deliverTo?.country || null,
126
+ phone1: bodyReq?.deliverTo?.phone1 || null,
127
+ phone2: bodyReq?.deliverTo?.phone2 || null,
128
+ email: bodyReq?.deliverTo?.email || null
129
+ },
130
+ orderProducts: orderInventories,
131
+ files: []
132
+ },
133
+ context: {
134
+ ...context,
135
+ hasUpload: true,
136
+ state: {
137
+ ...context.state,
138
+ customerBizplace,
139
+ domain,
140
+ type: 'api'
141
+ }
142
+ }
143
+ } as any)
144
+ ).data
145
+ }
146
+ })
147
+ }
148
+ )
149
+
150
+ export async function checkMandatoryKey(context, params) {
151
+ let noparams = ['releaseDate', 'exportOption'].filter(param => !(param in params))
152
+
153
+ if ('ownTransport' in params) {
154
+ if (params.ownTransport == true) {
155
+ if (!params.hasOwnProperty('collectionOrderNo')) {
156
+ noparams.push('collectionOrderNo')
157
+ }
158
+ }
159
+ } else {
160
+ noparams.push('ownTransport')
161
+ }
162
+
163
+ if ('exportOption' in params) {
164
+ if (params.exportOption === true) {
165
+ if (
166
+ params.exportOption.filter(
167
+ record =>
168
+ !record.containerNo || !record.containerArrivalDate || !record.containerLeavingDate || !record.shipName
169
+ ).length
170
+ ) {
171
+ noparams.push('exportOption')
172
+ }
173
+ }
174
+ }
175
+
176
+ if ('orderInventories' in params) {
177
+ params.orderInventories.forEach((param, key) => {
178
+ let noSubParams = []
179
+
180
+ if (!param?.releaseQty) noSubParams.push('releaseQty')
181
+
182
+ if (!param?.product) noSubParams.push('product')
183
+
184
+ if (noSubParams?.length)
185
+ context.throw(400, context.t('error.required param x not found', { x: `${noSubParams.join(', ')}` }))
186
+ })
187
+ } else {
188
+ noparams.push('orderInventories')
189
+ }
190
+
191
+ if (noparams?.length) {
192
+ context.throw(400, context.t('error.required param x not found', { x: `${noparams.join(', ')}` }))
193
+ }
194
+
195
+ return params
196
+ }
@@ -5,6 +5,8 @@
5
5
  import gql from 'graphql-tag'
6
6
 
7
7
  import { restfulApiRouter as router } from '@things-factory/api'
8
+ import { EntityManager, getConnection } from 'typeorm'
9
+ import { MarketplaceOrder } from '@things-factory/marketplace-base'
8
10
 
9
11
  import { businessMiddleware } from '../../../../middlewares/business-middleware'
10
12
  import { storeMiddleware } from '../../../../middlewares/store-middleware'
@@ -16,99 +18,109 @@ router.post(
16
18
  businessMiddleware,
17
19
  storeMiddleware,
18
20
  async (context, next) => {
19
- const { client, marketplaceStore, domain } = context.state
20
- const { t } = context
21
- const bodyReq = context.request.body
22
-
23
- if (typeof bodyReq === undefined || !Object.keys(bodyReq)?.length) {
24
- context.throw(400, t('error.invalid body request format'))
25
- }
26
-
27
- await checkMandatoryKey(context, bodyReq)
28
- debug('post:/add-marketplace-order body request', bodyReq)
29
-
30
- context.body = {
31
- result: (
32
- await client.mutate({
33
- mutation: gql`
34
- mutation generateMarketplaceOrder($marketplaceOrder: NewMarketplaceOrder!) {
35
- generateMarketplaceOrder(marketplaceOrder: $marketplaceOrder) {
36
- id
37
- orderNo
38
- currency
39
- itemCount
40
- totalAmount
41
- paymentMethod
42
- remark
43
- giftOption
44
- orderCreatedAt
45
- orderUpdatedAt
46
- marketplaceStore {
47
- storeId
48
- }
49
- marketplaceOrderItems {
21
+ return await getConnection().transaction(async (tx: EntityManager) => {
22
+ const { client, marketplaceStore, domain } = context.state
23
+ const { t } = context
24
+ const bodyReq = context.request.body
25
+
26
+ if (typeof bodyReq === undefined || !Object.keys(bodyReq)?.length) {
27
+ context.throw(400, t('error.invalid body request format'))
28
+ }
29
+
30
+ await checkMandatoryKey(context, bodyReq)
31
+ debug('post:/add-marketplace-order body request', bodyReq)
32
+
33
+ let existingMarketplaceOrder: MarketplaceOrder = await tx.getRepository(MarketplaceOrder).findOne({
34
+ where: { name: bodyReq.name, domain, marketplaceStore }
35
+ })
36
+
37
+ if (existingMarketplaceOrder) {
38
+ context.throw(400, `error.duplicate entry for order ${bodyReq.name}`)
39
+ }
40
+
41
+ context.body = {
42
+ result: (
43
+ await client.mutate({
44
+ mutation: gql`
45
+ mutation generateMarketplaceOrder($marketplaceOrder: NewMarketplaceOrder!) {
46
+ generateMarketplaceOrder(marketplaceOrder: $marketplaceOrder) {
50
47
  id
51
- name
52
- qty
53
- cancelBy
54
- returnStatus
55
- paidPrice
56
- packageId
57
- invoiceNo
58
- status
59
- marketplaceOrderShippingItems {
60
- marketplaceOrderShipping {
61
- attentionTo
62
- address1
63
- address2
64
- address3
65
- address4
66
- address5
67
- state
68
- city
69
- postCode
70
- country
71
- phone1
72
- phone2
73
- email
74
- orderType
75
- freightType
76
- parcelType
77
- goodsType
78
- deliveryMethod
79
- totalWeight
80
- totalVolume
81
- transporter
82
- }
48
+ orderNo
49
+ currency
50
+ itemCount
51
+ totalAmount
52
+ paymentMethod
53
+ remark
54
+ giftOption
55
+ orderCreatedAt
56
+ orderUpdatedAt
57
+ marketplaceStore {
58
+ storeId
83
59
  }
84
- marketplaceProductVariation {
60
+ marketplaceOrderItems {
85
61
  id
86
- sku
87
- variationId
88
- variationSku
89
- channelSku
90
62
  name
91
- costPrice
92
- sellPrice
93
- marketplaceStatus
63
+ qty
64
+ cancelBy
65
+ returnStatus
66
+ paidPrice
67
+ packageId
68
+ invoiceNo
69
+ status
70
+ marketplaceOrderShippingItems {
71
+ marketplaceOrderShipping {
72
+ attentionTo
73
+ address1
74
+ address2
75
+ address3
76
+ address4
77
+ address5
78
+ state
79
+ city
80
+ postCode
81
+ country
82
+ phone1
83
+ phone2
84
+ email
85
+ orderType
86
+ freightType
87
+ parcelType
88
+ goodsType
89
+ deliveryMethod
90
+ totalWeight
91
+ totalVolume
92
+ transporter
93
+ }
94
+ }
95
+ marketplaceProductVariation {
96
+ id
97
+ sku
98
+ variationId
99
+ variationSku
100
+ channelSku
101
+ name
102
+ costPrice
103
+ sellPrice
104
+ marketplaceStatus
105
+ }
94
106
  }
95
107
  }
96
108
  }
109
+ `,
110
+ variables: { marketplaceOrder: bodyReq },
111
+ context: {
112
+ ...context,
113
+ state: {
114
+ ...context.state,
115
+ marketplaceStore,
116
+ domain,
117
+ type: 'api'
118
+ }
97
119
  }
98
- `,
99
- variables: { marketplaceOrder: bodyReq },
100
- context: {
101
- ...context,
102
- state: {
103
- ...context.state,
104
- marketplaceStore,
105
- domain,
106
- type: 'api'
107
- }
108
- }
109
- } as any)
110
- ).data
111
- }
120
+ } as any)
121
+ ).data
122
+ }
123
+ })
112
124
  }
113
125
  )
114
126
 
@@ -258,17 +258,37 @@ router.post(
258
258
 
259
259
  if (!response.errors) {
260
260
  const items = response.data.inventoriesByPallet.items || []
261
- if (!items?.length)
262
- context.throw(
263
- 404,
264
- t(
265
- `error.no inventories found for ${orderInventory.product?.sku} with batch ID ${orderInventory?.batchId}`
261
+ if (!items?.length) {
262
+ context.body = {
263
+ result: await createDraftOrder(
264
+ client,
265
+ customerBizplace,
266
+ bodyReq,
267
+ bundleInfo,
268
+ domain,
269
+ context,
270
+ orderInventories,
271
+ tx
266
272
  )
267
- )
273
+ }
274
+ return
275
+ }
268
276
 
269
- items.forEach(item => {
277
+ items.forEach(async item => {
270
278
  if (orderInventory.releaseQty > item.remainQty || orderInventory.releaseQty <= 0) {
271
- context.throw(404, t(`error.invalid release qty for ${orderInventory.product?.sku}`))
279
+ context.body = {
280
+ result: await createDraftOrder(
281
+ client,
282
+ customerBizplace,
283
+ bodyReq,
284
+ bundleInfo,
285
+ domain,
286
+ context,
287
+ orderInventories,
288
+ tx
289
+ )
290
+ }
291
+ return
272
292
  }
273
293
 
274
294
  // 3. add more information to orderInventory
@@ -281,7 +301,21 @@ router.post(
281
301
  })
282
302
 
283
303
  return orderInventory
284
- } else context.throw(404, t('error.failed to fetch inventory'))
304
+ } else {
305
+ context.body = {
306
+ result: await createDraftOrder(
307
+ client,
308
+ customerBizplace,
309
+ bodyReq,
310
+ bundleInfo,
311
+ domain,
312
+ context,
313
+ orderInventories,
314
+ tx
315
+ )
316
+ }
317
+ return
318
+ }
285
319
  })
286
320
  )
287
321
  } else {
@@ -366,8 +400,21 @@ router.post(
366
400
  }
367
401
 
368
402
  let inventories: Inventory[] = await qb.getMany()
369
- if (!inventories?.length) context.throw(404, t(`error.no inventories found for ${product.sku}`))
370
-
403
+ if (!inventories?.length) {
404
+ context.body = {
405
+ result: await createDraftOrder(
406
+ client,
407
+ customerBizplace,
408
+ bodyReq,
409
+ bundleInfo,
410
+ domain,
411
+ context,
412
+ orderInventories,
413
+ tx
414
+ )
415
+ }
416
+ return
417
+ }
371
418
  inventories = inventories
372
419
  .map(inventory => {
373
420
  return {
@@ -378,12 +425,24 @@ router.post(
378
425
  })
379
426
  .filter(inventory => inventory.remainQty > 0)
380
427
 
381
- const targetInventories: WorksheetDetail[] = _composeTargetInventories(
382
- context,
383
- product,
384
- orderInventory,
385
- inventories
386
- )
428
+ let targetInventories: WorksheetDetail[]
429
+ try {
430
+ targetInventories = _composeTargetInventories(context, product, orderInventory, inventories)
431
+ } catch (e) {
432
+ context.body = {
433
+ result: await createDraftOrder(
434
+ client,
435
+ customerBizplace,
436
+ bodyReq,
437
+ bundleInfo,
438
+ domain,
439
+ context,
440
+ orderInventories,
441
+ tx
442
+ )
443
+ }
444
+ return
445
+ }
387
446
  targetInventories.map(item => {
388
447
  finalOrderInventories.push(item.targetInventory)
389
448
  })
@@ -432,17 +491,37 @@ router.post(
432
491
 
433
492
  if (!response.errors) {
434
493
  const items = response.data.inventoryProductGroup.items || []
435
- if (!items?.length)
436
- context.throw(
437
- 404,
438
- t(
439
- `error.no inventories found for ${orderInventory.product?.sku} with batch ID ${orderInventory?.batchId}`
494
+ if (!items?.length) {
495
+ context.body = {
496
+ result: await createDraftOrder(
497
+ client,
498
+ customerBizplace,
499
+ bodyReq,
500
+ bundleInfo,
501
+ domain,
502
+ context,
503
+ orderInventories,
504
+ tx
440
505
  )
441
- )
506
+ }
507
+ return
508
+ }
442
509
 
443
- items.forEach(item => {
510
+ items.forEach(async item => {
444
511
  if (orderInventory.releaseQty > item.remainQty || orderInventory.releaseQty <= 0) {
445
- context.throw(404, t(`error.invalid release qty for ${orderInventory.product?.sku}`))
512
+ context.body = {
513
+ result: await createDraftOrder(
514
+ client,
515
+ customerBizplace,
516
+ bodyReq,
517
+ bundleInfo,
518
+ domain,
519
+ context,
520
+ orderInventories,
521
+ tx
522
+ )
523
+ }
524
+ return
446
525
  }
447
526
 
448
527
  // 3. add more information to orderInventory
@@ -456,7 +535,21 @@ router.post(
456
535
 
457
536
  delete orderInventory.uomValue
458
537
  finalOrderInventories.push(orderInventory)
459
- } else context.throw(404, t('error.failed to fetch inventory'))
538
+ } else {
539
+ context.body = {
540
+ result: await createDraftOrder(
541
+ client,
542
+ customerBizplace,
543
+ bodyReq,
544
+ bundleInfo,
545
+ domain,
546
+ context,
547
+ orderInventories,
548
+ tx
549
+ )
550
+ }
551
+ return
552
+ }
460
553
  }
461
554
  }
462
555
  }
@@ -730,3 +823,93 @@ function combineItems(inventoryList) {
730
823
 
731
824
  return mappedList
732
825
  }
826
+
827
+ async function createDraftOrder(client, customerBizplace, bodyReq, bundleInfo, domain, context, orderInventories, tx) {
828
+ return (
829
+ await client.mutate({
830
+ mutation: gql`
831
+ mutation upsertDraftReleaseGood(
832
+ $draftReleaseGood: DraftReleaseGoodPatch!
833
+ $orderProducts: [OrderProductPatch!]!
834
+ ) {
835
+ upsertDraftReleaseGood(draftReleaseGood: $draftReleaseGood, orderProducts: $orderProducts) {
836
+ id
837
+ name
838
+ refNo
839
+ refNo2
840
+ status
841
+ truckNo
842
+ ownTransport
843
+ marketplaceOrderStatus
844
+ billingAddress
845
+ deliveryAddress1
846
+ deliveryAddress2
847
+ deliveryAddress3
848
+ deliveryAddress4
849
+ deliveryAddress5
850
+ attentionTo
851
+ attentionCompany
852
+ city
853
+ state
854
+ postalCode
855
+ country
856
+ phone1
857
+ phone2
858
+ email
859
+ type
860
+ exportOption
861
+ releaseDate
862
+ collectionOrderNo
863
+ bizplace {
864
+ name
865
+ }
866
+ }
867
+ }
868
+ `,
869
+ variables: {
870
+ draftReleaseGood: {
871
+ bizplace: {
872
+ id: customerBizplace.id
873
+ },
874
+ courierOption: bodyReq.courierOption,
875
+ collectionOrderNo: bodyReq.collectionOrderNo,
876
+ exportOption: bodyReq.exportOption,
877
+ ownTransport: bodyReq.ownTransport,
878
+ packingOption: bodyReq.packingOption,
879
+ refNo: bodyReq.refNo,
880
+ refNo2: bodyReq?.refNo2,
881
+ releaseDate: bodyReq.releaseDate,
882
+ type: bodyReq.type,
883
+ marketplaceOrderStatus: bodyReq?.marketplaceOrderStatus,
884
+ remark: bodyReq?.remark || null,
885
+ billingAddress: bodyReq?.billTo?.billingAddress || null,
886
+ deliveryAddress1: bodyReq?.deliverTo?.deliveryAddress1 || null,
887
+ deliveryAddress2: bodyReq?.deliverTo?.deliveryAddress2 || null,
888
+ deliveryAddress3: bodyReq?.deliverTo?.deliveryAddress3 || null,
889
+ deliveryAddress4: bodyReq?.deliverTo?.deliveryAddress4 || null,
890
+ deliveryAddress5: bodyReq?.deliverTo?.deliveryAddress5 || null,
891
+ attentionTo: bodyReq?.deliverTo?.attentionTo || null,
892
+ attentionCompany: bodyReq?.deliverTo?.attentionCompany || null,
893
+ city: bodyReq?.deliverTo?.city || null,
894
+ state: bodyReq?.deliverTo?.state || null,
895
+ postalCode: bodyReq?.deliverTo?.postalCode || null,
896
+ country: bodyReq?.deliverTo?.country || null,
897
+ phone1: bodyReq?.deliverTo?.phone1 || null,
898
+ phone2: bodyReq?.deliverTo?.phone2 || null,
899
+ email: bodyReq?.deliverTo?.email || null
900
+ },
901
+ orderProducts: orderInventories
902
+ },
903
+ context: {
904
+ ...context,
905
+ hasUpload: true,
906
+ state: {
907
+ ...context.state,
908
+ customerBizplace,
909
+ domain,
910
+ type: 'api'
911
+ }
912
+ }
913
+ } as any)
914
+ ).data
915
+ }
@@ -2,6 +2,7 @@ import './add-contact-point'
2
2
  import './add-inbound-order'
3
3
  import './add-marketplace-order'
4
4
  import './add-products'
5
+ import './add-draft-release-order'
5
6
  import './add-release-order'
6
7
  import './bizplace'
7
8
  import './reject-inbound-order'