@tillhub/schemas 6.118.0 → 6.121.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.
Files changed (42) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/lib/common/address.js +67 -82
  3. package/lib/common/base.js +3 -0
  4. package/lib/common/images.js +63 -0
  5. package/lib/common/query.js +64 -0
  6. package/lib/common/response.js +11 -10
  7. package/lib/v0/audits/index.js +3 -0
  8. package/lib/v0/audits/logs/base.js +81 -0
  9. package/lib/v0/audits/logs/index.js +3 -0
  10. package/lib/v0/audits/logs/read.js +30 -0
  11. package/lib/v0/branches/base.js +55 -63
  12. package/lib/v0/branches/create.js +18 -0
  13. package/lib/v0/branches/index.js +1 -0
  14. package/lib/v0/branches/read.js +119 -0
  15. package/lib/v0/branches/update.js +18 -0
  16. package/lib/v0/category_trees/definitions.js +1 -1
  17. package/lib/v0/customers/base.js +352 -576
  18. package/lib/v0/customers/baseExt.js +35 -0
  19. package/lib/v0/customers/create.js +41 -0
  20. package/lib/v0/customers/ext.js +113 -7
  21. package/lib/v0/customers/index.js +18 -50
  22. package/lib/v0/customers/properties/anaylytics.js +7 -7
  23. package/lib/v0/customers/read.js +42 -0
  24. package/lib/v0/customers/update.js +30 -0
  25. package/lib/v0/deliveries/base.js +3 -3
  26. package/lib/v0/index.js +1 -0
  27. package/lib/v0/orders/create.request.js +3 -3
  28. package/lib/v0/pdfs/templates.deliveries.create.request.js +3 -7
  29. package/lib/v0/pdfs/templates.delivery_notes.create.request.js +3 -7
  30. package/lib/v0/pdfs/templates.full_receipts.create.request.js +3 -7
  31. package/lib/v0/pdfs/templates.invoices.create.request.js +3 -7
  32. package/lib/v0/pdfs/templates.transaction_receipts.create.request.js +3 -7
  33. package/lib/v1/branches/index.js +1 -0
  34. package/lib/v1/branches/read.js +16 -0
  35. package/lib/v1/index.js +6 -5
  36. package/package.json +1 -1
  37. package/test/audits/logs/logs.spec.js +11 -0
  38. package/test/branches/branches.v0.spec.js +50 -11
  39. package/test/branches/branches.v1.spec.js +19 -0
  40. package/test/customers/customers.v0.spec.js +93 -5
  41. package/lib/v0/customers/create.request.js +0 -24
  42. package/lib/v0/customers/update.request.js +0 -14
@@ -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,119 @@
1
+ const baseObject = require('../../common/base')
2
+ const commonResponse = require('../../common/response')
3
+ const commonQuery = require('../../common/query')
4
+ const { oneOf } = require('../../helpers/payload-or-null')
5
+
6
+ const base = require('./base')
7
+
8
+ const extended = {
9
+ insert_id: {
10
+ description: 'Sequential branch index',
11
+ type: 'integer'
12
+ },
13
+ fa_account_number: {
14
+ description: 'Account number',
15
+ ...oneOf({
16
+ type: 'string'
17
+ })
18
+ },
19
+ configurations: {
20
+ description: 'Configurations set',
21
+ ...oneOf({
22
+ type: 'object'
23
+ })
24
+ },
25
+ merged_configurations: {
26
+ description: 'Merged configuration of branch and account',
27
+ ...oneOf({
28
+ type: 'object'
29
+ })
30
+ }
31
+ }
32
+
33
+ module.exports.all = {
34
+ query: {
35
+ $id: 'https://schemas.tillhub.com/v0/branches.read.all.query.schema.json',
36
+ ...commonQuery({
37
+ standard: ['start', 'end', 'active', 'deleted'],
38
+ additional: {
39
+ name: {
40
+ description: 'Filter branches by name substring',
41
+ example: 'Head office',
42
+ type: 'string'
43
+ },
44
+ branch_group: {
45
+ description: 'Filter branches by branch group ID',
46
+ example: 'Head office',
47
+ type: 'string',
48
+ format: 'uuid'
49
+ },
50
+ branch_number: {
51
+ description: 'Filter branches by number',
52
+ example: 239,
53
+ type: 'integer'
54
+ },
55
+ postal_code: {
56
+ description: 'Filter branches by postal code',
57
+ example: '10785',
58
+ type: 'string'
59
+ },
60
+ street: {
61
+ description: 'Filter branches by street name',
62
+ example: 'Genthiner Str. 34',
63
+ type: 'string'
64
+ },
65
+ city: {
66
+ description: 'Filter branches by city name',
67
+ example: 'Berlin',
68
+ type: 'string'
69
+ },
70
+ q: {
71
+ description: 'Search branches by several fields which match given string',
72
+ example: 'head',
73
+ type: 'string'
74
+ },
75
+ total: {
76
+ description: 'Return the total count of branches (in meta data call)',
77
+ example: 'true',
78
+ type: 'string',
79
+ enum: ['true', 'false']
80
+ }
81
+ }
82
+ })
83
+ },
84
+ response: {
85
+ $id: 'https://schemas.tillhub.com/v0/branches.read.all.response.schema.json',
86
+ $schema: 'http://json-schema.org/draft-07/schema#',
87
+ additionalProperties: false,
88
+ ...commonResponse({
89
+ resultItems: {
90
+ type: 'object',
91
+ additionalProperties: false,
92
+ properties: {
93
+ ...baseObject(),
94
+ ...base,
95
+ ...extended
96
+ }
97
+ }
98
+ })
99
+ }
100
+ }
101
+
102
+ module.exports.one = {
103
+ response: {
104
+ $id: 'https://schemas.tillhub.com/v0/branches.read.one.response.schema.json',
105
+ $schema: 'http://json-schema.org/draft-07/schema#',
106
+ additionalProperties: false,
107
+ ...commonResponse({
108
+ resultItems: {
109
+ type: 'object',
110
+ additionalProperties: false,
111
+ properties: {
112
+ ...baseObject(),
113
+ ...base,
114
+ ...extended
115
+ }
116
+ }
117
+ })
118
+ }
119
+ }
@@ -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
  }