@things-factory/operato-hub 4.1.35 → 4.1.38
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/unstable/get-delivery-orders.js +1 -1
- package/dist-server/routers/api/restful-apis/unstable/get-delivery-orders.js.map +1 -1
- package/dist-server/routers/api/restful-apis/unstable/get-goods-received-notes.js +1 -1
- package/dist-server/routers/api/restful-apis/unstable/get-goods-received-notes.js.map +1 -1
- package/dist-server/routers/api/restful-apis/v1/get-delivery-orders.js +148 -0
- package/dist-server/routers/api/restful-apis/v1/get-delivery-orders.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/get-goods-received-notes.js +104 -0
- package/dist-server/routers/api/restful-apis/v1/get-goods-received-notes.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v1/index.js +2 -0
- package/dist-server/routers/api/restful-apis/v1/index.js.map +1 -1
- package/dist-server/routers/api/restful-apis/v2/get-delivery-orders.js +148 -0
- package/dist-server/routers/api/restful-apis/v2/get-delivery-orders.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/get-goods-received-notes.js +104 -0
- package/dist-server/routers/api/restful-apis/v2/get-goods-received-notes.js.map +1 -0
- package/dist-server/routers/api/restful-apis/v2/index.js +2 -0
- package/dist-server/routers/api/restful-apis/v2/index.js.map +1 -1
- package/openapi/unstable/inbound.yaml +178 -0
- package/openapi/unstable/outbound.yaml +316 -0
- package/openapi/v1/inbound.yaml +178 -0
- package/openapi/v1/outbound.yaml +316 -0
- package/openapi/v2/inbound.yaml +178 -0
- package/openapi/v2/outbound.yaml +316 -0
- package/package.json +8 -8
- package/server/routers/api/restful-apis/unstable/get-delivery-orders.ts +1 -1
- package/server/routers/api/restful-apis/unstable/get-goods-received-notes.ts +1 -1
- package/server/routers/api/restful-apis/v1/get-delivery-orders.ts +162 -0
- package/server/routers/api/restful-apis/v1/get-goods-received-notes.ts +118 -0
- package/server/routers/api/restful-apis/v1/index.ts +2 -0
- package/server/routers/api/restful-apis/v2/get-delivery-orders.ts +162 -0
- package/server/routers/api/restful-apis/v2/get-goods-received-notes.ts +118 -0
- package/server/routers/api/restful-apis/v2/index.ts +2 -0
- package/translations/en.json +1 -0
- package/translations/ko.json +1 -0
- package/translations/ms.json +1 -0
- package/translations/zh.json +1 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import gql from 'graphql-tag'
|
|
2
|
+
import { EntityManager, getConnection } from 'typeorm'
|
|
3
|
+
|
|
4
|
+
import { restfulApiRouter as router } from '@things-factory/api'
|
|
5
|
+
|
|
6
|
+
import { businessMiddleware } from '../../../../middlewares/business-middleware'
|
|
7
|
+
import { warehouseMiddleware } from '../../../../middlewares/warehouse-middleware'
|
|
8
|
+
|
|
9
|
+
const debug = require('debug')('things-factory:operato-hub:restful-api:v2:get-delivery-orders')
|
|
10
|
+
|
|
11
|
+
router.get(
|
|
12
|
+
'/v2/warehouse/:warehouseId/get-delivery-orders',
|
|
13
|
+
businessMiddleware,
|
|
14
|
+
warehouseMiddleware,
|
|
15
|
+
async (context, next) => {
|
|
16
|
+
return await getConnection().transaction(async (tx: EntityManager) => {
|
|
17
|
+
const { client, warehouse: bizplace, domain } = context.state
|
|
18
|
+
const { warehouseId: customerBizplaceId } = context.params
|
|
19
|
+
const { t } = context
|
|
20
|
+
|
|
21
|
+
const { fromDate, toDate, limit = 10, page = 1 } = context.query
|
|
22
|
+
|
|
23
|
+
if (!customerBizplaceId) context.throw(404, t('Error: Warehouse id not found'))
|
|
24
|
+
if (!fromDate || !toDate) context.throw(400, t('Error: Date range not provided correctly'))
|
|
25
|
+
if (limit > 100 || limit < 0) context.throw(400, t('Error: Limit value exceed 100 maximum threshold'))
|
|
26
|
+
|
|
27
|
+
let noOfDays = (new Date(toDate).getTime() - new Date(fromDate).getTime()) / (1000 * 3600 * 24)
|
|
28
|
+
if (noOfDays >= 31 || noOfDays <= 0)
|
|
29
|
+
context.throw(400, t('Error: Date range value exceed 1 month maximum threshold'))
|
|
30
|
+
|
|
31
|
+
let filters: any = [
|
|
32
|
+
{ name: 'bizplace', operator: 'in', value: [customerBizplaceId], relation: true },
|
|
33
|
+
{ name: 'createdAt', operator: 'between', value: [fromDate, toDate] },
|
|
34
|
+
{ name: 'orderProductsApi', operator: 'equal', value: true }
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
let pagination: any = { page: parseInt(page), limit: parseInt(limit) }
|
|
38
|
+
|
|
39
|
+
let data = {
|
|
40
|
+
result: (
|
|
41
|
+
await client.query({
|
|
42
|
+
query: gql`
|
|
43
|
+
query deliveryOrders($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
44
|
+
deliveryOrders(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
45
|
+
items {
|
|
46
|
+
name
|
|
47
|
+
from
|
|
48
|
+
to
|
|
49
|
+
contactPointRefId
|
|
50
|
+
truckNo
|
|
51
|
+
deliveryDate
|
|
52
|
+
status
|
|
53
|
+
ownCollection
|
|
54
|
+
looseItem
|
|
55
|
+
deliveryDateTime
|
|
56
|
+
loadWeight
|
|
57
|
+
cargoType
|
|
58
|
+
urgency
|
|
59
|
+
telNo
|
|
60
|
+
refNo
|
|
61
|
+
otherDriver
|
|
62
|
+
palletQty
|
|
63
|
+
remark
|
|
64
|
+
description
|
|
65
|
+
reusablePallet
|
|
66
|
+
domain {
|
|
67
|
+
name
|
|
68
|
+
}
|
|
69
|
+
bizplace {
|
|
70
|
+
name
|
|
71
|
+
}
|
|
72
|
+
attachments {
|
|
73
|
+
name
|
|
74
|
+
refBy
|
|
75
|
+
path
|
|
76
|
+
}
|
|
77
|
+
releaseGood {
|
|
78
|
+
name
|
|
79
|
+
description
|
|
80
|
+
refNo
|
|
81
|
+
collectionOrderNo
|
|
82
|
+
truckNo
|
|
83
|
+
exportOption
|
|
84
|
+
ownTransport
|
|
85
|
+
crossDocking
|
|
86
|
+
status
|
|
87
|
+
releaseDateTime
|
|
88
|
+
releaseDate
|
|
89
|
+
remark
|
|
90
|
+
courierOption
|
|
91
|
+
packingOption
|
|
92
|
+
refNo2
|
|
93
|
+
refNo3
|
|
94
|
+
type
|
|
95
|
+
acceptedAt
|
|
96
|
+
marketplaceOrderStatus
|
|
97
|
+
billingAddress
|
|
98
|
+
deliveryAddress1
|
|
99
|
+
deliveryAddress2
|
|
100
|
+
deliveryAddress3
|
|
101
|
+
deliveryAddress4
|
|
102
|
+
deliveryAddress5
|
|
103
|
+
attentionTo
|
|
104
|
+
attentionCompany
|
|
105
|
+
city
|
|
106
|
+
state
|
|
107
|
+
postalCode
|
|
108
|
+
country
|
|
109
|
+
phone1
|
|
110
|
+
phone2
|
|
111
|
+
email
|
|
112
|
+
transporter
|
|
113
|
+
trackingNo
|
|
114
|
+
airwayBill
|
|
115
|
+
invoice
|
|
116
|
+
pickupAddress
|
|
117
|
+
pickupTime
|
|
118
|
+
handoverType
|
|
119
|
+
dropoffAddress
|
|
120
|
+
noOfItems
|
|
121
|
+
orderProducts {
|
|
122
|
+
id
|
|
123
|
+
type
|
|
124
|
+
batchId
|
|
125
|
+
packingType
|
|
126
|
+
packingSize
|
|
127
|
+
releaseQty
|
|
128
|
+
releaseUomValue
|
|
129
|
+
status
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
createdAt
|
|
133
|
+
updatedAt
|
|
134
|
+
updater {
|
|
135
|
+
name
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
total
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
`,
|
|
142
|
+
variables: {
|
|
143
|
+
filters,
|
|
144
|
+
pagination,
|
|
145
|
+
sortings: [{ name: 'createdAt', desc: true }]
|
|
146
|
+
},
|
|
147
|
+
context: {
|
|
148
|
+
...context,
|
|
149
|
+
state: {
|
|
150
|
+
...context.state,
|
|
151
|
+
bizplace,
|
|
152
|
+
domain
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
} as any)
|
|
156
|
+
).data
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
context.body = data?.result?.deliveryOrders?.items?.length == 0 ? 'No data available' : data
|
|
160
|
+
})
|
|
161
|
+
}
|
|
162
|
+
)
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import gql from 'graphql-tag'
|
|
2
|
+
import { EntityManager, getConnection } from 'typeorm'
|
|
3
|
+
|
|
4
|
+
import { restfulApiRouter as router } from '@things-factory/api'
|
|
5
|
+
|
|
6
|
+
import { businessMiddleware } from '../../../../middlewares/business-middleware'
|
|
7
|
+
import { warehouseMiddleware } from '../../../../middlewares/warehouse-middleware'
|
|
8
|
+
|
|
9
|
+
const debug = require('debug')('things-factory:operato-hub:restful-api:v2:get-goods-received-notes')
|
|
10
|
+
|
|
11
|
+
router.get(
|
|
12
|
+
'/v2/warehouse/:warehouseId/get-goods-received-notes',
|
|
13
|
+
businessMiddleware,
|
|
14
|
+
warehouseMiddleware,
|
|
15
|
+
async (context, next) => {
|
|
16
|
+
return await getConnection().transaction(async (tx: EntityManager) => {
|
|
17
|
+
const { client, warehouse: bizplace, domain } = context.state
|
|
18
|
+
const { warehouseId: customerBizplaceId } = context.params
|
|
19
|
+
const { t } = context
|
|
20
|
+
|
|
21
|
+
const { fromDate, toDate, limit = 10, page = 1 } = context.query
|
|
22
|
+
|
|
23
|
+
if (!customerBizplaceId) context.throw(404, t('Error: Warehouse id not found'))
|
|
24
|
+
if (!fromDate || !toDate) context.throw(400, t('Error: Date range not provided correctly'))
|
|
25
|
+
if (limit > 100 || limit < 0) context.throw(400, t('Error: Limit value exceed 100 maximum threshold'))
|
|
26
|
+
|
|
27
|
+
let noOfDays = (new Date(toDate).getTime() - new Date(fromDate).getTime()) / (1000 * 3600 * 24)
|
|
28
|
+
if (noOfDays >= 31 || noOfDays <= 0)
|
|
29
|
+
context.throw(400, t('Error: Date range value exceed 1 month maximum threshold'))
|
|
30
|
+
|
|
31
|
+
let filters: any = [
|
|
32
|
+
{ name: 'bizplace', operator: 'in', value: [customerBizplaceId], relation: true },
|
|
33
|
+
{ name: 'createdAt', operator: 'between', value: [fromDate, toDate] },
|
|
34
|
+
{ name: 'orderProductsApi', operator: 'equal', value: true }
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
let pagination: any = { page: parseInt(page), limit: parseInt(limit) }
|
|
38
|
+
|
|
39
|
+
let data = {
|
|
40
|
+
result: (
|
|
41
|
+
await client.query({
|
|
42
|
+
query: gql`
|
|
43
|
+
query goodsReceivalNotes($filters: [Filter!], $pagination: Pagination, $sortings: [Sorting!]) {
|
|
44
|
+
goodsReceivalNotes(filters: $filters, pagination: $pagination, sortings: $sortings) {
|
|
45
|
+
items {
|
|
46
|
+
id
|
|
47
|
+
name
|
|
48
|
+
refNo
|
|
49
|
+
description
|
|
50
|
+
customerStatus
|
|
51
|
+
status
|
|
52
|
+
domain {
|
|
53
|
+
id
|
|
54
|
+
name
|
|
55
|
+
}
|
|
56
|
+
arrivalNotice {
|
|
57
|
+
id
|
|
58
|
+
name
|
|
59
|
+
description
|
|
60
|
+
status
|
|
61
|
+
refNo
|
|
62
|
+
refNo2
|
|
63
|
+
refNo3
|
|
64
|
+
orderProducts {
|
|
65
|
+
id
|
|
66
|
+
type
|
|
67
|
+
batchId
|
|
68
|
+
packingType
|
|
69
|
+
packingSize
|
|
70
|
+
releaseQty
|
|
71
|
+
releaseUomValue
|
|
72
|
+
status
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
bizplace {
|
|
76
|
+
id
|
|
77
|
+
name
|
|
78
|
+
description
|
|
79
|
+
}
|
|
80
|
+
attachments {
|
|
81
|
+
id
|
|
82
|
+
name
|
|
83
|
+
refBy
|
|
84
|
+
path
|
|
85
|
+
}
|
|
86
|
+
createdAt
|
|
87
|
+
updatedAt
|
|
88
|
+
updater {
|
|
89
|
+
id
|
|
90
|
+
name
|
|
91
|
+
description
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
total
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
`,
|
|
98
|
+
variables: {
|
|
99
|
+
filters,
|
|
100
|
+
pagination,
|
|
101
|
+
sortings: [{ name: 'createdAt', desc: true }]
|
|
102
|
+
},
|
|
103
|
+
context: {
|
|
104
|
+
...context,
|
|
105
|
+
state: {
|
|
106
|
+
...context.state,
|
|
107
|
+
bizplace,
|
|
108
|
+
domain
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
} as any)
|
|
112
|
+
).data
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
context.body = data?.result?.goodsReceivalNotes?.items?.length == 0 ? 'No data available' : data
|
|
116
|
+
})
|
|
117
|
+
}
|
|
118
|
+
)
|
package/translations/en.json
CHANGED
package/translations/ko.json
CHANGED
package/translations/ms.json
CHANGED