@things-factory/operato-hub 4.3.543 → 4.3.544
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-server/routers/api/restful-apis/v1/company/get-webhook-details.js +58 -0
- package/dist-server/routers/api/restful-apis/v1/company/get-webhook-details.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/company/index.js +2 -0
- package/dist-server/routers/api/restful-apis/v1/company/index.js.map +1 -1
- package/dist-server/routers/api/restful-apis/v1/company/upsert-webhooks.js +146 -0
- package/dist-server/routers/api/restful-apis/v1/company/upsert-webhooks.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/utils/params.js +43 -0
- package/dist-server/routers/api/restful-apis/v1/utils/params.js.map +1 -1
- package/dist-server/routers/api/restful-apis/v1/warehouse/get-inventory-adjustment-details.js +108 -0
- package/dist-server/routers/api/restful-apis/v1/warehouse/get-inventory-adjustment-details.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/warehouse/index.js +1 -0
- package/dist-server/routers/api/restful-apis/v1/warehouse/index.js.map +1 -1
- package/openapi/v1/Inventory.yaml +221 -0
- package/openapi/v1/webhook.yaml +281 -0
- package/openapi/v1.yaml +2 -0
- package/package.json +14 -14
- package/server/routers/api/restful-apis/v1/company/get-webhook-details.ts +64 -0
- package/server/routers/api/restful-apis/v1/company/index.ts +2 -0
- package/server/routers/api/restful-apis/v1/company/upsert-webhooks.ts +176 -0
- package/server/routers/api/restful-apis/v1/utils/params.ts +43 -0
- package/server/routers/api/restful-apis/v1/warehouse/get-inventory-adjustment-details.ts +112 -0
- package/server/routers/api/restful-apis/v1/warehouse/index.ts +1 -0
|
@@ -322,6 +322,195 @@ definitions:
|
|
|
322
322
|
xml:
|
|
323
323
|
name: 'GetInventoryAdjustmentList'
|
|
324
324
|
|
|
325
|
+
# GetInventoryAdjustmentDetails
|
|
326
|
+
GetInventoryAdjustmentDetails:
|
|
327
|
+
type: 'object'
|
|
328
|
+
properties:
|
|
329
|
+
data:
|
|
330
|
+
type: 'array'
|
|
331
|
+
items:
|
|
332
|
+
type: 'object'
|
|
333
|
+
properties:
|
|
334
|
+
id:
|
|
335
|
+
type: 'string'
|
|
336
|
+
example: 'b60feaf2-1940-40cd-9c53-9e9ac072049d'
|
|
337
|
+
current:
|
|
338
|
+
type: 'object'
|
|
339
|
+
properties:
|
|
340
|
+
productDetail:
|
|
341
|
+
type: 'object'
|
|
342
|
+
properties:
|
|
343
|
+
refCode:
|
|
344
|
+
type: 'string'
|
|
345
|
+
example: 'LB-1111'
|
|
346
|
+
packingType:
|
|
347
|
+
type: 'string'
|
|
348
|
+
example: 'UNIT'
|
|
349
|
+
packingSize:
|
|
350
|
+
type: 'integer'
|
|
351
|
+
example: 1
|
|
352
|
+
uom:
|
|
353
|
+
type: 'string'
|
|
354
|
+
example: 'UN'
|
|
355
|
+
uomValue:
|
|
356
|
+
type: 'integer'
|
|
357
|
+
example: 1
|
|
358
|
+
product:
|
|
359
|
+
type: 'object'
|
|
360
|
+
properties:
|
|
361
|
+
sku:
|
|
362
|
+
type: 'string'
|
|
363
|
+
example: 'LB-A'
|
|
364
|
+
name:
|
|
365
|
+
type: 'string'
|
|
366
|
+
example: 'LB'
|
|
367
|
+
description:
|
|
368
|
+
type: 'string'
|
|
369
|
+
example: 'item'
|
|
370
|
+
bizplace:
|
|
371
|
+
type: 'object'
|
|
372
|
+
properties:
|
|
373
|
+
name:
|
|
374
|
+
type: 'string'
|
|
375
|
+
example: 'Company A'
|
|
376
|
+
qty:
|
|
377
|
+
type: 'integer'
|
|
378
|
+
example: 2
|
|
379
|
+
uom:
|
|
380
|
+
type: 'string'
|
|
381
|
+
example: 'UN'
|
|
382
|
+
uomValue:
|
|
383
|
+
type: 'integer'
|
|
384
|
+
example: 2
|
|
385
|
+
packingType:
|
|
386
|
+
type: 'string'
|
|
387
|
+
example: 'UNIT'
|
|
388
|
+
packingSize:
|
|
389
|
+
type: 'integer'
|
|
390
|
+
example: 1
|
|
391
|
+
batchId:
|
|
392
|
+
type: 'string'
|
|
393
|
+
example: 't123'
|
|
394
|
+
batchIdRef:
|
|
395
|
+
type: 'string'
|
|
396
|
+
example: 't-23-1'
|
|
397
|
+
expirationDate:
|
|
398
|
+
type: 'string'
|
|
399
|
+
example: '2019-10-31'
|
|
400
|
+
expirationDate:
|
|
401
|
+
type: 'date'
|
|
402
|
+
example: '2019-10-31'
|
|
403
|
+
manufactureYear:
|
|
404
|
+
type: 'string'
|
|
405
|
+
example: '2020'
|
|
406
|
+
manufactureDate:
|
|
407
|
+
type: 'date'
|
|
408
|
+
example: '2019-10-31'
|
|
409
|
+
palletId:
|
|
410
|
+
type: 'string'
|
|
411
|
+
example: 'p123'
|
|
412
|
+
cartonId:
|
|
413
|
+
type: 'string'
|
|
414
|
+
example: 'c123'
|
|
415
|
+
previous:
|
|
416
|
+
type: 'object'
|
|
417
|
+
properties:
|
|
418
|
+
productDetail:
|
|
419
|
+
type: 'object'
|
|
420
|
+
properties:
|
|
421
|
+
refCode:
|
|
422
|
+
type: 'string'
|
|
423
|
+
example: 'LB-1111'
|
|
424
|
+
packingType:
|
|
425
|
+
type: 'string'
|
|
426
|
+
example: 'UNIT'
|
|
427
|
+
packingSize:
|
|
428
|
+
type: 'integer'
|
|
429
|
+
example: 1
|
|
430
|
+
uom:
|
|
431
|
+
type: 'string'
|
|
432
|
+
example: 'UN'
|
|
433
|
+
uomValue:
|
|
434
|
+
type: 'integer'
|
|
435
|
+
example: 1
|
|
436
|
+
product:
|
|
437
|
+
type: 'object'
|
|
438
|
+
properties:
|
|
439
|
+
sku:
|
|
440
|
+
type: 'string'
|
|
441
|
+
example: 'LB-A'
|
|
442
|
+
name:
|
|
443
|
+
type: 'string'
|
|
444
|
+
example: 'LB'
|
|
445
|
+
description:
|
|
446
|
+
type: 'string'
|
|
447
|
+
example: 'item'
|
|
448
|
+
bizplace:
|
|
449
|
+
type: 'object'
|
|
450
|
+
properties:
|
|
451
|
+
name:
|
|
452
|
+
type: 'string'
|
|
453
|
+
example: 'Company A'
|
|
454
|
+
qty:
|
|
455
|
+
type: 'integer'
|
|
456
|
+
example: 2
|
|
457
|
+
uom:
|
|
458
|
+
type: 'string'
|
|
459
|
+
example: 'UN'
|
|
460
|
+
uomValue:
|
|
461
|
+
type: 'integer'
|
|
462
|
+
example: 2
|
|
463
|
+
packingType:
|
|
464
|
+
type: 'string'
|
|
465
|
+
example: 'UNIT'
|
|
466
|
+
packingSize:
|
|
467
|
+
type: 'integer'
|
|
468
|
+
example: 1
|
|
469
|
+
batchId:
|
|
470
|
+
type: 'string'
|
|
471
|
+
example: 't123'
|
|
472
|
+
batchIdRef:
|
|
473
|
+
type: 'string'
|
|
474
|
+
example: 't-23-1'
|
|
475
|
+
expirationDate:
|
|
476
|
+
type: 'string'
|
|
477
|
+
example: '2019-10-31'
|
|
478
|
+
expirationDate:
|
|
479
|
+
type: 'date'
|
|
480
|
+
example: '2019-10-31'
|
|
481
|
+
manufactureYear:
|
|
482
|
+
type: 'string'
|
|
483
|
+
example: '2020'
|
|
484
|
+
manufactureDate:
|
|
485
|
+
type: 'date'
|
|
486
|
+
example: '2019-10-31'
|
|
487
|
+
palletId:
|
|
488
|
+
type: 'string'
|
|
489
|
+
example: 'p123'
|
|
490
|
+
cartonId:
|
|
491
|
+
type: 'string'
|
|
492
|
+
example: 'c123'
|
|
493
|
+
adjustmentCode:
|
|
494
|
+
type: 'string'
|
|
495
|
+
example: ''
|
|
496
|
+
adjustmentNote:
|
|
497
|
+
type: 'string'
|
|
498
|
+
example: ''
|
|
499
|
+
type:
|
|
500
|
+
type: 'string'
|
|
501
|
+
example: 'CHANGES'
|
|
502
|
+
status:
|
|
503
|
+
type: 'string'
|
|
504
|
+
example: 'APPROVED'
|
|
505
|
+
createdAt:
|
|
506
|
+
type: 'date'
|
|
507
|
+
example: '2019-11-10'
|
|
508
|
+
updatedAt:
|
|
509
|
+
type: 'date'
|
|
510
|
+
example: '2019-11-10'
|
|
511
|
+
xml:
|
|
512
|
+
name: 'GetInventoryAdjustmentDetails'
|
|
513
|
+
|
|
325
514
|
paths:
|
|
326
515
|
# get-onhand-inventory-list
|
|
327
516
|
api/v1/warehouse/get-onhand-inventory-list:
|
|
@@ -472,3 +661,35 @@ paths:
|
|
|
472
661
|
type: 'array'
|
|
473
662
|
items:
|
|
474
663
|
$ref: '#/definitions/GetInventoryAdjustmentList'
|
|
664
|
+
|
|
665
|
+
# get-inventory-adjustment-details
|
|
666
|
+
api/v1/warehouse/get-inventory-adjustment-details:
|
|
667
|
+
get:
|
|
668
|
+
tags:
|
|
669
|
+
- 'Inventory'
|
|
670
|
+
summary: 'Get inventory adjustment details'
|
|
671
|
+
description: 'Get Inventory Adjustment details'
|
|
672
|
+
operationId: 'getInventoryAdjustmentDetails'
|
|
673
|
+
consumes:
|
|
674
|
+
- 'application/json'
|
|
675
|
+
produces:
|
|
676
|
+
- 'application/json'
|
|
677
|
+
parameters:
|
|
678
|
+
- in: 'query'
|
|
679
|
+
name: 'id'
|
|
680
|
+
type: 'string'
|
|
681
|
+
description: 'Insert inventory change id'
|
|
682
|
+
required: true
|
|
683
|
+
- in: 'query'
|
|
684
|
+
name: 'bizplaceId'
|
|
685
|
+
type: 'string'
|
|
686
|
+
required: true
|
|
687
|
+
responses:
|
|
688
|
+
'200':
|
|
689
|
+
description: 'successful operation'
|
|
690
|
+
content:
|
|
691
|
+
application/json:
|
|
692
|
+
schema:
|
|
693
|
+
type: 'array'
|
|
694
|
+
items:
|
|
695
|
+
$ref: '#/definitions/GetInventoryAdjustmentDetails'
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
definitions:
|
|
2
|
+
# UpsertWebhooks
|
|
3
|
+
UpsertWebhooks:
|
|
4
|
+
type: 'object'
|
|
5
|
+
properties:
|
|
6
|
+
data:
|
|
7
|
+
type: 'array'
|
|
8
|
+
items:
|
|
9
|
+
type: 'object'
|
|
10
|
+
properties:
|
|
11
|
+
id:
|
|
12
|
+
type: 'string'
|
|
13
|
+
required: true
|
|
14
|
+
example: '1d61cd39-f9de-4a28-8d24-981e6ea5c626'
|
|
15
|
+
name:
|
|
16
|
+
type: 'string'
|
|
17
|
+
required: true
|
|
18
|
+
example: 'companyA-webhook'
|
|
19
|
+
active:
|
|
20
|
+
type: 'boolean'
|
|
21
|
+
example: true
|
|
22
|
+
targetUrl:
|
|
23
|
+
type: 'string'
|
|
24
|
+
example: 'https://www.example.com'
|
|
25
|
+
extensionUrl:
|
|
26
|
+
type: 'string'
|
|
27
|
+
example: 'outbound-events/v1/'
|
|
28
|
+
events:
|
|
29
|
+
type: 'array'
|
|
30
|
+
items:
|
|
31
|
+
type: 'string'
|
|
32
|
+
example: 'arrival_notice_created'
|
|
33
|
+
enum:
|
|
34
|
+
- 'arrival_notice_created'
|
|
35
|
+
- 'arrival_notice_updated'
|
|
36
|
+
- 'arrival_notice_confirmed'
|
|
37
|
+
- 'arrival_notice_completed'
|
|
38
|
+
- 'grn_created'
|
|
39
|
+
- 'draft_order_created'
|
|
40
|
+
- 'draft_order_updated'
|
|
41
|
+
- 'draft_order_converted'
|
|
42
|
+
- 'release_order_created'
|
|
43
|
+
- 'release_order_updated'
|
|
44
|
+
- 'release_order_confirmed'
|
|
45
|
+
- 'release_order_completed'
|
|
46
|
+
- 'picking_started'
|
|
47
|
+
- 'picking_completed'
|
|
48
|
+
- 'packing_started'
|
|
49
|
+
- 'packing_completed'
|
|
50
|
+
- 'loading_started'
|
|
51
|
+
- 'loading_completed'
|
|
52
|
+
- 'inventory_adjusted'
|
|
53
|
+
- 'dispatch_manifest'
|
|
54
|
+
partnerBizplaces:
|
|
55
|
+
type: 'array'
|
|
56
|
+
items:
|
|
57
|
+
type: 'object'
|
|
58
|
+
properties:
|
|
59
|
+
id:
|
|
60
|
+
type: 'string'
|
|
61
|
+
example: '1d61cd39-f9de-4a28-8d24-981e6ea5c626'
|
|
62
|
+
name:
|
|
63
|
+
type: 'string'
|
|
64
|
+
example: 'companyA'
|
|
65
|
+
xml:
|
|
66
|
+
name: 'UpsertWebhooks'
|
|
67
|
+
|
|
68
|
+
# GetWebhookDetails
|
|
69
|
+
GetWebhookDetails:
|
|
70
|
+
type: 'object'
|
|
71
|
+
properties:
|
|
72
|
+
data:
|
|
73
|
+
type: 'array'
|
|
74
|
+
items:
|
|
75
|
+
type: 'object'
|
|
76
|
+
properties:
|
|
77
|
+
id:
|
|
78
|
+
type: 'string'
|
|
79
|
+
example: '1d61cd39-f9de-4a28-8d24-981e6ea5c626'
|
|
80
|
+
name:
|
|
81
|
+
type: 'string'
|
|
82
|
+
example: 'companyA-webhook'
|
|
83
|
+
active:
|
|
84
|
+
type: 'boolean'
|
|
85
|
+
example: true
|
|
86
|
+
targetUrl:
|
|
87
|
+
type: 'string'
|
|
88
|
+
example: 'https://www.example.com'
|
|
89
|
+
extensionUrl:
|
|
90
|
+
type: 'string'
|
|
91
|
+
example: 'outbound-events/v1/'
|
|
92
|
+
events:
|
|
93
|
+
type: 'array'
|
|
94
|
+
items:
|
|
95
|
+
type: 'string'
|
|
96
|
+
example: 'arrival_notice_created'
|
|
97
|
+
enum:
|
|
98
|
+
- 'arrival_notice_created'
|
|
99
|
+
- 'arrival_notice_updated'
|
|
100
|
+
- 'arrival_notice_confirmed'
|
|
101
|
+
- 'arrival_notice_completed'
|
|
102
|
+
- 'grn_created'
|
|
103
|
+
- 'draft_order_created'
|
|
104
|
+
- 'draft_order_updated'
|
|
105
|
+
- 'draft_order_converted'
|
|
106
|
+
- 'release_order_created'
|
|
107
|
+
- 'release_order_updated'
|
|
108
|
+
- 'release_order_confirmed'
|
|
109
|
+
- 'release_order_completed'
|
|
110
|
+
- 'picking_started'
|
|
111
|
+
- 'picking_completed'
|
|
112
|
+
- 'packing_started'
|
|
113
|
+
- 'packing_completed'
|
|
114
|
+
- 'loading_started'
|
|
115
|
+
- 'loading_completed'
|
|
116
|
+
- 'inventory_adjusted'
|
|
117
|
+
- 'dispatch_manifest'
|
|
118
|
+
partnerBizplaces:
|
|
119
|
+
type: 'array'
|
|
120
|
+
items:
|
|
121
|
+
type: 'object'
|
|
122
|
+
properties:
|
|
123
|
+
id:
|
|
124
|
+
type: 'string'
|
|
125
|
+
example: '1d61cd39-f9de-4a28-8d24-981e6ea5c626'
|
|
126
|
+
name:
|
|
127
|
+
type: 'string'
|
|
128
|
+
example: 'companyA'
|
|
129
|
+
xml:
|
|
130
|
+
name: 'GetWebhookDetails'
|
|
131
|
+
|
|
132
|
+
paths:
|
|
133
|
+
# upsert-webhook-events
|
|
134
|
+
/api/v1/company/upsert-webhooks:
|
|
135
|
+
post:
|
|
136
|
+
tags:
|
|
137
|
+
- 'Webhook'
|
|
138
|
+
summary: 'Manage Webhook and Webhook Event(s)'
|
|
139
|
+
description: |
|
|
140
|
+
Add and update multiple webhook and webhook events. **(Required to insert `warehouseBizplaceId` and `partnerBizplacesId` to register partners for webhook).**
|
|
141
|
+
|
|
142
|
+
**Note:** If you want to update the webhook events, you need to pass the webhook `id` and the events you want to update.
|
|
143
|
+
|
|
144
|
+
**Note:** To add webhook events, ensure you pass the event names exactly as listed below.
|
|
145
|
+
|
|
146
|
+
### Supported Events:
|
|
147
|
+
- `arrival_notice_created`: triggered when GAN is created
|
|
148
|
+
- `arrival_notice_updated`: triggered when GAN is updated
|
|
149
|
+
- `arrival_notice_confirmed`: triggered when GAN is confirmed
|
|
150
|
+
- `arrival_notice_completed`: triggered when GAN has completed putaway
|
|
151
|
+
- `grn_created`: triggered when GAN completed unloading
|
|
152
|
+
- `draft_order_created`: triggered when draft order is created
|
|
153
|
+
- `draft_order_updated`: triggered when draft order is updated
|
|
154
|
+
- `draft_order_converted`: triggered when draft order is released to a release order
|
|
155
|
+
- `release_order_created`: triggered when a release order is created or draft order is converted
|
|
156
|
+
- `release_order_updated`: triggered when release order is updated
|
|
157
|
+
- `release_order_confirmed`: triggered when release order is confirmed
|
|
158
|
+
- `release_order_completed`: triggered when release order is completed
|
|
159
|
+
- `picking_started`: triggered when single/batch picking worksheet is activated
|
|
160
|
+
- `picking_completed`: triggered when single/batch picking worksheet is completed
|
|
161
|
+
- `packing_started`: triggered when packing worksheet is activated
|
|
162
|
+
- `packing_completed`: triggered when packing worksheet is completed
|
|
163
|
+
- `loading_started`: triggered when picking is completed for orders that do not need packing
|
|
164
|
+
- `loading_completed`: triggered when loading for that order is complete
|
|
165
|
+
- `inventory_adjusted`: triggered when inventory adjustment is approved
|
|
166
|
+
- `dispatch_manifest`: triggered when manifest has been dispatched
|
|
167
|
+
operationId: 'upsertWebhooks'
|
|
168
|
+
produces:
|
|
169
|
+
- 'application/json'
|
|
170
|
+
parameters:
|
|
171
|
+
- in: 'body'
|
|
172
|
+
name: 'body'
|
|
173
|
+
schema:
|
|
174
|
+
type: 'object'
|
|
175
|
+
properties:
|
|
176
|
+
data:
|
|
177
|
+
type: 'array'
|
|
178
|
+
items:
|
|
179
|
+
type: 'object'
|
|
180
|
+
properties:
|
|
181
|
+
id:
|
|
182
|
+
type: 'string'
|
|
183
|
+
required: false
|
|
184
|
+
example: '1d61cd39-f9de-4a28-8d24-981e6ea5c626'
|
|
185
|
+
name:
|
|
186
|
+
type: 'string'
|
|
187
|
+
required: true
|
|
188
|
+
example: 'companyA-webhook'
|
|
189
|
+
warehouseBizplaceId:
|
|
190
|
+
type: 'string'
|
|
191
|
+
required: true
|
|
192
|
+
example: '1d61cd39-f9de-4a28-8d24-981e6ea5c626'
|
|
193
|
+
partnerBizplaceIds:
|
|
194
|
+
type: 'array'
|
|
195
|
+
items:
|
|
196
|
+
type: 'object'
|
|
197
|
+
properties:
|
|
198
|
+
id:
|
|
199
|
+
type: 'string'
|
|
200
|
+
required: true
|
|
201
|
+
example: '1d61cd39-f9de-4a28-8d24-981e6ea5c626'
|
|
202
|
+
active:
|
|
203
|
+
type: 'boolean'
|
|
204
|
+
required: true
|
|
205
|
+
example: true
|
|
206
|
+
targetUrl:
|
|
207
|
+
type: 'string'
|
|
208
|
+
required: true
|
|
209
|
+
example: 'https://operatohub.com'
|
|
210
|
+
extensionUrl:
|
|
211
|
+
type: 'string'
|
|
212
|
+
required: true
|
|
213
|
+
example: 'outbound-events/v1/'
|
|
214
|
+
events:
|
|
215
|
+
type: 'array'
|
|
216
|
+
required: true
|
|
217
|
+
items:
|
|
218
|
+
type: 'string'
|
|
219
|
+
required: true
|
|
220
|
+
example: 'arrival_notice_created'
|
|
221
|
+
enum:
|
|
222
|
+
- 'arrival_notice_created'
|
|
223
|
+
- 'arrival_notice_updated'
|
|
224
|
+
- 'arrival_notice_confirmed'
|
|
225
|
+
- 'arrival_notice_completed'
|
|
226
|
+
- 'grn_created'
|
|
227
|
+
- 'draft_order_created'
|
|
228
|
+
- 'draft_order_updated'
|
|
229
|
+
- 'draft_order_converted'
|
|
230
|
+
- 'release_order_created'
|
|
231
|
+
- 'release_order_updated'
|
|
232
|
+
- 'release_order_confirmed'
|
|
233
|
+
- 'release_order_completed'
|
|
234
|
+
- 'picking_started'
|
|
235
|
+
- 'picking_completed'
|
|
236
|
+
- 'packing_started'
|
|
237
|
+
- 'packing_completed'
|
|
238
|
+
- 'loading_started'
|
|
239
|
+
- 'loading_completed'
|
|
240
|
+
- 'inventory_adjusted'
|
|
241
|
+
- 'dispatch_manifest'
|
|
242
|
+
responses:
|
|
243
|
+
'200':
|
|
244
|
+
description: 'success'
|
|
245
|
+
content:
|
|
246
|
+
application/json:
|
|
247
|
+
schema:
|
|
248
|
+
type: 'array'
|
|
249
|
+
items:
|
|
250
|
+
$ref: '#/definitions/UpsertWebhooks'
|
|
251
|
+
# get-webhook-details
|
|
252
|
+
/api/v1/company/get-webhook-details:
|
|
253
|
+
get:
|
|
254
|
+
tags:
|
|
255
|
+
- 'Webhook'
|
|
256
|
+
summary: 'Get list and details of Webhook and Event(s).'
|
|
257
|
+
description: 'get list of Webhook and Event(s). Specify warehouseBizplaceId.'
|
|
258
|
+
operationId: 'getWebhookDetails'
|
|
259
|
+
consumes:
|
|
260
|
+
- 'application/json'
|
|
261
|
+
produces:
|
|
262
|
+
- 'application/json'
|
|
263
|
+
parameters:
|
|
264
|
+
- in: 'query'
|
|
265
|
+
name: 'warehouseBizplaceId'
|
|
266
|
+
type: 'string'
|
|
267
|
+
description: 'Required to specify the bizplace to search.'
|
|
268
|
+
required: true
|
|
269
|
+
- in: 'query'
|
|
270
|
+
name: 'webhookId'
|
|
271
|
+
description: 'If want to search based on the specific webhook and its information.'
|
|
272
|
+
type: 'string'
|
|
273
|
+
responses:
|
|
274
|
+
'200':
|
|
275
|
+
description: 'successful operation'
|
|
276
|
+
content:
|
|
277
|
+
application/json:
|
|
278
|
+
schema:
|
|
279
|
+
type: 'array'
|
|
280
|
+
items:
|
|
281
|
+
$ref: '#/definitions/GetWebhookDetails'
|
package/openapi/v1.yaml
CHANGED
|
@@ -25,6 +25,8 @@ tags:
|
|
|
25
25
|
description: 'API to create and get outbound order list and detail'
|
|
26
26
|
- name: 'Inventory'
|
|
27
27
|
description: 'API to get inventory information from WMS'
|
|
28
|
+
- name: 'Webhook'
|
|
29
|
+
description: 'API to register webhook events and get webhook list and detail'
|
|
28
30
|
schemes:
|
|
29
31
|
- 'https'
|
|
30
32
|
- 'http'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/operato-hub",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.544",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -77,22 +77,22 @@
|
|
|
77
77
|
"@things-factory/i18n-base": "^4.3.535",
|
|
78
78
|
"@things-factory/import-ui": "^4.3.535",
|
|
79
79
|
"@things-factory/import-ui-excel": "^4.3.535",
|
|
80
|
-
"@things-factory/integration-accounting": "^4.3.
|
|
81
|
-
"@things-factory/integration-fulfillment": "^4.3.
|
|
82
|
-
"@things-factory/integration-lmd": "^4.3.
|
|
83
|
-
"@things-factory/integration-marketplace": "^4.3.
|
|
84
|
-
"@things-factory/integration-pos": "^4.3.
|
|
85
|
-
"@things-factory/integration-powrup": "^4.3.
|
|
86
|
-
"@things-factory/integration-sellercraft": "^4.3.
|
|
87
|
-
"@things-factory/integration-sftp": "^4.3.
|
|
80
|
+
"@things-factory/integration-accounting": "^4.3.544",
|
|
81
|
+
"@things-factory/integration-fulfillment": "^4.3.544",
|
|
82
|
+
"@things-factory/integration-lmd": "^4.3.544",
|
|
83
|
+
"@things-factory/integration-marketplace": "^4.3.544",
|
|
84
|
+
"@things-factory/integration-pos": "^4.3.544",
|
|
85
|
+
"@things-factory/integration-powrup": "^4.3.544",
|
|
86
|
+
"@things-factory/integration-sellercraft": "^4.3.544",
|
|
87
|
+
"@things-factory/integration-sftp": "^4.3.544",
|
|
88
88
|
"@things-factory/lite-menu": "^4.3.535",
|
|
89
|
-
"@things-factory/marketplace-base": "^4.3.
|
|
89
|
+
"@things-factory/marketplace-base": "^4.3.544",
|
|
90
90
|
"@things-factory/more-ui": "^4.3.535",
|
|
91
91
|
"@things-factory/notification": "^4.3.535",
|
|
92
92
|
"@things-factory/pdf": "^4.3.534",
|
|
93
93
|
"@things-factory/product-ui": "^4.3.535",
|
|
94
94
|
"@things-factory/resource-ui": "^4.3.535",
|
|
95
|
-
"@things-factory/sales-base": "^4.3.
|
|
95
|
+
"@things-factory/sales-base": "^4.3.544",
|
|
96
96
|
"@things-factory/scene-data-transform": "^4.3.534",
|
|
97
97
|
"@things-factory/scene-excel": "^4.3.534",
|
|
98
98
|
"@things-factory/scene-firebase": "^4.3.534",
|
|
@@ -108,8 +108,8 @@
|
|
|
108
108
|
"@things-factory/shell": "^4.3.535",
|
|
109
109
|
"@things-factory/system-ui": "^4.3.535",
|
|
110
110
|
"@things-factory/transport-base": "^4.3.535",
|
|
111
|
-
"@things-factory/warehouse-base": "^4.3.
|
|
112
|
-
"@things-factory/worksheet-base": "^4.3.
|
|
111
|
+
"@things-factory/warehouse-base": "^4.3.544",
|
|
112
|
+
"@things-factory/worksheet-base": "^4.3.544",
|
|
113
113
|
"cron-parser": "^4.7.0",
|
|
114
114
|
"koa2-swagger-ui": "^5.0.2",
|
|
115
115
|
"swagger-jsdoc": "^5.0.0",
|
|
@@ -122,5 +122,5 @@
|
|
|
122
122
|
"resolutions": {
|
|
123
123
|
"core-js": "^3.16.0"
|
|
124
124
|
},
|
|
125
|
-
"gitHead": "
|
|
125
|
+
"gitHead": "d9ba6fd47325e8b698b33e2ea133f8596ba55719"
|
|
126
126
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { restfulApiRouter as router } from '@things-factory/api'
|
|
2
|
+
import { Bizplace, getPartnersBizplaces } from '@things-factory/biz-base'
|
|
3
|
+
import { ApiError, ApiErrorHandler, throwInternalServerError } from '../utils/error-util'
|
|
4
|
+
import { businessMiddleware, validationMiddleware, loggingMiddleware } from '../middlewares'
|
|
5
|
+
import { getConnection, SelectQueryBuilder } from 'typeorm'
|
|
6
|
+
import { Webhook } from '@things-factory/integration-base'
|
|
7
|
+
|
|
8
|
+
router.get(
|
|
9
|
+
'/v1/company/get-webhook-details',
|
|
10
|
+
businessMiddleware,
|
|
11
|
+
validationMiddleware,
|
|
12
|
+
loggingMiddleware,
|
|
13
|
+
async (context, next) => {
|
|
14
|
+
try {
|
|
15
|
+
await getConnection().transaction(async tx => {
|
|
16
|
+
const { user } = context.state
|
|
17
|
+
const { webhookId, warehouseBizplaceId } = context.query
|
|
18
|
+
const bizplace: Bizplace = await tx.getRepository(Bizplace).findOne({
|
|
19
|
+
where: { id: warehouseBizplaceId },
|
|
20
|
+
relations: ['domain']
|
|
21
|
+
})
|
|
22
|
+
if (!bizplace) throw new ApiError('E01', 'bizplaceId')
|
|
23
|
+
|
|
24
|
+
const partnerBizplaces: any[] = await getPartnersBizplaces(bizplace.domain, user, tx)
|
|
25
|
+
|
|
26
|
+
const qb: SelectQueryBuilder<Webhook> = await tx
|
|
27
|
+
.getRepository(Webhook)
|
|
28
|
+
.createQueryBuilder('webhook')
|
|
29
|
+
.leftJoinAndSelect('webhook.bizplaces', 'bz')
|
|
30
|
+
.leftJoinAndSelect('webhook.webhookEvents', 'webhookEvent')
|
|
31
|
+
.where('bz.id in (:...bizplacesIds)', { bizplacesIds: partnerBizplaces.map(p => p.id) })
|
|
32
|
+
|
|
33
|
+
if (webhookId) {
|
|
34
|
+
qb.andWhere('webhook.id = :webhookId', { webhookId })
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const result = await qb.getMany()
|
|
38
|
+
|
|
39
|
+
let data = []
|
|
40
|
+
for (const wb of result) {
|
|
41
|
+
let datapoint = {}
|
|
42
|
+
datapoint = {
|
|
43
|
+
id: wb.id,
|
|
44
|
+
name: wb.name,
|
|
45
|
+
active: wb.active,
|
|
46
|
+
url: wb.url,
|
|
47
|
+
targetUrl: wb.targetUrl,
|
|
48
|
+
extensionUrl: wb.extensionUrl,
|
|
49
|
+
events: wb.webhookEvents.map(e => e.name),
|
|
50
|
+
partnerBizplaces: wb.bizplaces.map(b => ({ id: b.id, name: b.name }))
|
|
51
|
+
}
|
|
52
|
+
data.push(datapoint)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
context.body = {
|
|
56
|
+
data
|
|
57
|
+
}
|
|
58
|
+
})
|
|
59
|
+
} catch (e) {
|
|
60
|
+
if (e instanceof ApiError) ApiErrorHandler(context, e)
|
|
61
|
+
else throwInternalServerError(context, e)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
)
|