@tillhub/schemas 6.156.0 → 6.157.2

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 CHANGED
@@ -1,3 +1,24 @@
1
+ ## [6.157.2](https://github.com/tillhub/schemas/compare/v6.157.1...v6.157.2) (2022-09-02)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **price_book:** time_constraints ([#726](https://github.com/tillhub/schemas/issues/726)) ([290a475](https://github.com/tillhub/schemas/commit/290a475))
7
+
8
+ ## [6.157.1](https://github.com/tillhub/schemas/compare/v6.157.0...v6.157.1) (2022-09-02)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **configurations:** Create schema for /api/v0/configurations/:account/:configurationID/users APIs ([#725](https://github.com/tillhub/schemas/issues/725)) ([f214976](https://github.com/tillhub/schemas/commit/f214976))
14
+
15
+ # [6.157.0](https://github.com/tillhub/schemas/compare/v6.156.0...v6.157.0) (2022-09-02)
16
+
17
+
18
+ ### Features
19
+
20
+ * **configurations:** Create schema for /api/v0/configurations/:account/:configurationID/users APIs ([#723](https://github.com/tillhub/schemas/issues/723)) ([10d2572](https://github.com/tillhub/schemas/commit/10d2572))
21
+
1
22
  # [6.156.0](https://github.com/tillhub/schemas/compare/v6.155.0...v6.156.0) (2022-08-10)
2
23
 
3
24
 
@@ -0,0 +1,146 @@
1
+ const { oneOf } = require('../helpers/payload-or-null')
2
+ const { timezone } = require('../common/timezones')
3
+
4
+ const dateRange = {
5
+ type: 'object',
6
+ additionalProperties: false,
7
+ required: [
8
+ 'enabled'
9
+ ],
10
+ properties: {
11
+ enabled: {
12
+ type: 'boolean',
13
+ description: 'disables or activates the date range',
14
+ default: true
15
+ },
16
+ tz: oneOf({
17
+ deprecated: true,
18
+ type: 'string',
19
+ description: 'specifies the timezone for a data range',
20
+ enum: timezone.iana,
21
+ default: null
22
+ }),
23
+ start: oneOf({
24
+ type: 'object',
25
+ additionalProperties: false,
26
+ required: [
27
+ 'enabled'
28
+ ],
29
+ properties: {
30
+ enabled: {
31
+ type: 'boolean',
32
+ description: 'disables or activates the start of a date range',
33
+ default: true
34
+ },
35
+ value: oneOf({
36
+ type: 'string',
37
+ format: 'date-time',
38
+ description: 'starting time of a date range',
39
+ example: '2021-09-23T08:19:02.059Z',
40
+ default: null // == distant past
41
+ })
42
+ }
43
+ }),
44
+ end: oneOf({
45
+ type: 'object',
46
+ additionalProperties: false,
47
+ required: [
48
+ 'enabled'
49
+ ],
50
+ properties: {
51
+ enabled: {
52
+ type: 'boolean',
53
+ description: 'disables or activates the end of a date range',
54
+ default: true
55
+ },
56
+ value: oneOf({
57
+ type: 'string',
58
+ format: 'date-time',
59
+ description: 'starting time of a date range',
60
+ example: '2021-10-03T14:20:31.011Z',
61
+ default: null // == distant future
62
+ })
63
+ }
64
+ })
65
+ }
66
+ }
67
+
68
+ const dayTimeSlot = {
69
+ type: 'object',
70
+ additionalProperties: false,
71
+ required: [
72
+ 'enabled'
73
+ ],
74
+ properties: {
75
+ enabled: {
76
+ type: 'boolean',
77
+ description: 'disables or activates a set slot',
78
+ default: true
79
+ },
80
+ start: oneOf({
81
+ type: 'string',
82
+ pattern: '([0-1][0-9]|2[0-3]):[0-5][0-9]',
83
+ example: '08:30',
84
+ description: 'daytime for the start of an active time slot',
85
+ default: '00:00'
86
+ }),
87
+ end: oneOf({
88
+ type: 'string',
89
+ pattern: '([0-1][0-9]|2[0-3]):[0-5][0-9]',
90
+ example: '09:15',
91
+ description: 'daytime for the end of an active time slot',
92
+ default: '23:59'
93
+ })
94
+ }
95
+ }
96
+
97
+ const dayTimeSlots = oneOf({
98
+ type: 'object',
99
+ additionalProperties: false,
100
+ properties: {
101
+ slots: oneOf({
102
+ description: 'A number of timeslots for a specific day. Not enforced - but overlaps are not encouraged',
103
+ type: 'array',
104
+ items: dayTimeSlot
105
+ })
106
+ }
107
+ })
108
+
109
+ module.exports = {
110
+ type: 'object',
111
+ additionalProperties: false,
112
+ properties: {
113
+ scheduled: oneOf({
114
+ type: 'object',
115
+ description: 'specifies date ranges and daytime slots for defining active states based on dates',
116
+ additionalProperties: false,
117
+ properties: {
118
+ date_range: oneOf({
119
+ description: 'a single range with optional start and end date',
120
+ dateRange
121
+ }),
122
+ day_of_week: oneOf({
123
+ type: 'object',
124
+ description: 'specifies daytime slots based on weekdays',
125
+ additionalProperties: false,
126
+ required: [
127
+ 'enabled'
128
+ ],
129
+ properties: {
130
+ enabled: {
131
+ type: 'boolean',
132
+ default: true
133
+ },
134
+ monday: dayTimeSlots,
135
+ tuesday: dayTimeSlots,
136
+ wednesday: dayTimeSlots,
137
+ thursday: dayTimeSlots,
138
+ friday: dayTimeSlots,
139
+ saturday: dayTimeSlots,
140
+ sunday: dayTimeSlots
141
+ }
142
+ })
143
+ }
144
+ })
145
+ }
146
+ }
@@ -0,0 +1 @@
1
+ module.exports.users = require('./users')
@@ -0,0 +1,32 @@
1
+ const user = require('./user')
2
+ const franchiseScopes = require('./franchise_scopes')
3
+ const franchiseeScopes = require('./franchisee_scopes')
4
+
5
+ module.exports = {
6
+ $id: 'https://schemas.tillhub.com/v0/configurations.users.create.request.schema.json',
7
+ $schema: 'http://json-schema.org/draft-07/schema#',
8
+ additionalProperties: false,
9
+ type: 'object',
10
+ required: ['user'],
11
+ properties: user,
12
+ allOf: [
13
+ {
14
+ if: {
15
+ properties: { role: { const: 'franchisee' } }
16
+ },
17
+ then: {
18
+ properties: franchiseeScopes,
19
+ required: [ 'user', 'role' ]
20
+ }
21
+ },
22
+ {
23
+ if: {
24
+ properties: { role: { const: 'franchise' } }
25
+ },
26
+ then: {
27
+ properties: franchiseScopes,
28
+ required: [ 'user', 'role' ]
29
+ }
30
+ }
31
+ ]
32
+ }
@@ -0,0 +1,16 @@
1
+ module.exports = {
2
+ scopes: {
3
+ type: 'array',
4
+ uniqueItems: true,
5
+ default: [
6
+ 'analytics:delegated'
7
+ ],
8
+ items: {
9
+ type: 'string',
10
+ enum: [
11
+ 'analytics:delegated',
12
+ 'analytics:delegated:audits.actions:type:carts.item.remove'
13
+ ]
14
+ }
15
+ }
16
+ }
@@ -0,0 +1,24 @@
1
+ module.exports = {
2
+ scopes: {
3
+ type: 'array',
4
+ uniqueItems: true,
5
+ default: [
6
+ 'vouchers:read:one',
7
+ 'vouchers:update:one'
8
+ ],
9
+ items: {
10
+ type: 'string',
11
+ enum: [
12
+ 'products:read',
13
+ 'products:read:one',
14
+ 'vouchers:admin',
15
+ 'vouchers:create',
16
+ 'vouchers:read',
17
+ 'vouchers:read:one',
18
+ 'vouchers:update',
19
+ 'vouchers:update:one',
20
+ 'vouchers:delete'
21
+ ]
22
+ }
23
+ }
24
+ }
@@ -0,0 +1,8 @@
1
+ module.exports = {
2
+ create: {
3
+ request: require('./create.request')
4
+ },
5
+ update: {
6
+ request: require('./update.request')
7
+ }
8
+ }
@@ -0,0 +1,12 @@
1
+ const user = require('./user')
2
+
3
+ module.exports = {
4
+ $id: 'https://schemas.tillhub.com/v0/configurations.users.update.request.schema.json',
5
+ $schema: 'http://json-schema.org/draft-07/schema#',
6
+ additionalProperties: false,
7
+ type: 'object',
8
+ required: [
9
+ 'user'
10
+ ],
11
+ properties: user
12
+ }
@@ -0,0 +1,129 @@
1
+ const { anyOf, oneOf } = require('../../../helpers/payload-or-null')
2
+
3
+ module.exports = {
4
+ user: {
5
+ type: 'object',
6
+ additionalProperties: false,
7
+ properties: {
8
+ id: oneOf({
9
+ type: 'string',
10
+ minLength: 5,
11
+ maxLength: 64
12
+ }),
13
+ email: oneOf({
14
+ type: 'string',
15
+ format: 'email'
16
+ })
17
+ }
18
+ },
19
+ description: oneOf({
20
+ type: 'string',
21
+ minLength: 1,
22
+ maxLength: 32
23
+ }),
24
+ name: anyOf({
25
+ type: 'string'
26
+ }),
27
+ firstname: {
28
+ type: 'string',
29
+ maxLength: 32,
30
+ minLength: 1
31
+ },
32
+ lastname: {
33
+ type: 'string',
34
+ maxLength: 32,
35
+ minLength: 1
36
+ },
37
+ blocked: {
38
+ type: 'boolean'
39
+ },
40
+ deleted: {
41
+ type: 'boolean'
42
+ },
43
+ active: {
44
+ type: 'boolean'
45
+ },
46
+ metadata: oneOf({
47
+ type: 'object'
48
+ }),
49
+ role: oneOf({
50
+ type: 'string',
51
+ enum: [
52
+ 'admin',
53
+ 'manager',
54
+ 'serviceaccount',
55
+ 'franchisee',
56
+ 'franchise',
57
+ 'staff',
58
+ 'accountant',
59
+ 'purchaser'
60
+ ]
61
+ }),
62
+ user_id: oneOf({
63
+ type: 'string'
64
+ }),
65
+ configuration_id: {
66
+ type: 'string'
67
+ },
68
+ groups: oneOf({
69
+ type: 'object'
70
+ }),
71
+ scopes: oneOf({
72
+ type: 'array',
73
+ items: {
74
+ type: 'string'
75
+ }
76
+ }),
77
+ user_permission_template_id: oneOf({
78
+ type: 'string'
79
+ }),
80
+ attributes: oneOf({
81
+ type: 'array',
82
+ items: {
83
+ type: 'string'
84
+ }
85
+ }),
86
+ parents: oneOf({
87
+ type: 'array',
88
+ items: {
89
+ type: 'string'
90
+ }
91
+ }),
92
+ children: oneOf({
93
+ type: 'array',
94
+ items: {
95
+ type: 'string'
96
+ }
97
+ }),
98
+ api_key: oneOf({
99
+ type: 'string',
100
+ minLength: 1,
101
+ maxLength: 64
102
+ }),
103
+ key: oneOf({
104
+ type: 'object'
105
+ }),
106
+ secret: oneOf({
107
+ type: 'string',
108
+ minLength: 5,
109
+ maxLength: 128
110
+ }),
111
+ username: oneOf({
112
+ type: 'string',
113
+ format: 'email'
114
+ }),
115
+ locations: oneOf({
116
+ type: 'array',
117
+ items: {
118
+ type: 'string',
119
+ format: 'uuid'
120
+ }
121
+ }),
122
+ branch_groups: oneOf({
123
+ type: 'array',
124
+ items: {
125
+ type: 'string',
126
+ format: 'uuid'
127
+ }
128
+ })
129
+ }
@@ -1,44 +1,5 @@
1
- const day = {
2
- type: 'object',
3
- additionalProperties: false,
4
- properties: {
5
- slots: {
6
- type: 'array',
7
- items: {
8
- type: 'object',
9
- additionalProperties: false,
10
- properties: {
11
- enabled: {
12
- type: 'boolean',
13
- default: true
14
- },
15
- start: {
16
- oneOf: [
17
- {
18
- type: 'string',
19
- pattern: '([0-1][0-9]|2[0-3]):[0-5][0-9]'
20
- },
21
- {
22
- type: 'null'
23
- }
24
- ]
25
- },
26
- end: {
27
- oneOf: [
28
- {
29
- type: 'string',
30
- pattern: '([0-1][0-9]|2[0-3]):[0-5][0-9]'
31
- },
32
- {
33
- type: 'null'
34
- }
35
- ]
36
- }
37
- }
38
- }
39
- }
40
- }
41
- }
1
+ const { oneOf } = require('../../helpers/payload-or-null')
2
+ const { timeConstraints } = require('../../common/time_constraints')
42
3
 
43
4
  module.exports = {
44
5
  amount: {
@@ -238,111 +199,9 @@ module.exports = {
238
199
  }
239
200
  ]
240
201
  },
241
- time: {
242
- type: 'object',
243
- additionalProperties: false,
244
- properties: {
245
- scheduled: {
246
- type: 'object',
247
- additionalProperties: false,
248
- properties: {
249
- day_of_week: {
250
- type: 'object',
251
- additionalProperties: false,
252
- properties: {
253
- enabled: {
254
- type: 'boolean',
255
- default: true
256
- },
257
- monday: day,
258
- tuesday: day,
259
- wednesday: day,
260
- thursday: day,
261
- friday: day,
262
- saturday: day,
263
- sunday: day
264
- }
265
- },
266
- date_range: {
267
- type: 'object',
268
- additionalProperties: false,
269
- properties: {
270
- enabled: {
271
- type: 'boolean',
272
- default: true
273
- },
274
- start: {
275
- oneOf: [
276
- {
277
- type: 'object',
278
- additionalProperties: false,
279
- properties: {
280
- enabled: {
281
- type: 'boolean',
282
- default: true
283
- },
284
- value: {
285
- oneOf: [
286
- {
287
- type: 'string',
288
- format: 'date-time'
289
- },
290
- {
291
- type: 'null'
292
- }
293
- ]
294
- }
295
- }
296
- },
297
- {
298
- type: 'null'
299
- }
300
- ]
301
- },
302
- end: {
303
- oneOf: [
304
- {
305
- type: 'object',
306
- additionalProperties: false,
307
- properties: {
308
- enabled: {
309
- type: 'boolean',
310
- default: true
311
- },
312
- value: {
313
- oneOf: [
314
- {
315
- type: 'string',
316
- format: 'date-time'
317
- },
318
- {
319
- type: 'null'
320
- }
321
- ]
322
- }
323
- }
324
- },
325
- {
326
- type: 'null'
327
- }
328
- ]
329
- },
330
- tz: {
331
- oneOf: [
332
- {
333
- type: 'string'
334
- },
335
- {
336
- type: 'null'
337
- }
338
- ]
339
- }
340
- }
341
- }
342
- }
343
- }
344
- }
345
- }
202
+ time: oneOf({
203
+ ...timeConstraints
204
+ })
346
205
  }
347
206
  },
348
207
  {
package/lib/v0/index.js CHANGED
@@ -72,5 +72,6 @@ module.exports.french_cert = require('./french_cert')
72
72
  module.exports.table_layouts = require('./table_layouts')
73
73
  module.exports.product_addons = require('./product_addons')
74
74
  module.exports.product_addon_groups = require('./product_addon_groups')
75
+ module.exports.configurations = require('./configurations')
75
76
 
76
77
  // hygen:injection - Please, don't delete this line: when running the cli for schema resources the new routes will be automatically added here.
@@ -1,153 +1,12 @@
1
- const day = {
2
- type: 'object',
3
- additionalProperties: false,
4
- properties: {
5
- slots: {
6
- type: 'array',
7
- items: {
8
- type: 'object',
9
- additionalProperties: false,
10
- properties: {
11
- enabled: {
12
- type: 'boolean',
13
- default: true
14
- },
15
- start: {
16
- oneOf: [
17
- {
18
- type: 'string',
19
- pattern: '([0-1][0-9]|2[0-3]):[0-5][0-9]'
20
- },
21
- {
22
- type: 'null'
23
- }
24
- ]
25
- },
26
- end: {
27
- oneOf: [
28
- {
29
- type: 'string',
30
- pattern: '([0-1][0-9]|2[0-3]):[0-5][0-9]'
31
- },
32
- {
33
- type: 'null'
34
- }
35
- ]
36
- }
37
- }
38
- }
39
- }
40
- }
41
- }
1
+ const { oneOf } = require('../../../helpers/payload-or-null')
2
+ const { timeConstraints } = require('../../../common/time_constraints')
42
3
 
43
4
  module.exports = {
44
5
  type: 'object',
45
6
  additionalProperties: false,
46
7
  properties: {
47
- time: {
48
- type: 'object',
49
- additionalProperties: false,
50
- properties: {
51
- scheduled: {
52
- type: 'object',
53
- additionalProperties: false,
54
- properties: {
55
- day_of_week: {
56
- type: 'object',
57
- additionalProperties: false,
58
- properties: {
59
- enabled: {
60
- type: 'boolean',
61
- default: true
62
- },
63
- monday: day,
64
- tuesday: day,
65
- wednesday: day,
66
- thursday: day,
67
- friday: day,
68
- saturday: day,
69
- sunday: day
70
- }
71
- },
72
- date_range: {
73
- type: 'object',
74
- additionalProperties: false,
75
- properties: {
76
- enabled: {
77
- type: 'boolean',
78
- default: true
79
- },
80
- start: {
81
- oneOf: [
82
- {
83
- type: 'object',
84
- additionalProperties: false,
85
- properties: {
86
- enabled: {
87
- type: 'boolean',
88
- default: true
89
- },
90
- value: {
91
- oneOf: [
92
- {
93
- type: 'string',
94
- format: 'date-time'
95
- },
96
- {
97
- type: 'null'
98
- }
99
- ]
100
- }
101
- }
102
- },
103
- {
104
- type: 'null'
105
- }
106
- ]
107
- },
108
- end: {
109
- oneOf: [
110
- {
111
- type: 'object',
112
- additionalProperties: false,
113
- properties: {
114
- enabled: {
115
- type: 'boolean',
116
- default: true
117
- },
118
- value: {
119
- oneOf: [
120
- {
121
- type: 'string',
122
- format: 'date-time'
123
- },
124
- {
125
- type: 'null'
126
- }
127
- ]
128
- }
129
- }
130
- },
131
- {
132
- type: 'null'
133
- }
134
- ]
135
- },
136
- tz: {
137
- oneOf: [
138
- {
139
- type: 'string'
140
- },
141
- {
142
- type: 'null'
143
- }
144
- ]
145
- }
146
- }
147
- }
148
- }
149
- }
150
- }
151
- }
8
+ time: oneOf({
9
+ ...timeConstraints
10
+ })
152
11
  }
153
12
  }
@@ -1,153 +1,12 @@
1
- const day = {
2
- type: 'object',
3
- additionalProperties: false,
4
- properties: {
5
- slots: {
6
- type: 'array',
7
- items: {
8
- type: 'object',
9
- additionalProperties: false,
10
- properties: {
11
- enabled: {
12
- type: 'boolean',
13
- default: true
14
- },
15
- start: {
16
- oneOf: [
17
- {
18
- type: 'string',
19
- pattern: '([0-1][0-9]|2[0-3]):[0-5][0-9]'
20
- },
21
- {
22
- type: 'null'
23
- }
24
- ]
25
- },
26
- end: {
27
- oneOf: [
28
- {
29
- type: 'string',
30
- pattern: '([0-1][0-9]|2[0-3]):[0-5][0-9]'
31
- },
32
- {
33
- type: 'null'
34
- }
35
- ]
36
- }
37
- }
38
- }
39
- }
40
- }
41
- }
1
+ const { oneOf } = require('../../../helpers/payload-or-null')
2
+ const { timeConstraints } = require('../../../common/time_constraints')
42
3
 
43
4
  module.exports = {
44
5
  type: 'object',
45
6
  additionalProperties: false,
46
7
  properties: {
47
- time: {
48
- type: 'object',
49
- additionalProperties: false,
50
- properties: {
51
- scheduled: {
52
- type: 'object',
53
- additionalProperties: false,
54
- properties: {
55
- day_of_week: {
56
- type: 'object',
57
- additionalProperties: false,
58
- properties: {
59
- enabled: {
60
- type: 'boolean',
61
- default: true
62
- },
63
- monday: day,
64
- tuesday: day,
65
- wednesday: day,
66
- thursday: day,
67
- friday: day,
68
- saturday: day,
69
- sunday: day
70
- }
71
- },
72
- date_range: {
73
- type: 'object',
74
- additionalProperties: false,
75
- properties: {
76
- enabled: {
77
- type: 'boolean',
78
- default: true
79
- },
80
- start: {
81
- oneOf: [
82
- {
83
- type: 'object',
84
- additionalProperties: false,
85
- properties: {
86
- enabled: {
87
- type: 'boolean',
88
- default: true
89
- },
90
- value: {
91
- oneOf: [
92
- {
93
- type: 'string',
94
- format: 'date-time'
95
- },
96
- {
97
- type: 'null'
98
- }
99
- ]
100
- }
101
- }
102
- },
103
- {
104
- type: 'null'
105
- }
106
- ]
107
- },
108
- end: {
109
- oneOf: [
110
- {
111
- type: 'object',
112
- additionalProperties: false,
113
- properties: {
114
- enabled: {
115
- type: 'boolean',
116
- default: true
117
- },
118
- value: {
119
- oneOf: [
120
- {
121
- type: 'string',
122
- format: 'date-time'
123
- },
124
- {
125
- type: 'null'
126
- }
127
- ]
128
- }
129
- }
130
- },
131
- {
132
- type: 'null'
133
- }
134
- ]
135
- },
136
- tz: {
137
- oneOf: [
138
- {
139
- type: 'string'
140
- },
141
- {
142
- type: 'null'
143
- }
144
- ]
145
- }
146
- }
147
- }
148
- }
149
- }
150
- }
151
- }
8
+ time: oneOf({
9
+ ...timeConstraints
10
+ })
152
11
  }
153
12
  }
@@ -1,46 +1,5 @@
1
1
  const { oneOf } = require('../../helpers/payload-or-null')
2
-
3
- const day = {
4
- type: 'object',
5
- additionalProperties: false,
6
- properties: {
7
- slots: {
8
- type: 'array',
9
- items: {
10
- type: 'object',
11
- additionalProperties: false,
12
- properties: {
13
- enabled: {
14
- type: 'boolean',
15
- default: true
16
- },
17
- start: {
18
- oneOf: [
19
- {
20
- type: 'string',
21
- pattern: '([0-1][0-9]|2[0-3]):[0-5][0-9]'
22
- },
23
- {
24
- type: 'null'
25
- }
26
- ]
27
- },
28
- end: {
29
- oneOf: [
30
- {
31
- type: 'string',
32
- pattern: '([0-1][0-9]|2[0-3]):[0-5][0-9]'
33
- },
34
- {
35
- type: 'null'
36
- }
37
- ]
38
- }
39
- }
40
- }
41
- }
42
- }
43
- }
2
+ const { timeConstraints } = require('../../common/time_constraints')
44
3
 
45
4
  module.exports = {
46
5
  name: {
@@ -235,109 +194,7 @@ module.exports = {
235
194
  additionalProperties: false,
236
195
  properties: {
237
196
  time: {
238
- type: 'object',
239
- additionalProperties: false,
240
- properties: {
241
- scheduled: {
242
- type: 'object',
243
- additionalProperties: false,
244
- properties: {
245
- day_of_week: {
246
- type: 'object',
247
- additionalProperties: false,
248
- properties: {
249
- enabled: {
250
- type: 'boolean',
251
- default: true
252
- },
253
- monday: day,
254
- tuesday: day,
255
- wednesday: day,
256
- thursday: day,
257
- friday: day,
258
- saturday: day,
259
- sunday: day
260
- }
261
- },
262
- date_range: {
263
- type: 'object',
264
- additionalProperties: false,
265
- properties: {
266
- enabled: {
267
- type: 'boolean',
268
- default: true
269
- },
270
- start: {
271
- oneOf: [
272
- {
273
- type: 'object',
274
- additionalProperties: false,
275
- properties: {
276
- enabled: {
277
- type: 'boolean',
278
- default: true
279
- },
280
- value: {
281
- oneOf: [
282
- {
283
- type: 'string',
284
- format: 'date-time'
285
- },
286
- {
287
- type: 'null'
288
- }
289
- ]
290
- }
291
- }
292
- },
293
- {
294
- type: 'null'
295
- }
296
- ]
297
- },
298
- end: {
299
- oneOf: [
300
- {
301
- type: 'object',
302
- additionalProperties: false,
303
- properties: {
304
- enabled: {
305
- type: 'boolean',
306
- default: true
307
- },
308
- value: {
309
- oneOf: [
310
- {
311
- type: 'string',
312
- format: 'date-time'
313
- },
314
- {
315
- type: 'null'
316
- }
317
- ]
318
- }
319
- }
320
- },
321
- {
322
- type: 'null'
323
- }
324
- ]
325
- },
326
- tz: {
327
- oneOf: [
328
- {
329
- type: 'string'
330
- },
331
- {
332
- type: 'null'
333
- }
334
- ]
335
- }
336
- }
337
- }
338
- }
339
- }
340
- }
197
+ ...timeConstraints
341
198
  }
342
199
  }
343
200
  },
@@ -1,153 +1,12 @@
1
- const day = {
2
- type: 'object',
3
- additionalProperties: false,
4
- properties: {
5
- slots: {
6
- type: 'array',
7
- items: {
8
- type: 'object',
9
- additionalProperties: false,
10
- properties: {
11
- enabled: {
12
- type: 'boolean',
13
- default: true
14
- },
15
- start: {
16
- oneOf: [
17
- {
18
- type: 'string',
19
- pattern: '([0-1][0-9]|2[0-3]):[0-5][0-9]'
20
- },
21
- {
22
- type: 'null'
23
- }
24
- ]
25
- },
26
- end: {
27
- oneOf: [
28
- {
29
- type: 'string',
30
- pattern: '([0-1][0-9]|2[0-3]):[0-5][0-9]'
31
- },
32
- {
33
- type: 'null'
34
- }
35
- ]
36
- }
37
- }
38
- }
39
- }
40
- }
41
- }
1
+ const { oneOf } = require('../../../../../helpers/payload-or-null')
2
+ const { timeConstraints } = require('../../../../../common/time_constraints')
42
3
 
43
4
  module.exports = {
44
5
  type: 'object',
45
6
  additionalProperties: false,
46
7
  properties: {
47
- time: {
48
- type: 'object',
49
- additionalProperties: false,
50
- properties: {
51
- scheduled: {
52
- type: 'object',
53
- additionalProperties: false,
54
- properties: {
55
- day_of_week: {
56
- type: 'object',
57
- additionalProperties: false,
58
- properties: {
59
- enabled: {
60
- type: 'boolean',
61
- default: true
62
- },
63
- monday: day,
64
- tuesday: day,
65
- wednesday: day,
66
- thursday: day,
67
- friday: day,
68
- saturday: day,
69
- sunday: day
70
- }
71
- },
72
- date_range: {
73
- type: 'object',
74
- additionalProperties: false,
75
- properties: {
76
- enabled: {
77
- type: 'boolean',
78
- default: true
79
- },
80
- start: {
81
- oneOf: [
82
- {
83
- type: 'object',
84
- additionalProperties: false,
85
- properties: {
86
- enabled: {
87
- type: 'boolean',
88
- default: true
89
- },
90
- value: {
91
- oneOf: [
92
- {
93
- type: 'string',
94
- format: 'date-time'
95
- },
96
- {
97
- type: 'null'
98
- }
99
- ]
100
- }
101
- }
102
- },
103
- {
104
- type: 'null'
105
- }
106
- ]
107
- },
108
- end: {
109
- oneOf: [
110
- {
111
- type: 'object',
112
- additionalProperties: false,
113
- properties: {
114
- enabled: {
115
- type: 'boolean',
116
- default: true
117
- },
118
- value: {
119
- oneOf: [
120
- {
121
- type: 'string',
122
- format: 'date-time'
123
- },
124
- {
125
- type: 'null'
126
- }
127
- ]
128
- }
129
- }
130
- },
131
- {
132
- type: 'null'
133
- }
134
- ]
135
- },
136
- tz: {
137
- oneOf: [
138
- {
139
- type: 'string'
140
- },
141
- {
142
- type: 'null'
143
- }
144
- ]
145
- }
146
- }
147
- }
148
- }
149
- }
150
- }
151
- }
8
+ time: oneOf({
9
+ ...timeConstraints
10
+ })
152
11
  }
153
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tillhub/schemas",
3
- "version": "6.156.0",
3
+ "version": "6.157.2",
4
4
  "private": false,
5
5
  "description": "All Tillhub API OpenAPI 3 compatible JSON Schemas.",
6
6
  "main": "./lib/index.js",
@@ -0,0 +1,21 @@
1
+ const test = require('tape')
2
+ const validate = require('../../helpers/validate-schema')
3
+
4
+ test('Configurations users: create schema validation', function (t) {
5
+ t.plan(2)
6
+ const createRequest = require('../../../lib/v0/configurations/users').create.request
7
+ const { valid, error } = validate(createRequest)
8
+ t.ok(valid, 'create schema is valid')
9
+ t.error(error, 'should not get any error')
10
+ t.end()
11
+ })
12
+
13
+ test('Configurations users: update schema validation', function (t) {
14
+ t.plan(2)
15
+ const updateRequest = require('../../../lib/v0/configurations/users').update.request
16
+ const { valid, error } = validate(updateRequest)
17
+
18
+ t.ok(valid, 'update schema is valid')
19
+ t.error(error, 'should not get any error')
20
+ t.end()
21
+ })