@tillhub/schemas 6.117.1 → 6.120.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 CHANGED
@@ -1,3 +1,33 @@
1
+ # [6.120.0](https://github.com/tillhub/schemas/compare/v6.119.0...v6.120.0) (2022-02-17)
2
+
3
+
4
+ ### Features
5
+
6
+ * **branches:** add detailed branches schema #API-1392 ([#671](https://github.com/tillhub/schemas/issues/671)) ([3232d2b](https://github.com/tillhub/schemas/commit/3232d2b)), closes [#API-1392](https://github.com/tillhub/schemas/issues/API-1392) [#API-1392](https://github.com/tillhub/schemas/issues/API-1392)
7
+
8
+ # [6.119.0](https://github.com/tillhub/schemas/compare/v6.118.1...v6.119.0) (2022-02-15)
9
+
10
+
11
+ ### Features
12
+
13
+ * **audits:** add audit logs response schema #API-1331 ([#668](https://github.com/tillhub/schemas/issues/668)) ([057c73e](https://github.com/tillhub/schemas/commit/057c73e)), closes [#API-1331](https://github.com/tillhub/schemas/issues/API-1331) [#API-1331](https://github.com/tillhub/schemas/issues/API-1331)
14
+
15
+ ## [6.118.1](https://github.com/tillhub/schemas/compare/v6.118.0...v6.118.1) (2022-02-14)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * **docs:** fixing the children type on category_trees ([141dc8e](https://github.com/tillhub/schemas/commit/141dc8e))
21
+
22
+ # [6.118.0](https://github.com/tillhub/schemas/compare/v6.117.1...v6.118.0) (2022-02-10)
23
+
24
+
25
+ ### Features
26
+
27
+ * **configurations:** features ([d9ad71d](https://github.com/tillhub/schemas/commit/d9ad71d))
28
+ * **configurations:** gastro ([d977675](https://github.com/tillhub/schemas/commit/d977675))
29
+ * **configurations:** gastro ([71126be](https://github.com/tillhub/schemas/commit/71126be))
30
+
1
31
  ## [6.117.1](https://github.com/tillhub/schemas/compare/v6.117.0...v6.117.1) (2022-02-09)
2
32
 
3
33
 
@@ -5,16 +5,19 @@
5
5
  function baseObject (options = {}) {
6
6
  return {
7
7
  id: {
8
+ description: 'Unique entity ID',
8
9
  type: 'string',
9
10
  format: 'uuid',
10
11
  example: '936835f7-2d75-41d2-9001-38ed6e458328'
11
12
  },
12
13
  created_at: {
14
+ description: 'The date and time entity was created',
13
15
  type: 'string',
14
16
  format: 'date-time',
15
17
  example: '2019-03-17T21:12:04.849Z'
16
18
  },
17
19
  updated_at: {
20
+ description: 'The date and time entity was updated',
18
21
  type: 'string',
19
22
  format: 'date-time',
20
23
  example: '2019-03-17T21:12:04.849Z'
@@ -0,0 +1,57 @@
1
+ const definedSizes = {
2
+ '1x': {
3
+ description: 'Image transformed to predefined small size',
4
+ example: 'https://my-storage.io/images/f5a3cc72-7fb5-4d2c-bda5-9b2983c7e879_1x.png',
5
+ type: 'string',
6
+ format: 'uri'
7
+ },
8
+ '2x': {
9
+ description: 'Image transformed to predefined medium size',
10
+ example: 'https://my-storage.io/images/f5a3cc72-7fb5-4d2c-bda5-9b2983c7e879_2x.png',
11
+ type: 'string',
12
+ format: 'uri'
13
+ },
14
+ '3x': {
15
+ description: 'Image transformed to predefined big size',
16
+ example: 'https://my-storage.io/images/f5a3cc72-7fb5-4d2c-bda5-9b2983c7e879_1x.png',
17
+ type: 'string',
18
+ format: 'uri'
19
+ },
20
+ avatar: {
21
+ description: 'Image transformed to predefined size to use as "avatar"',
22
+ example: 'https://my-storage.io/images/f5a3cc72-7fb5-4d2c-bda5-9b2983c7e879_avatar.png',
23
+ type: 'string',
24
+ format: 'uri'
25
+ }
26
+ }
27
+
28
+ function getImages (sizes = ['1x', '2x', '3x', 'avatar'], strict = false) {
29
+ const sizesMap = sizes.reduce((memo, size) => {
30
+ if (!definedSizes[size]) {
31
+ throw new ReferenceError(`Size '${size}' is not defined`)
32
+ }
33
+
34
+ memo[size] = { ...definedSizes[size] }
35
+ return memo
36
+ }, {})
37
+
38
+ return {
39
+ description: 'Images object with URLs of various types of images',
40
+ anyOf: [{
41
+ type: 'object',
42
+ additionalProperties: !strict,
43
+ properties: {
44
+ ...sizesMap,
45
+ original: {
46
+ description: 'Original image',
47
+ example: 'https://my-storage.io/images/f5a3cc72-7fb5-4d2c-bda5-9b2983c7e879.png',
48
+ type: 'string',
49
+ format: 'uri'
50
+ }
51
+ } }, {
52
+ type: 'null'
53
+ }]
54
+ }
55
+ }
56
+
57
+ module.exports = { getImages }
@@ -0,0 +1,64 @@
1
+ const standardParams = {
2
+ start: {
3
+ description: 'The start date to filter entities by "updated_at" field value',
4
+ example: '2022-02-01T00:00:00.000Z',
5
+ type: 'string',
6
+ format: 'date-time'
7
+ },
8
+ end: {
9
+ description: 'The end date to filter entities by "updated_at" field value',
10
+ example: '2022-02-28T23:59:59.999Z',
11
+ type: 'string',
12
+ format: 'date-time'
13
+ },
14
+ limit: {
15
+ description: 'The maximum amount of entries on page (for paginated output)',
16
+ example: 50,
17
+ type: 'integer',
18
+ minimum: 1
19
+ },
20
+ active: {
21
+ description: 'Filter entities by "active" field value',
22
+ example: 'true',
23
+ type: 'string',
24
+ enum: ['true', 'false']
25
+ },
26
+ deleted: {
27
+ description: 'Filter entities which are deleted or not',
28
+ example: 'true',
29
+ type: 'string',
30
+ enum: ['true', 'false']
31
+ }
32
+ }
33
+
34
+ /**
35
+ * Generate a common query for entities set
36
+ * @param {Object} required Required fields to restrict the amount of entries
37
+ */
38
+ function getQuery ({
39
+ standard = ['start', 'end'],
40
+ required = ['start', 'end'],
41
+ additional = {}
42
+ } = {}) {
43
+ const properties = standard.reduce((memo, paramName) => {
44
+ if (!standardParams[paramName]) {
45
+ throw new ReferenceError(`Parameter '${paramName}' is not standard`)
46
+ }
47
+
48
+ memo[paramName] = { ...standardParams[paramName] }
49
+
50
+ return memo
51
+ }, {})
52
+
53
+ Object.assign(properties, additional)
54
+
55
+ return {
56
+ $schema: 'http://json-schema.org/draft-07/schema#',
57
+ additionalProperties: false,
58
+ type: 'object',
59
+ required,
60
+ properties
61
+ }
62
+ }
63
+
64
+ module.exports = getQuery
@@ -1,7 +1,8 @@
1
1
  const cursor = {
2
2
  type: 'object',
3
+ description: 'Optional cursor in paginated API calls. The cursor next field must be called as fully quantifiable URI in order to hit the next if available.',
3
4
  additionalProperties: false,
4
- description: 'Optional cursor in pagable API calls. The cursor next field must be called as fully qualifyable URI in order to hit the next page',
5
+ required: ['self'],
5
6
  properties: {
6
7
  next: {
7
8
  type: 'string',
@@ -47,14 +48,14 @@ function commonResponse ({ resultItems, results, additionals } = {}, { hasCursor
47
48
  msg: {
48
49
  type: 'string',
49
50
  minLength: 1,
50
- example: 'Queried transactions sucessefully.',
51
- description: 'Any English sentence, meant as information for developers and implementers. Avoid displaying this to the users and especially do not expect thos messages to stay stable.'
51
+ example: 'Queried transactions successfully.',
52
+ description: 'Any English sentence, meant as information for developers and implementers. Avoid displaying this to the users and especially do not expect those messages to stay stable.'
52
53
  },
53
54
  msg_localised: {
55
+ description: 'Optional localized message that can be displayed to the user if existing. The language can be set by in the request or will fallback to English.',
56
+ example: 'Abgefragte Transaktionen erfolgreich.',
54
57
  type: 'string',
55
- minLength: 1,
56
- example: 'Queried transactions sucessefully.',
57
- description: 'Optional localised message that can be displayed to the user if existing. The language can be set by in the request or will fallback to English.'
58
+ minLength: 1
58
59
  },
59
60
  request: {
60
61
  type: 'object',
@@ -84,7 +85,7 @@ function commonResponse ({ resultItems, results, additionals } = {}, { hasCursor
84
85
  }
85
86
  }
86
87
 
87
- if (hasCursor) response.cursor = cursor
88
+ if (hasCursor) response.properties.cursor = cursor
88
89
 
89
90
  return response
90
91
  }
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ logs: require('./logs')
3
+ }
@@ -0,0 +1,81 @@
1
+ const { oneOf } = require('../../../helpers/payload-or-null')
2
+
3
+ const changeEntry = {
4
+ type: 'object',
5
+ additionalProperties: false,
6
+ properties: {
7
+ op: {
8
+ description: 'Operation type',
9
+ type: 'string',
10
+ enum: [
11
+ 'add',
12
+ 'replace',
13
+ 'remove'
14
+ ]
15
+ },
16
+ path: {
17
+ description: 'Changed property path (with dot as separator)',
18
+ type: 'string',
19
+ example: 'images.0.url'
20
+ },
21
+ value: {
22
+ description: 'Changed value',
23
+ type: 'string',
24
+ example: 'This is it'
25
+ }
26
+ }
27
+ }
28
+
29
+ module.exports = {
30
+ type: {
31
+ description: 'Log type (entity type and action type)',
32
+ type: 'string',
33
+ example: 'product.update'
34
+ },
35
+ old: oneOf({
36
+ description: 'Old data',
37
+ type: 'object',
38
+ example: {}
39
+ }),
40
+ new: oneOf({
41
+ description: 'New data',
42
+ type: 'object',
43
+ example: {
44
+ id: '0f91b67b-b1eb-4aba-827a-3a83ff967c5e',
45
+ name: 'Foo bar'
46
+ }
47
+ }),
48
+ change: oneOf({
49
+ description: 'Changes between old and new',
50
+ type: 'array',
51
+ items: changeEntry
52
+ }),
53
+ description: oneOf({
54
+ description: 'Description',
55
+ type: 'string',
56
+ example: 'Login attempt from service account'
57
+ }),
58
+ issuer: oneOf({
59
+ description: 'Issuer data',
60
+ type: 'object',
61
+ properties: {
62
+ sub_user: {
63
+ description: 'Sub-user (person authorized under organization account) UUID',
64
+ type: 'string',
65
+ format: 'uuid',
66
+ example: '8ddb94bf-98cf-4832-9833-c118ebf04675'
67
+ }
68
+ }
69
+ }),
70
+ metadata: oneOf({
71
+ description: 'Metadata',
72
+ type: 'object',
73
+ properties: {
74
+ user_agent: {
75
+ description: 'User-agent data',
76
+ type: 'string',
77
+ example: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36'
78
+ }
79
+ }
80
+ })
81
+ }
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ read: require('./read')
3
+ }
@@ -0,0 +1,30 @@
1
+ const commonBase = { ...require('../../../common/base') }
2
+ const commonResponse = require('../../../common/response')
3
+ const { oneOf } = require('../../../helpers/payload-or-null')
4
+
5
+ const base = require('./base')
6
+
7
+ // Logs are read-only
8
+ delete commonBase.updated_at
9
+
10
+ module.exports.response = {
11
+ $id: 'https://schemas.tillhub.com/v0/audits.logs.read.response.schema.json',
12
+ $schema: 'http://json-schema.org/draft-07/schema#',
13
+ additionalProperties: false,
14
+ ...commonResponse({
15
+ resultItems: {
16
+ type: 'object',
17
+ required: ['id', 'created_at', 'insert_id', 'type'],
18
+ additionalProperties: false,
19
+ properties: {
20
+ ...commonBase,
21
+ insert_id: oneOf({
22
+ description: 'Sequential counter',
23
+ type: 'integer',
24
+ example: 16259
25
+ }),
26
+ ...base
27
+ }
28
+ }
29
+ }, { hasCursor: true })
30
+ }
@@ -1,9 +1,11 @@
1
- const customProperties = require('../../common/custom_properties')
2
1
  const { stripIndents } = require('common-tags')
2
+ const customProperties = require('../../common/custom_properties')
3
+ const { getImages } = require('../../common/images')
3
4
 
4
5
  module.exports = {
5
6
  name: {
6
- description: 'any arbitrary name for a branch that can be displayed in applications.',
7
+ description: 'Any arbitrary name for a branch that can be displayed in applications.',
8
+ example: 'Head office',
7
9
  anyOf: [
8
10
  {
9
11
  type: 'string',
@@ -16,17 +18,19 @@ module.exports = {
16
18
  ]
17
19
  },
18
20
  phonenumbers: {
19
- description: 'A number of valid types of phonenumbers for a branch.',
21
+ description: 'A number of valid types of phone numbers for a branch.',
20
22
  anyOf: [
21
23
  {
22
24
  type: 'object',
23
25
  additionalProperties: false,
24
26
  properties: {
25
27
  line_main: {
26
- type: 'string'
28
+ type: 'string',
29
+ example: '+49-555-1976'
27
30
  },
28
31
  line_1: {
29
- type: 'string'
32
+ type: 'string',
33
+ example: '+49-555-1977'
30
34
  },
31
35
  line_2: {
32
36
  type: 'string'
@@ -57,6 +61,7 @@ module.exports = {
57
61
  },
58
62
  email: {
59
63
  description: 'The main contact email for a branch.',
64
+ example: 'office@my-incredible-company.to',
60
65
  anyOf: [
61
66
  {
62
67
  type: 'string',
@@ -70,6 +75,7 @@ module.exports = {
70
75
  },
71
76
  receipt_header: {
72
77
  description: 'An arbitrary string that will be printed on every receipt as the header.',
78
+ example: 'Perfect socks LTD',
73
79
  anyOf: [
74
80
  {
75
81
  type: 'string',
@@ -82,6 +88,7 @@ module.exports = {
82
88
  },
83
89
  receipt_footer: {
84
90
  description: 'An arbitrary string that will be printed on every receipt as the footer',
91
+ example: 'Thank you!',
85
92
  anyOf: [
86
93
  {
87
94
  type: 'string',
@@ -117,40 +124,7 @@ module.exports = {
117
124
  }
118
125
  ]
119
126
  },
120
- images: {
121
- description: 'A Tillhub image object with URLs to display images this for this branch.',
122
- anyOf: [
123
- {
124
- type: 'object',
125
- additionalProperties: true,
126
- properties: {
127
- '1x': {
128
- type: 'string',
129
- format: 'uri'
130
- },
131
- '2x': {
132
- type: 'string',
133
- format: 'uri'
134
- },
135
- '3x': {
136
- type: 'string',
137
- format: 'uri'
138
- },
139
- avatar: {
140
- type: 'string',
141
- format: 'uri'
142
- },
143
- original: {
144
- type: 'string',
145
- format: 'uri'
146
- }
147
- }
148
- },
149
- {
150
- type: 'null'
151
- }
152
- ]
153
- },
127
+ images: getImages(),
154
128
  image: {
155
129
  description: 'DEPRECATED. Omit or set null.',
156
130
  anyOf: [
@@ -170,11 +144,13 @@ module.exports = {
170
144
  },
171
145
  active: {
172
146
  description: 'Soft disable or enabled this branch.',
147
+ example: 'true',
173
148
  type: 'boolean',
174
149
  default: true
175
150
  },
176
151
  deleted: {
177
152
  description: 'Soft delete this branch.',
153
+ example: 'false',
178
154
  type: 'boolean',
179
155
  default: false
180
156
  },
@@ -186,10 +162,22 @@ module.exports = {
186
162
  branch_number: {
187
163
  type: 'number',
188
164
  description: 'The maximum stems from the fact that is it stored as an postgres int4 type, with 4 bytes of space',
165
+ example: 107,
189
166
  minimum: 0,
190
167
  maximum: 2147483647
191
168
  },
169
+ custom_id: {
170
+ description: 'Branch custom unique ID.',
171
+ example: 'dd3234of',
172
+ anyOf: [{
173
+ type: 'string'
174
+ }, {
175
+ type: 'null'
176
+ }]
177
+ },
192
178
  external_custom_id: {
179
+ description: 'Unique ID of this branch in external system. Uses for synchronization.',
180
+ example: '7882448928329',
193
181
  anyOf: [
194
182
  {
195
183
  type: 'string',
@@ -202,6 +190,8 @@ module.exports = {
202
190
  ]
203
191
  },
204
192
  cost_center: {
193
+ description: 'Cost center unique ID',
194
+ example: '7882448928329',
205
195
  anyOf: [
206
196
  {
207
197
  type: 'string',
@@ -242,6 +232,7 @@ module.exports = {
242
232
  },
243
233
  street: {
244
234
  description: 'A street name',
235
+ example: 'Downing Street',
245
236
  oneOf: [
246
237
  {
247
238
  type: 'string',
@@ -254,6 +245,7 @@ module.exports = {
254
245
  },
255
246
  street_number: {
256
247
  description: 'A street number',
248
+ example: '10',
257
249
  oneOf: [
258
250
  {
259
251
  type: 'string',
@@ -266,6 +258,7 @@ module.exports = {
266
258
  },
267
259
  locality: {
268
260
  description: 'The international format for a city, village and any other localizable city like place.',
261
+ example: 'London',
269
262
  oneOf: [
270
263
  {
271
264
  type: 'string'
@@ -277,6 +270,7 @@ module.exports = {
277
270
  },
278
271
  region: {
279
272
  description: 'The international format for regional sub category of a country e.g. a state or province.',
273
+ example: 'Greater London',
280
274
  oneOf: [
281
275
  {
282
276
  type: 'string'
@@ -288,6 +282,7 @@ module.exports = {
288
282
  },
289
283
  postal_code: {
290
284
  description: 'A non-validated postal code.',
285
+ example: 'SW1A',
291
286
  oneOf: [
292
287
  {
293
288
  type: 'string',
@@ -300,6 +295,7 @@ module.exports = {
300
295
  },
301
296
  country: {
302
297
  description: 'A country as ISO Alpha-2 code.',
298
+ example: 'UK',
303
299
  oneOf: [
304
300
  {
305
301
  type: 'string',
@@ -366,42 +362,37 @@ module.exports = {
366
362
  },
367
363
  configuration: {
368
364
  description: 'Deprecated: Overwriting a fa_account_number on cash payments for DATEV export.',
369
- anyOf: [
370
- {
371
- type: 'string'
372
- },
373
- {
374
- type: 'null'
375
- }
376
- ]
365
+ anyOf: [{
366
+ type: 'string'
367
+ }, {
368
+ type: 'null'
369
+ }]
377
370
  },
378
371
  timezone_default: {
379
372
  description: 'An IANA timezone that will be used to display local timezones in documents and UI. Validation for the timezone will happen in memory of the server, but not on that schema.',
380
- anyOf: [
381
- {
382
- type: 'string'
383
- },
384
- {
385
- type: 'null'
386
- }
387
- ]
373
+ example: 'Europe/London',
374
+ anyOf: [{
375
+ type: 'string'
376
+ }, {
377
+ type: 'null'
378
+ }]
388
379
  },
389
380
  currency_default: {
390
381
  description: 'The three letter [ISO currency](https://en.wikipedia.org/wiki/ISO_4217) of this branch.',
391
- anyOf: [
392
- {
393
- type: 'string'
394
- },
395
- {
396
- type: 'null'
397
- }
398
- ]
382
+ example: 'GBP',
383
+ anyOf: [{
384
+ type: 'string'
385
+ }, {
386
+ type: 'null'
387
+ }]
399
388
  },
400
389
  custom_properties: {
390
+ description: 'User-defined branch properties',
401
391
  ...customProperties.implementation
402
392
  },
403
393
  default_favourite: {
404
394
  description: 'Define which favourite set to show as default in the POS if none is defined on the register.',
395
+ example: '20e89159-28d9-46f2-bda3-d74bb70834e7',
405
396
  anyOf: [
406
397
  {
407
398
  type: 'string',
@@ -414,6 +405,7 @@ module.exports = {
414
405
  },
415
406
  default_category_tree: {
416
407
  description: 'Define which category tree to use as default in the POS if none is defined on the register.',
408
+ example: 'c45764ed-fc6d-4b32-b406-59a5e84d2999',
417
409
  anyOf: [
418
410
  {
419
411
  type: 'string',
@@ -1,3 +1,5 @@
1
+ const baseObject = require('../../common/base')
2
+ const commonResponse = require('../../common/response')
1
3
  const base = require('./base')
2
4
 
3
5
  module.exports.request = {
@@ -10,3 +12,19 @@ module.exports.request = {
10
12
  properties: base,
11
13
  type: 'object'
12
14
  }
15
+
16
+ module.exports.response = {
17
+ $id: 'https://schemas.tillhub.com/v0/branches.create.response.schema.json',
18
+ $schema: 'http://json-schema.org/draft-07/schema#',
19
+ additionalProperties: false,
20
+ ...commonResponse({
21
+ resultItems: {
22
+ type: 'object',
23
+ additionalProperties: false,
24
+ properties: {
25
+ ...baseObject(),
26
+ ...base
27
+ }
28
+ }
29
+ })
30
+ }
@@ -1,2 +1,3 @@
1
1
  module.exports.create = require('./create')
2
+ module.exports.read = require('./read')
2
3
  module.exports.update = require('./update')
@@ -0,0 +1,123 @@
1
+ const baseObject = require('../../common/base')
2
+ const commonResponse = require('../../common/response')
3
+ const commonQuery = require('../../common/query')
4
+ const base = require('./base')
5
+
6
+ const extended = {
7
+ insert_id: {
8
+ description: 'Sequential branch index',
9
+ type: 'integer'
10
+ },
11
+ fa_account_number: {
12
+ description: 'Account number',
13
+ anyOf: [{
14
+ type: 'string'
15
+ }, {
16
+ type: 'null'
17
+ }]
18
+ },
19
+ configurations: {
20
+ description: 'Configurations set',
21
+ anyOf: [{
22
+ type: 'object'
23
+ }, {
24
+ type: 'null'
25
+ }]
26
+ },
27
+ merged_configurations: {
28
+ description: 'Merged configuration of branch and account',
29
+ anyOf: [{
30
+ type: 'object'
31
+ }, {
32
+ type: 'null'
33
+ }]
34
+ }
35
+ }
36
+
37
+ module.exports.all = {
38
+ query: {
39
+ $id: 'https://schemas.tillhub.com/v0/branches.read.all.query.schema.json',
40
+ ...commonQuery({
41
+ standard: ['start', 'end', 'active', 'deleted'],
42
+ additional: {
43
+ name: {
44
+ description: 'Filter branches by name substring',
45
+ example: 'Head office',
46
+ type: 'string'
47
+ },
48
+ branch_group: {
49
+ description: 'Filter branches by branch group ID',
50
+ example: 'Head office',
51
+ type: 'string',
52
+ format: 'uuid'
53
+ },
54
+ branch_number: {
55
+ description: 'Filter branches by number',
56
+ example: 239,
57
+ type: 'integer'
58
+ },
59
+ postal_code: {
60
+ description: 'Filter branches by postal code',
61
+ example: '10785',
62
+ type: 'string'
63
+ },
64
+ street: {
65
+ description: 'Filter branches by street name',
66
+ example: 'Genthiner Str. 34',
67
+ type: 'string'
68
+ },
69
+ city: {
70
+ description: 'Filter branches by city name',
71
+ example: 'Berlin',
72
+ type: 'string'
73
+ },
74
+ q: {
75
+ description: 'Search branches by several fields which match given string',
76
+ example: 'head',
77
+ type: 'string'
78
+ },
79
+ total: {
80
+ description: 'Return the total count of branches (in meta data call)',
81
+ example: 'true',
82
+ type: 'string',
83
+ enum: ['true', 'false']
84
+ }
85
+ }
86
+ })
87
+ },
88
+ response: {
89
+ $id: 'https://schemas.tillhub.com/v0/branches.read.all.response.schema.json',
90
+ $schema: 'http://json-schema.org/draft-07/schema#',
91
+ additionalProperties: false,
92
+ ...commonResponse({
93
+ resultItems: {
94
+ type: 'object',
95
+ additionalProperties: false,
96
+ properties: {
97
+ ...baseObject(),
98
+ ...base,
99
+ ...extended
100
+ }
101
+ }
102
+ })
103
+ }
104
+ }
105
+
106
+ module.exports.one = {
107
+ response: {
108
+ $id: 'https://schemas.tillhub.com/v0/branches.read.one.response.schema.json',
109
+ $schema: 'http://json-schema.org/draft-07/schema#',
110
+ additionalProperties: false,
111
+ ...commonResponse({
112
+ resultItems: {
113
+ type: 'object',
114
+ additionalProperties: false,
115
+ properties: {
116
+ ...baseObject(),
117
+ ...base,
118
+ ...extended
119
+ }
120
+ }
121
+ })
122
+ }
123
+ }
@@ -1,3 +1,5 @@
1
+ const baseObject = require('../../common/base')
2
+ const commonResponse = require('../../common/response')
1
3
  const base = require('./base')
2
4
 
3
5
  module.exports.request = {
@@ -8,3 +10,19 @@ module.exports.request = {
8
10
  required: [],
9
11
  properties: base
10
12
  }
13
+
14
+ module.exports.response = {
15
+ $id: 'https://schemas.tillhub.com/v0/branches.update.response.schema.json',
16
+ $schema: 'http://json-schema.org/draft-07/schema#',
17
+ additionalProperties: false,
18
+ ...commonResponse({
19
+ resultItems: {
20
+ type: 'object',
21
+ additionalProperties: false,
22
+ properties: {
23
+ ...baseObject(),
24
+ ...base
25
+ }
26
+ }
27
+ })
28
+ }
@@ -10,7 +10,7 @@ module.exports.children = {
10
10
  format: 'uuid'
11
11
  },
12
12
  children: {
13
- type: 'object'
13
+ type: 'array'
14
14
  }
15
15
  }
16
16
  }
package/lib/v0/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ module.exports.audits = require('./audits')
1
2
  module.exports.products = require('./products')
2
3
  module.exports.product_groups = require('./product_groups')
3
4
  module.exports.product_templates = require('./product_templates')
@@ -0,0 +1 @@
1
+ module.exports.read = require('./read')
@@ -0,0 +1,16 @@
1
+ const commonResponse = require('../../common/response')
2
+ const { all } = require('../../v0/branches/read')
3
+
4
+ module.exports.all = {
5
+ query: {
6
+ ...all.query,
7
+ $id: 'https://schemas.tillhub.com/v1/branches.read.all.query.schema.json'
8
+ },
9
+ response: {
10
+ ...all.response,
11
+ $id: 'https://schemas.tillhub.com/v1/branches.read.all.response.schema.json',
12
+ ...commonResponse({
13
+ resultItems: all.response.properties.results.items
14
+ }, { hasCursor: true })
15
+ }
16
+ }
@@ -119,6 +119,18 @@ module.exports = oneOf({
119
119
  example: 'Regiondo',
120
120
  minLength: 2,
121
121
  maxLength: 24
122
+ },
123
+ log_level: {
124
+ description: 'defines the granularity of the web api logging.',
125
+ type: 'string',
126
+ enum: [
127
+ 'error',
128
+ 'warning',
129
+ 'info',
130
+ 'debug',
131
+ 'verbose' // request/response bodies
132
+ ],
133
+ default: 'info'
122
134
  }
123
135
  }
124
136
  })
@@ -46,6 +46,18 @@ module.exports = {
46
46
  minimum: 0,
47
47
  maximum: 3600,
48
48
  default: 25
49
+ },
50
+ log_level: {
51
+ description: 'defines the granularity of the local server logging.',
52
+ type: 'string',
53
+ enum: [
54
+ 'error',
55
+ 'warning',
56
+ 'info', // basic server info
57
+ 'debug', // basic request/response info
58
+ 'verbose' // request/response bodies
59
+ ],
60
+ default: 'info'
49
61
  }
50
62
  }
51
63
  }),
package/lib/v1/index.js CHANGED
@@ -1,12 +1,13 @@
1
+ module.exports.balances = require('./balances')
2
+ module.exports.branches = require('./branches')
1
3
  module.exports.carts = require('./carts')
4
+ module.exports.configurations = require('./configurations')
5
+ module.exports.delivery_notes = require('./delivery_notes')
6
+ module.exports.discounts = require('./discounts')
7
+ module.exports.gastro_orders = require('./gastro_orders')
2
8
  module.exports.products = require('./products')
3
9
  module.exports.registers = require('./registers')
4
- module.exports.delivery_notes = require('./delivery_notes')
5
- module.exports.configurations = require('./configurations')
6
10
  module.exports.templates = require('./templates')
7
11
  module.exports.transactions = require('./transactions')
8
- module.exports.balances = require('./balances')
9
- module.exports.discounts = require('./discounts')
10
- module.exports.gastro_orders = require('./gastro_orders')
11
12
 
12
13
  // hygen:injection - Please, don't delete this line: when running the cli for schema resources the new routes will be automatically added here.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tillhub/schemas",
3
- "version": "6.117.1",
3
+ "version": "6.120.0",
4
4
  "private": false,
5
5
  "description": "All Tillhub API OpenAPI 3 compatible JSON Schemas.",
6
6
  "main": "./lib/index.js",
@@ -0,0 +1,11 @@
1
+ const test = require('tape')
2
+ const validate = require('../../helpers/validate-schema')
3
+
4
+ test('Audits:logs: read.response schema validation', function (t) {
5
+ t.plan(2)
6
+ const readResponse = require('../../../lib/v0/audits/logs').read.response
7
+ const { valid, error } = validate(readResponse)
8
+ t.ok(valid, 'create schema is valid')
9
+ t.error(error, 'should not get any error')
10
+ t.end()
11
+ })
@@ -1,20 +1,59 @@
1
1
  const test = require('tape')
2
2
  const validate = require('../helpers/validate-schema')
3
+ const branchesSchema = require('../../lib/v0/branches')
4
+
5
+ test('Branches:v0: create schema validation', function (t) {
6
+ {
7
+ const { valid, error } = validate(branchesSchema.create.request)
8
+ t.ok(valid, 'create request schema is valid')
9
+ t.error(error, 'should not get any error')
10
+ }
11
+
12
+ {
13
+ const { valid, error } = validate(branchesSchema.create.response)
14
+ t.ok(valid, 'create response schema is valid')
15
+ t.error(error, 'should not get any error')
16
+ }
17
+
18
+ t.end()
19
+ })
20
+
21
+ test('Branches:v0: read.all schema validation', function (t) {
22
+ {
23
+ const { valid, error } = validate(branchesSchema.read.all.query)
24
+ t.ok(valid, 'read query schema is valid')
25
+ t.error(error, 'should not get any error')
26
+ }
27
+
28
+ {
29
+ const { valid, error } = validate(branchesSchema.read.all.response)
30
+ t.ok(valid, 'read response schema is valid')
31
+ t.error(error, 'should not get any error')
32
+ }
3
33
 
4
- test('Branches: create schema validation', function (t) {
5
- t.plan(2)
6
- const createRequest = require('../../lib/v0/branches').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
34
  t.end()
11
35
  })
12
36
 
13
- test('Branches: update schema validation', function (t) {
14
- t.plan(2)
15
- const updateRequest = require('../../lib/v0/branches').update.request
16
- const { valid, error } = validate(updateRequest)
17
- t.ok(valid, 'update schema is valid')
37
+ test('Branches:v0: read.one schema validation', function (t) {
38
+ const { valid, error } = validate(branchesSchema.read.one.response)
39
+ t.ok(valid, 'read query schema is valid')
18
40
  t.error(error, 'should not get any error')
41
+
42
+ t.end()
43
+ })
44
+
45
+ test('Branches:v0: update schema validation', function (t) {
46
+ {
47
+ const { valid, error } = validate(branchesSchema.update.request)
48
+ t.ok(valid, 'update request schema is valid')
49
+ t.error(error, 'should not get any error')
50
+ }
51
+
52
+ {
53
+ const { valid, error } = validate(branchesSchema.update.response)
54
+ t.ok(valid, 'update response schema is valid')
55
+ t.error(error, 'should not get any error')
56
+ }
57
+
19
58
  t.end()
20
59
  })
@@ -0,0 +1,19 @@
1
+ const test = require('tape')
2
+ const validate = require('../helpers/validate-schema')
3
+ const branchesSchema = require('../../lib/v1/branches')
4
+
5
+ test('Branches:v1: read.all schema validation', function (t) {
6
+ {
7
+ const { valid, error } = validate(branchesSchema.read.all.query)
8
+ t.ok(valid, 'read query schema is valid')
9
+ t.error(error, 'should not get any error')
10
+ }
11
+
12
+ {
13
+ const { valid, error } = validate(branchesSchema.read.all.response)
14
+ t.ok(valid, 'read response schema is valid')
15
+ t.error(error, 'should not get any error')
16
+ }
17
+
18
+ t.end()
19
+ })