@tillhub/schemas 6.128.0 → 6.129.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 +7 -0
- package/lib/common/base.js +15 -9
- package/lib/v0/reasons/base.js +11 -0
- package/lib/v0/reasons/create.js +5 -2
- package/lib/v0/reasons/index.js +1 -0
- package/lib/v0/reasons/read.js +38 -0
- package/lib/v0/reasons/update.js +5 -2
- package/package.json +1 -1
- package/lib/v0/reasons/default-response.js +0 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [6.129.0](https://github.com/tillhub/schemas/compare/v6.128.0...v6.129.0) (2022-03-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **reasons:** add type "POS price change" #API-1409 ([#683](https://github.com/tillhub/schemas/issues/683)) ([1de76ff](https://github.com/tillhub/schemas/commit/1de76ff)), closes [#API-1409](https://github.com/tillhub/schemas/issues/API-1409) [#API-1409](https://github.com/tillhub/schemas/issues/API-1409)
|
|
7
|
+
|
|
1
8
|
# [6.128.0](https://github.com/tillhub/schemas/compare/v6.127.0...v6.128.0) (2022-03-18)
|
|
2
9
|
|
|
3
10
|
|
package/lib/common/base.js
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
|
+
const dateObject = require('./date_object')
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Create common base object
|
|
3
5
|
* @param {Object} [options]
|
|
4
6
|
*/
|
|
5
|
-
function baseObject (
|
|
7
|
+
function baseObject ({
|
|
8
|
+
splitDate = false
|
|
9
|
+
} = {}) {
|
|
10
|
+
const dateType = splitDate ? dateObject : {
|
|
11
|
+
type: 'string',
|
|
12
|
+
format: 'date-time',
|
|
13
|
+
example: '2019-03-17T21:12:04.849Z'
|
|
14
|
+
}
|
|
15
|
+
|
|
6
16
|
return {
|
|
7
17
|
id: {
|
|
8
18
|
description: 'Unique entity ID',
|
|
@@ -11,16 +21,12 @@ function baseObject (options = {}) {
|
|
|
11
21
|
example: '936835f7-2d75-41d2-9001-38ed6e458328'
|
|
12
22
|
},
|
|
13
23
|
created_at: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
format: 'date-time',
|
|
17
|
-
example: '2019-03-17T21:12:04.849Z'
|
|
24
|
+
...dateType,
|
|
25
|
+
description: 'The date and time entity was created'
|
|
18
26
|
},
|
|
19
27
|
updated_at: {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
format: 'date-time',
|
|
23
|
-
example: '2019-03-17T21:12:04.849Z'
|
|
28
|
+
...dateType,
|
|
29
|
+
description: 'The date and time entity was updated'
|
|
24
30
|
}
|
|
25
31
|
}
|
|
26
32
|
}
|
package/lib/v0/reasons/base.js
CHANGED
|
@@ -3,6 +3,8 @@ const { oneOf } = require('../../helpers/payload-or-null')
|
|
|
3
3
|
module.exports = {
|
|
4
4
|
name: {
|
|
5
5
|
...oneOf([{
|
|
6
|
+
description: 'The reason name',
|
|
7
|
+
example: 'Returned goods',
|
|
6
8
|
type: 'string',
|
|
7
9
|
minLength: 1,
|
|
8
10
|
maxLength: 128
|
|
@@ -10,6 +12,8 @@ module.exports = {
|
|
|
10
12
|
},
|
|
11
13
|
description: {
|
|
12
14
|
...oneOf([{
|
|
15
|
+
description: 'The reason description',
|
|
16
|
+
example: 'Goods were returned by the customer',
|
|
13
17
|
type: 'string',
|
|
14
18
|
minLength: 1,
|
|
15
19
|
maxLength: 4096
|
|
@@ -56,26 +60,33 @@ module.exports = {
|
|
|
56
60
|
type: 'boolean'
|
|
57
61
|
},
|
|
58
62
|
active: {
|
|
63
|
+
description: 'The reason is active',
|
|
59
64
|
type: 'boolean'
|
|
60
65
|
},
|
|
61
66
|
type: {
|
|
67
|
+
description: 'The reason type',
|
|
68
|
+
example: 'expense',
|
|
62
69
|
type: 'string',
|
|
63
70
|
enum: [
|
|
64
71
|
'refund',
|
|
72
|
+
'pos_price_change',
|
|
65
73
|
'stock_change',
|
|
66
74
|
'expense',
|
|
67
75
|
'deposit'
|
|
68
76
|
]
|
|
69
77
|
},
|
|
70
78
|
noted_required: {
|
|
79
|
+
description: 'The action must be noted',
|
|
71
80
|
type: 'boolean',
|
|
72
81
|
default: false
|
|
73
82
|
},
|
|
74
83
|
image_required: {
|
|
84
|
+
description: 'The image must be enclosed',
|
|
75
85
|
type: 'boolean',
|
|
76
86
|
default: false
|
|
77
87
|
},
|
|
78
88
|
approval_required: {
|
|
89
|
+
description: 'The action must be approved by supervisor',
|
|
79
90
|
type: 'boolean',
|
|
80
91
|
default: false
|
|
81
92
|
}
|
package/lib/v0/reasons/create.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
const baseObject = require('../../common/base')
|
|
1
2
|
const base = require('./base')
|
|
2
|
-
const defaultResponse = require('./default-response')
|
|
3
3
|
|
|
4
4
|
module.exports.request = {
|
|
5
5
|
$id: 'https://schemas.tillhub.com/v0/reasons.create.request.schema.json',
|
|
@@ -22,5 +22,8 @@ module.exports.response = {
|
|
|
22
22
|
'id',
|
|
23
23
|
'name'
|
|
24
24
|
],
|
|
25
|
-
properties:
|
|
25
|
+
properties: {
|
|
26
|
+
...baseObject(),
|
|
27
|
+
...base
|
|
28
|
+
}
|
|
26
29
|
}
|
package/lib/v0/reasons/index.js
CHANGED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
const baseObject = require('../../common/base')
|
|
2
|
+
const commonResponse = require('../../common/response')
|
|
3
|
+
|
|
4
|
+
const base = require('./base')
|
|
5
|
+
|
|
6
|
+
module.exports.all = {
|
|
7
|
+
response: {
|
|
8
|
+
$id: 'https://schemas.tillhub.com/v0/reasons.read.all.response.schema.json',
|
|
9
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
10
|
+
...commonResponse({
|
|
11
|
+
resultItems: {
|
|
12
|
+
type: 'object',
|
|
13
|
+
additionalProperties: false,
|
|
14
|
+
properties: {
|
|
15
|
+
...baseObject({ splitDate: true }),
|
|
16
|
+
...base
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
})
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
module.exports.one = {
|
|
24
|
+
response: {
|
|
25
|
+
$id: 'https://schemas.tillhub.com/v0/reasons.read.one.response.schema.json',
|
|
26
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
27
|
+
...commonResponse({
|
|
28
|
+
resultItems: {
|
|
29
|
+
type: 'object',
|
|
30
|
+
additionalProperties: false,
|
|
31
|
+
properties: {
|
|
32
|
+
...baseObject({ splitDate: true }),
|
|
33
|
+
...base
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
}
|
|
38
|
+
}
|
package/lib/v0/reasons/update.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
const baseObject = require('../../common/base')
|
|
1
2
|
const base = require('./base')
|
|
2
|
-
const defaultResponse = require('./default-response')
|
|
3
3
|
|
|
4
4
|
module.exports.request = {
|
|
5
5
|
$id: 'https://schemas.tillhub.com/v0/reasons.update.request.schema.json',
|
|
@@ -18,5 +18,8 @@ module.exports.response = {
|
|
|
18
18
|
required: [
|
|
19
19
|
'id'
|
|
20
20
|
],
|
|
21
|
-
properties:
|
|
21
|
+
properties: {
|
|
22
|
+
...baseObject(),
|
|
23
|
+
...base
|
|
24
|
+
}
|
|
22
25
|
}
|
package/package.json
CHANGED