@tillhub/schemas 6.452.0 → 6.454.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.
@@ -161,6 +161,107 @@ module.exports = oneOf({
161
161
  }
162
162
  }
163
163
  },
164
+ opening_hours_exceptions: {
165
+ description: 'Additive Open or Closed exceptions over a date range, optionally limited to selected weekdays. Closed is full day only. 0 = Monday … 6 = Sunday.',
166
+ type: 'array',
167
+ items: {
168
+ type: 'object',
169
+ additionalProperties: false,
170
+ required: ['type', 'start_date', 'end_date'],
171
+ properties: {
172
+ type: {
173
+ type: 'string',
174
+ enum: ['open', 'closed']
175
+ },
176
+ start_date: {
177
+ type: 'string',
178
+ format: 'date'
179
+ },
180
+ end_date: {
181
+ type: 'string',
182
+ format: 'date'
183
+ },
184
+ weekdays: {
185
+ type: 'array',
186
+ items: {
187
+ type: 'integer',
188
+ minimum: 0,
189
+ maximum: 6
190
+ }
191
+ },
192
+ from: {
193
+ oneOf: [
194
+ { type: 'null' },
195
+ { type: 'string', pattern: '^([01]\\d|2[0-3]):[0-5]\\d$' }
196
+ ]
197
+ },
198
+ to: {
199
+ oneOf: [
200
+ { type: 'null' },
201
+ { type: 'string', pattern: '^([01]\\d|2[0-3]):[0-5]\\d$' }
202
+ ]
203
+ },
204
+ break_from: {
205
+ oneOf: [
206
+ { type: 'null' },
207
+ { type: 'string', pattern: '^([01]\\d|2[0-3]):[0-5]\\d$' }
208
+ ]
209
+ },
210
+ break_to: {
211
+ oneOf: [
212
+ { type: 'null' },
213
+ { type: 'string', pattern: '^([01]\\d|2[0-3]):[0-5]\\d$' }
214
+ ]
215
+ },
216
+ reason: {
217
+ type: 'string'
218
+ }
219
+ },
220
+ allOf: [
221
+ {
222
+ if: {
223
+ properties: {
224
+ type: { const: 'closed' }
225
+ },
226
+ required: ['type']
227
+ },
228
+ then: {
229
+ properties: {
230
+ from: { type: 'null' },
231
+ to: { type: 'null' },
232
+ break_from: { type: 'null' },
233
+ break_to: { type: 'null' }
234
+ }
235
+ }
236
+ },
237
+ {
238
+ if: {
239
+ properties: {
240
+ type: { const: 'open' }
241
+ },
242
+ required: ['type']
243
+ },
244
+ then: {
245
+ oneOf: [
246
+ {
247
+ properties: {
248
+ from: { type: 'null' },
249
+ to: { type: 'null' }
250
+ }
251
+ },
252
+ {
253
+ properties: {
254
+ from: { type: 'string' },
255
+ to: { type: 'string' }
256
+ },
257
+ required: ['from', 'to']
258
+ }
259
+ ]
260
+ }
261
+ }
262
+ ]
263
+ }
264
+ },
164
265
  appointment_reminder: {
165
266
  type: 'boolean'
166
267
  },
@@ -0,0 +1,31 @@
1
+ module.exports = {
2
+ $id: 'https://schemas.tillhub.com/v1/gastro_orders.deltas.query.request.schema.json',
3
+ $schema: 'http://json-schema.org/draft-07/schema#',
4
+ type: 'object',
5
+ additionalProperties: false,
6
+ required: [],
7
+ properties: {
8
+ order: {
9
+ type: 'string',
10
+ format: 'uuid'
11
+ },
12
+ start: {
13
+ type: 'string',
14
+ format: 'date-time',
15
+ example: '2026-08-27T14:55:05.000Z'
16
+ },
17
+ end: {
18
+ type: 'string',
19
+ format: 'date-time',
20
+ example: '2026-08-27T14:55:05.000Z'
21
+ },
22
+ limit: {
23
+ type: 'integer',
24
+ minimum: 1
25
+ },
26
+ offset: {
27
+ type: 'integer',
28
+ minimum: 1
29
+ }
30
+ }
31
+ }
@@ -1,6 +1,14 @@
1
1
  const commonResponse = require('../../common/response')
2
2
 
3
3
  module.exports.deltas = {
4
+ query: {
5
+ request: require('./deltas/query'),
6
+ response: {
7
+ $id: 'https://schemas.tillhub.com/v1/gastro_orders.deltas.get.response.schema.json',
8
+ $schema: 'http://json-schema.org/draft-07/schema#',
9
+ ...commonResponse({ resultItems: require('./deltas/response') })
10
+ }
11
+ },
4
12
  create: {
5
13
  request: require('./deltas/create.request'),
6
14
  response: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tillhub/schemas",
3
- "version": "6.452.0",
3
+ "version": "6.454.0",
4
4
  "private": false,
5
5
  "description": "All Tillhub API OpenAPI 3 compatible JSON Schemas.",
6
6
  "main": "./lib/index.js",
@@ -1,6 +1,11 @@
1
1
  const test = require('tape')
2
+ const Ajv = require('ajv')
2
3
  const validate = require('../helpers/validate-schema')
3
4
 
5
+ const ajv = new Ajv({ allErrors: true })
6
+ const updateRequest = require('../../lib/v1/configurations').update.request
7
+ const validateUpdatePayload = ajv.compile(updateRequest)
8
+
4
9
  test('Configurations: create schema validation', function (t) {
5
10
  t.plan(2)
6
11
  const createRequest = require('../../lib/v1/configurations').create.request
@@ -28,3 +33,111 @@ test('Configurations: patch schema validation', function (t) {
28
33
  t.error(error, 'should not get any error')
29
34
  t.end()
30
35
  })
36
+
37
+ test('Configurations: opening_hours_exceptions accepts Open all-day, Open hours, and Closed full-day', function (t) {
38
+ t.plan(1)
39
+ const valid = validateUpdatePayload({
40
+ reservations: {
41
+ opening_hours_exceptions: [
42
+ {
43
+ type: 'open',
44
+ start_date: '2026-12-20',
45
+ end_date: '2026-12-20',
46
+ from: null,
47
+ to: null,
48
+ reason: 'Sunday brunch all day'
49
+ },
50
+ {
51
+ type: 'open',
52
+ start_date: '2026-07-02',
53
+ end_date: '2026-07-11',
54
+ weekdays: [1, 3],
55
+ from: '10:00',
56
+ to: '22:00',
57
+ break_from: null,
58
+ break_to: null,
59
+ reason: 'Summer Tue/Thu hours'
60
+ },
61
+ {
62
+ type: 'closed',
63
+ start_date: '2026-01-01',
64
+ end_date: '2026-03-31',
65
+ weekdays: [0, 1],
66
+ from: null,
67
+ to: null,
68
+ reason: 'Winter Mon/Tue closure'
69
+ }
70
+ ]
71
+ }
72
+ })
73
+ t.ok(valid, ajv.errorsText(validateUpdatePayload.errors))
74
+ t.end()
75
+ })
76
+
77
+ test('Configurations: opening_hours_exceptions rejects Closed with specific hours', function (t) {
78
+ t.plan(1)
79
+ const valid = validateUpdatePayload({
80
+ reservations: {
81
+ opening_hours_exceptions: [
82
+ {
83
+ type: 'closed',
84
+ start_date: '2026-01-01',
85
+ end_date: '2026-01-01',
86
+ from: '10:00',
87
+ to: '18:00'
88
+ }
89
+ ]
90
+ }
91
+ })
92
+ t.notOk(valid, 'Closed exceptions must be full day (from/to null)')
93
+ t.end()
94
+ })
95
+
96
+ test('Configurations: opening_hours_exceptions rejects mixed Open from/to', function (t) {
97
+ t.plan(1)
98
+ const valid = validateUpdatePayload({
99
+ reservations: {
100
+ opening_hours_exceptions: [
101
+ {
102
+ type: 'open',
103
+ start_date: '2026-12-20',
104
+ end_date: '2026-12-20',
105
+ from: '10:00',
106
+ to: null
107
+ }
108
+ ]
109
+ }
110
+ })
111
+ t.notOk(valid, 'Open from/to must both be null or both be set')
112
+ t.end()
113
+ })
114
+
115
+ test('Configurations: opening_hours_exceptions rejects invalid HH:mm times', function (t) {
116
+ t.plan(1)
117
+ const valid = validateUpdatePayload({
118
+ reservations: {
119
+ opening_hours_exceptions: [
120
+ {
121
+ type: 'open',
122
+ start_date: '2026-12-20',
123
+ end_date: '2026-12-20',
124
+ from: '25:00',
125
+ to: '26:00'
126
+ }
127
+ ]
128
+ }
129
+ })
130
+ t.notOk(valid, 'Open from/to must match HH:mm')
131
+ t.end()
132
+ })
133
+
134
+ test('Configurations: payloads without opening_hours_exceptions remain valid', function (t) {
135
+ t.plan(1)
136
+ const valid = validateUpdatePayload({
137
+ reservations: {
138
+ opening_hours: []
139
+ }
140
+ })
141
+ t.ok(valid, ajv.errorsText(validateUpdatePayload.errors))
142
+ t.end()
143
+ })