@tillhub/schemas 6.179.0 → 6.181.0
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/CHANGELOG.md +15 -1
- package/lib/common/base.js +4 -3
- package/lib/v0/stocks_book/create.js +16 -32
- package/lib/v0/stocks_book/read.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [6.181.0](https://github.com/tillhub/schemas/compare/v6.180.0...v6.181.0) (2022-12-12)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **stocks-book:** align schema with requirements v1 #UNTIL-5820 ([c606cc8](https://github.com/tillhub/schemas/commit/c606cc8)), closes [#UNTIL-5820](https://github.com/tillhub/schemas/issues/UNTIL-5820)
|
|
7
|
+
|
|
8
|
+
# [6.180.0](https://github.com/tillhub/schemas/compare/v6.179.0...v6.180.0) (2022-12-12)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **release:** trigger the release ([40f7c6d](https://github.com/tillhub/schemas/commit/40f7c6d))
|
|
14
|
+
|
|
1
15
|
# [6.179.0](https://github.com/tillhub/schemas/compare/v6.178.0...v6.179.0) (2022-12-09)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -10,7 +24,7 @@
|
|
|
10
24
|
|
|
11
25
|
### Features
|
|
12
26
|
|
|
13
|
-
* **stocks-book:** add stocks book schemas
|
|
27
|
+
* **stocks-book:** add stocks book schemas ([8172c34](https://github.com/tillhub/schemas/commit/8172c34)), closes [#UNTIL-5820](https://github.com/tillhub/schemas/issues/UNTIL-5820)
|
|
14
28
|
* **stocks-book:** fix linter issues ([a4d1ba8](https://github.com/tillhub/schemas/commit/a4d1ba8))
|
|
15
29
|
|
|
16
30
|
# [6.177.0](https://github.com/tillhub/schemas/compare/v6.176.0...v6.177.0) (2022-12-07)
|
package/lib/common/base.js
CHANGED
|
@@ -5,6 +5,7 @@ const dateObject = require('./date_object')
|
|
|
5
5
|
* @param {Object} [options]
|
|
6
6
|
*/
|
|
7
7
|
function baseObject ({
|
|
8
|
+
entityName = 'entity',
|
|
8
9
|
splitDate = false
|
|
9
10
|
} = {}) {
|
|
10
11
|
const dateType = splitDate ? dateObject : {
|
|
@@ -15,18 +16,18 @@ function baseObject ({
|
|
|
15
16
|
|
|
16
17
|
return {
|
|
17
18
|
id: {
|
|
18
|
-
description:
|
|
19
|
+
description: `Unique ${entityName} ID`,
|
|
19
20
|
type: 'string',
|
|
20
21
|
format: 'uuid',
|
|
21
22
|
example: '936835f7-2d75-41d2-9001-38ed6e458328'
|
|
22
23
|
},
|
|
23
24
|
created_at: {
|
|
24
25
|
...dateType,
|
|
25
|
-
description:
|
|
26
|
+
description: `The date and time ${entityName} was created`
|
|
26
27
|
},
|
|
27
28
|
updated_at: {
|
|
28
29
|
...dateType,
|
|
29
|
-
description:
|
|
30
|
+
description: `The date and time ${entityName} was updated`
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
}
|
|
@@ -3,17 +3,16 @@ const { oneOf } = require('../../helpers/payload-or-null')
|
|
|
3
3
|
const baseObject = require('../../common/base')
|
|
4
4
|
const baseProduct = require('../../v1/products/base').response
|
|
5
5
|
const baseBranch = require('../../v0/branches/base')
|
|
6
|
-
const baseReason = require('../../v0/reasons/base')
|
|
7
6
|
const baseStockBook = require('./base').simple
|
|
8
7
|
|
|
9
|
-
const {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} = baseStockBook
|
|
8
|
+
const eventBaseData = pick({
|
|
9
|
+
...baseObject({ entityName: 'stock book' }),
|
|
10
|
+
...baseStockBook
|
|
11
|
+
}, ['id', 'qty_change', 'type'])
|
|
14
12
|
|
|
15
|
-
const
|
|
16
|
-
product:
|
|
13
|
+
const eventOverrideData = {
|
|
14
|
+
product: {
|
|
15
|
+
description: 'The product which stock was affected',
|
|
17
16
|
type: 'object',
|
|
18
17
|
additionalProperties: false,
|
|
19
18
|
properties: pick({
|
|
@@ -23,14 +22,11 @@ const eventEmbeddedData = {
|
|
|
23
22
|
'id',
|
|
24
23
|
'name',
|
|
25
24
|
'client_id',
|
|
26
|
-
'custom_id'
|
|
27
|
-
'custom_properties',
|
|
28
|
-
'metadata',
|
|
29
|
-
'product_group',
|
|
30
|
-
'is_service'
|
|
25
|
+
'custom_id'
|
|
31
26
|
])
|
|
32
|
-
}
|
|
33
|
-
location:
|
|
27
|
+
},
|
|
28
|
+
location: {
|
|
29
|
+
description: 'The location the stock was booked at',
|
|
34
30
|
type: 'object',
|
|
35
31
|
additionalProperties: false,
|
|
36
32
|
properties: pick({
|
|
@@ -43,18 +39,10 @@ const eventEmbeddedData = {
|
|
|
43
39
|
'branch_number',
|
|
44
40
|
'metadata'
|
|
45
41
|
])
|
|
46
|
-
}
|
|
42
|
+
},
|
|
47
43
|
reason: oneOf({
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
properties: pick({
|
|
51
|
-
...baseObject(),
|
|
52
|
-
...baseReason
|
|
53
|
-
}, [
|
|
54
|
-
'id',
|
|
55
|
-
'name',
|
|
56
|
-
'type'
|
|
57
|
-
])
|
|
44
|
+
description: 'The reason of stock book',
|
|
45
|
+
type: 'string'
|
|
58
46
|
})
|
|
59
47
|
}
|
|
60
48
|
|
|
@@ -66,17 +54,13 @@ module.exports = {
|
|
|
66
54
|
additionalProperties: false,
|
|
67
55
|
required: [
|
|
68
56
|
'id',
|
|
69
|
-
'qty',
|
|
70
57
|
'qty_change',
|
|
71
58
|
'product',
|
|
72
|
-
'location'
|
|
73
|
-
'from',
|
|
74
|
-
'to'
|
|
59
|
+
'location'
|
|
75
60
|
],
|
|
76
61
|
properties: {
|
|
77
|
-
...baseObject(),
|
|
78
62
|
...eventBaseData,
|
|
79
|
-
...
|
|
63
|
+
...eventOverrideData
|
|
80
64
|
}
|
|
81
65
|
}
|
|
82
66
|
}
|