@tillhub/schemas 6.122.0 → 6.125.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 +21 -0
- package/lib/common/gender.js +18 -0
- package/lib/v0/analytics/discounts/index.js +63 -0
- package/lib/v0/analytics/index.js +1 -0
- package/lib/v0/client_accounts/features/base.js +4 -0
- package/lib/v0/customers/base.js +2 -12
- package/lib/v0/staff/base.js +2 -14
- package/lib/v0/users/profile/base.js +2 -7
- package/lib/v1/carts/items/create.js +65 -30
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
# [6.125.0](https://github.com/tillhub/schemas/compare/v6.124.0...v6.125.0) (2022-03-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **staff:** unify 'gender' field #API-1412 ([b927123](https://github.com/tillhub/schemas/commit/b927123)), closes [#API-1412](https://github.com/tillhub/schemas/issues/API-1412)
|
|
7
|
+
|
|
8
|
+
# [6.124.0](https://github.com/tillhub/schemas/compare/v6.123.0...v6.124.0) (2022-03-09)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **discounts:** Discounts export ([#677](https://github.com/tillhub/schemas/issues/677)) ([ced1b07](https://github.com/tillhub/schemas/commit/ced1b07))
|
|
14
|
+
|
|
15
|
+
# [6.123.0](https://github.com/tillhub/schemas/compare/v6.122.0...v6.123.0) (2022-02-25)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* **carts:** make 'tax' and 'vat_rate' conditional required, add 'acc… ([#674](https://github.com/tillhub/schemas/issues/674)) ([d4e00b6](https://github.com/tillhub/schemas/commit/d4e00b6)), closes [#API-1373](https://github.com/tillhub/schemas/issues/API-1373)
|
|
21
|
+
|
|
1
22
|
# [6.122.0](https://github.com/tillhub/schemas/compare/v6.121.0...v6.122.0) (2022-02-22)
|
|
2
23
|
|
|
3
24
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const { oneOf } = require('../helpers/payload-or-null')
|
|
2
|
+
|
|
3
|
+
function getGender () {
|
|
4
|
+
return {
|
|
5
|
+
description: 'Gender',
|
|
6
|
+
example: 'male',
|
|
7
|
+
...oneOf({
|
|
8
|
+
type: 'string',
|
|
9
|
+
enum: [
|
|
10
|
+
'male',
|
|
11
|
+
'female',
|
|
12
|
+
'unspecified'
|
|
13
|
+
]
|
|
14
|
+
})
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
module.exports = { getGender }
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
module.exports.request = {
|
|
2
|
+
$id: 'https://schemas.tillhub.com/v0/analytics.discounts.request.schema.json',
|
|
3
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
4
|
+
type: 'object',
|
|
5
|
+
'additionalProperties': false,
|
|
6
|
+
'properties': {
|
|
7
|
+
'limit': {
|
|
8
|
+
'type': 'string',
|
|
9
|
+
'maxLength': 4
|
|
10
|
+
},
|
|
11
|
+
'format': {
|
|
12
|
+
'type': 'string',
|
|
13
|
+
'enum': [
|
|
14
|
+
'csv'
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
'start': {
|
|
18
|
+
'oneOf': [
|
|
19
|
+
{
|
|
20
|
+
'type': 'string',
|
|
21
|
+
'format': 'date'
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
'type': 'string',
|
|
25
|
+
'format': 'date-time'
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
'end': {
|
|
30
|
+
'oneOf': [
|
|
31
|
+
{
|
|
32
|
+
'type': 'string',
|
|
33
|
+
'format': 'date'
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
'type': 'string',
|
|
37
|
+
'format': 'date-time'
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
'discount': {
|
|
42
|
+
'type': 'string'
|
|
43
|
+
},
|
|
44
|
+
'product': {
|
|
45
|
+
'type': 'string'
|
|
46
|
+
},
|
|
47
|
+
'branch': {
|
|
48
|
+
'type': 'string'
|
|
49
|
+
},
|
|
50
|
+
'discount_rate': {
|
|
51
|
+
'type': 'string'
|
|
52
|
+
},
|
|
53
|
+
'export_map': {
|
|
54
|
+
'type': 'object',
|
|
55
|
+
'properties': {
|
|
56
|
+
'fields': {
|
|
57
|
+
'type': 'object'
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
'required': []
|
|
63
|
+
}
|
package/lib/v0/customers/base.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const { anyOf, oneOf } = require('../../helpers/payload-or-null')
|
|
2
2
|
const { getAddress } = require('../../common/address')
|
|
3
|
+
const { getGender } = require('../../common/gender')
|
|
3
4
|
const { getImages } = require('../../common/images')
|
|
4
5
|
|
|
5
6
|
module.exports = {
|
|
@@ -401,18 +402,7 @@ module.exports = {
|
|
|
401
402
|
}
|
|
402
403
|
})
|
|
403
404
|
},
|
|
404
|
-
gender:
|
|
405
|
-
description: 'Gender',
|
|
406
|
-
example: 'male',
|
|
407
|
-
...oneOf({
|
|
408
|
-
type: 'string',
|
|
409
|
-
enum: [
|
|
410
|
-
'male',
|
|
411
|
-
'female',
|
|
412
|
-
'unspecified'
|
|
413
|
-
]
|
|
414
|
-
})
|
|
415
|
-
},
|
|
405
|
+
gender: getGender(),
|
|
416
406
|
vat_id: {
|
|
417
407
|
description: 'Customer VAT ID',
|
|
418
408
|
...oneOf({
|
package/lib/v0/staff/base.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const { getGender } = require('../../common/gender')
|
|
1
2
|
const { oneOf } = require('../../helpers/payload-or-null')
|
|
2
3
|
|
|
3
4
|
module.exports = {
|
|
@@ -136,20 +137,7 @@ module.exports = {
|
|
|
136
137
|
}
|
|
137
138
|
]
|
|
138
139
|
},
|
|
139
|
-
gender:
|
|
140
|
-
oneOf: [
|
|
141
|
-
{
|
|
142
|
-
type: 'string',
|
|
143
|
-
enum: [
|
|
144
|
-
'male',
|
|
145
|
-
'female'
|
|
146
|
-
]
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
type: 'null'
|
|
150
|
-
}
|
|
151
|
-
]
|
|
152
|
-
},
|
|
140
|
+
gender: getGender(),
|
|
153
141
|
images: {
|
|
154
142
|
description: 'A Tillhub image object with URLs to display images this for staff.',
|
|
155
143
|
anyOf: [
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const { getGender } = require('../../../common/gender')
|
|
1
2
|
const { oneOf } = require('../../../helpers/payload-or-null')
|
|
2
3
|
|
|
3
4
|
module.exports = {
|
|
@@ -181,13 +182,7 @@ module.exports = {
|
|
|
181
182
|
type: 'string',
|
|
182
183
|
format: 'date-time'
|
|
183
184
|
}),
|
|
184
|
-
gender:
|
|
185
|
-
type: 'string',
|
|
186
|
-
enum: [
|
|
187
|
-
'male',
|
|
188
|
-
'female'
|
|
189
|
-
]
|
|
190
|
-
}),
|
|
185
|
+
gender: getGender(),
|
|
191
186
|
active: {
|
|
192
187
|
description: 'Soft disable or enable this user_profiles.',
|
|
193
188
|
type: 'boolean',
|
|
@@ -6,20 +6,30 @@ const customProperties = require('../../../common/custom_properties')
|
|
|
6
6
|
|
|
7
7
|
const masterData = {
|
|
8
8
|
salesman_staff: {
|
|
9
|
+
description: 'Staff person ID',
|
|
9
10
|
...oneOf({
|
|
10
11
|
type: 'string',
|
|
11
12
|
format: 'uuid'
|
|
12
13
|
})
|
|
13
14
|
},
|
|
14
15
|
tax: {
|
|
16
|
+
description: 'Tax rate ID',
|
|
15
17
|
type: 'string',
|
|
16
18
|
format: 'uuid'
|
|
17
19
|
},
|
|
18
20
|
account: {
|
|
21
|
+
description: 'Account ID',
|
|
19
22
|
type: 'string',
|
|
20
23
|
format: 'uuid'
|
|
21
24
|
},
|
|
25
|
+
account_number: {
|
|
26
|
+
description: 'Account number',
|
|
27
|
+
...oneOf({
|
|
28
|
+
type: 'string'
|
|
29
|
+
})
|
|
30
|
+
},
|
|
22
31
|
product_group: {
|
|
32
|
+
description: 'Product group ID',
|
|
23
33
|
...oneOf({
|
|
24
34
|
type: 'string',
|
|
25
35
|
format: 'uuid'
|
|
@@ -407,15 +417,18 @@ const internalDiscounts = {
|
|
|
407
417
|
|
|
408
418
|
const base = {
|
|
409
419
|
name: {
|
|
420
|
+
description: 'Cart item display name',
|
|
410
421
|
type: 'string',
|
|
411
422
|
minLength: 1,
|
|
412
423
|
maxLength: 128
|
|
413
424
|
},
|
|
414
425
|
position: {
|
|
426
|
+
description: 'Cart item position',
|
|
415
427
|
type: 'number',
|
|
416
428
|
minimum: 0
|
|
417
429
|
},
|
|
418
430
|
comments: {
|
|
431
|
+
description: 'Additional comments',
|
|
419
432
|
...anyOf({
|
|
420
433
|
type: 'string',
|
|
421
434
|
maxLength: 4096
|
|
@@ -435,15 +448,6 @@ const base = {
|
|
|
435
448
|
const externalCart = {
|
|
436
449
|
additionalProperties: false,
|
|
437
450
|
type: 'object',
|
|
438
|
-
required: [
|
|
439
|
-
'custom_id',
|
|
440
|
-
'qty',
|
|
441
|
-
'name',
|
|
442
|
-
'currency',
|
|
443
|
-
'amount',
|
|
444
|
-
'tax',
|
|
445
|
-
'account'
|
|
446
|
-
],
|
|
447
451
|
properties: {
|
|
448
452
|
product: {
|
|
449
453
|
description: 'The Tillhub product unique identifier',
|
|
@@ -502,15 +506,29 @@ const externalCart = {
|
|
|
502
506
|
},
|
|
503
507
|
discounts: externalDiscounts,
|
|
504
508
|
...base
|
|
505
|
-
}
|
|
509
|
+
},
|
|
510
|
+
anyOf: [{
|
|
511
|
+
required: [
|
|
512
|
+
'custom_id',
|
|
513
|
+
'qty',
|
|
514
|
+
'name',
|
|
515
|
+
'currency',
|
|
516
|
+
'amount',
|
|
517
|
+
'tax'
|
|
518
|
+
]
|
|
519
|
+
}, {
|
|
520
|
+
required: [
|
|
521
|
+
'custom_id',
|
|
522
|
+
'qty',
|
|
523
|
+
'name',
|
|
524
|
+
'currency',
|
|
525
|
+
'amount',
|
|
526
|
+
'vat_rate'
|
|
527
|
+
]
|
|
528
|
+
}]
|
|
506
529
|
}
|
|
507
530
|
|
|
508
531
|
const cartOfIds = {
|
|
509
|
-
required: [
|
|
510
|
-
'product',
|
|
511
|
-
'currency',
|
|
512
|
-
'qty'
|
|
513
|
-
],
|
|
514
532
|
additionalProperties: false,
|
|
515
533
|
type: 'object',
|
|
516
534
|
properties: {
|
|
@@ -548,25 +566,17 @@ const cartOfIds = {
|
|
|
548
566
|
maxLength: 128
|
|
549
567
|
},
|
|
550
568
|
discounts: externalDiscounts
|
|
551
|
-
}
|
|
569
|
+
},
|
|
570
|
+
required: [
|
|
571
|
+
'product',
|
|
572
|
+
'currency',
|
|
573
|
+
'qty'
|
|
574
|
+
]
|
|
552
575
|
}
|
|
553
576
|
|
|
554
577
|
const internalCart = {
|
|
555
578
|
additionalProperties: false,
|
|
556
579
|
type: 'object',
|
|
557
|
-
required: [
|
|
558
|
-
'product',
|
|
559
|
-
'qty',
|
|
560
|
-
'custom_id',
|
|
561
|
-
'vat_rate',
|
|
562
|
-
'salesman_staff',
|
|
563
|
-
'tax',
|
|
564
|
-
'account',
|
|
565
|
-
'name',
|
|
566
|
-
'discounts',
|
|
567
|
-
'amount',
|
|
568
|
-
'currency'
|
|
569
|
-
],
|
|
570
580
|
properties: {
|
|
571
581
|
product: {
|
|
572
582
|
description: 'Identifier of the product',
|
|
@@ -704,7 +714,32 @@ const internalCart = {
|
|
|
704
714
|
type: 'object'
|
|
705
715
|
})
|
|
706
716
|
}
|
|
707
|
-
}
|
|
717
|
+
},
|
|
718
|
+
anyOf: [{
|
|
719
|
+
required: [
|
|
720
|
+
'product',
|
|
721
|
+
'qty',
|
|
722
|
+
'custom_id',
|
|
723
|
+
'salesman_staff',
|
|
724
|
+
'name',
|
|
725
|
+
'discounts',
|
|
726
|
+
'amount',
|
|
727
|
+
'currency',
|
|
728
|
+
'tax'
|
|
729
|
+
]
|
|
730
|
+
}, {
|
|
731
|
+
required: [
|
|
732
|
+
'product',
|
|
733
|
+
'qty',
|
|
734
|
+
'custom_id',
|
|
735
|
+
'salesman_staff',
|
|
736
|
+
'name',
|
|
737
|
+
'discounts',
|
|
738
|
+
'amount',
|
|
739
|
+
'currency',
|
|
740
|
+
'vat_rate'
|
|
741
|
+
]
|
|
742
|
+
}]
|
|
708
743
|
}
|
|
709
744
|
|
|
710
745
|
module.exports = {
|