@tillhub/schemas 6.217.0 → 6.219.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,20 @@
1
+ # [6.219.0](https://github.com/tillhub/schemas/compare/v6.218.0...v6.219.0) (2023-06-13)
2
+
3
+
4
+ ### Features
5
+
6
+ * **purchase-orders:** Purchase order pdf generation schema ([#807](https://github.com/tillhub/schemas/issues/807)) ([0728f56](https://github.com/tillhub/schemas/commit/0728f56))
7
+
8
+ # [6.218.0](https://github.com/tillhub/schemas/compare/v6.217.0...v6.218.0) (2023-06-13)
9
+
10
+
11
+ ### Features
12
+
13
+ * **search:** added stock adjustment view search configuration ([ba42a12](https://github.com/tillhub/schemas/commit/ba42a12))
14
+ * **UNTIL-6873_pricelist:** add location-based to type_precedence.default ([1f37a81](https://github.com/tillhub/schemas/commit/1f37a81))
15
+ * **UNTIL-6873_pricelist:** add location-based type ([25f6029](https://github.com/tillhub/schemas/commit/25f6029))
16
+ * **UNTIL-6873_pricelist:** add location-based type_precedence ([77c05d4](https://github.com/tillhub/schemas/commit/77c05d4))
17
+
1
18
  # [6.217.0](https://github.com/tillhub/schemas/compare/v6.216.0...v6.217.0) (2023-05-25)
2
19
 
3
20
 
@@ -10,6 +10,11 @@ module.exports = {
10
10
  request: require('./templates.invoices.create.request')
11
11
  }
12
12
  },
13
+ purchase_orders: {
14
+ create: {
15
+ request: require('./templates.purchase_orders.create.request')
16
+ }
17
+ },
13
18
  full_receipts: {
14
19
  create: {
15
20
  request: require('./templates.full_receipts.create.request')
@@ -0,0 +1,455 @@
1
+ module.exports = {
2
+ $id: 'https://schemas.tillhub.com/v0/pdfs.templates.purchase-orders.create.schema.json',
3
+ $schema: 'http://json-schema.org/draft-07/schema#',
4
+ additionalProperties: false,
5
+ type: 'object',
6
+ properties: {
7
+ order: {
8
+ type: 'object',
9
+ properties: {
10
+ id: {
11
+ type: 'string'
12
+ },
13
+ createdAt: {
14
+ type: 'string'
15
+ },
16
+ updatedAt: {
17
+ type: 'string'
18
+ },
19
+ purchaseOrderNumber: {
20
+ type: 'string'
21
+ },
22
+ notes: {
23
+ type: 'string'
24
+ },
25
+ status: {
26
+ type: 'string'
27
+ },
28
+ totalAmount: {
29
+ type: 'integer'
30
+ },
31
+ recipients: {
32
+ type: 'array',
33
+ items: [
34
+ {
35
+ type: 'string'
36
+ },
37
+ {
38
+ type: 'string'
39
+ }
40
+ ]
41
+ },
42
+ createdBy: {
43
+ type: 'string'
44
+ },
45
+ creatorFullName: {
46
+ type: 'string'
47
+ },
48
+ sentAt: {
49
+ anyOf: [
50
+ {
51
+ type: 'string'
52
+ },
53
+ {
54
+ type: 'null'
55
+ }
56
+ ]
57
+ },
58
+ pdfUrl: {
59
+ anyOf: [
60
+ {
61
+ type: 'string'
62
+ },
63
+ {
64
+ type: 'null'
65
+ }
66
+ ]
67
+ },
68
+ businessPartner: {
69
+ type: 'object',
70
+ properties: {
71
+ id: {
72
+ type: 'string'
73
+ },
74
+ companyName: {
75
+ type: 'string'
76
+ }
77
+ },
78
+ required: [
79
+ 'id',
80
+ 'companyName'
81
+ ]
82
+ },
83
+ products: {
84
+ type: 'array',
85
+ items: [
86
+ {
87
+ type: 'object',
88
+ properties: {
89
+ id: {
90
+ type: 'string'
91
+ },
92
+ createdAt: {
93
+ type: 'string'
94
+ },
95
+ updatedAt: {
96
+ type: 'string'
97
+ },
98
+ productId: {
99
+ type: 'string'
100
+ },
101
+ productName: {
102
+ type: 'string'
103
+ },
104
+ price: {
105
+ type: 'integer'
106
+ },
107
+ vatPercent: {
108
+ type: 'number'
109
+ },
110
+ discountPercent: {
111
+ type: 'integer'
112
+ },
113
+ quantity: {
114
+ type: 'integer'
115
+ },
116
+ totalUntaxed: {
117
+ type: 'number'
118
+ },
119
+ totalWithTax: {
120
+ type: 'integer'
121
+ }
122
+ },
123
+ required: [
124
+ 'id',
125
+ 'productId',
126
+ 'productName',
127
+ 'price',
128
+ 'vatPercent',
129
+ 'discountPercent',
130
+ 'quantity',
131
+ 'totalUntaxed',
132
+ 'totalWithTax'
133
+ ]
134
+ },
135
+ {
136
+ type: 'object',
137
+ properties: {
138
+ id: {
139
+ type: 'string'
140
+ },
141
+ createdAt: {
142
+ type: 'string'
143
+ },
144
+ updatedAt: {
145
+ type: 'string'
146
+ },
147
+ productId: {
148
+ type: 'string'
149
+ },
150
+ productName: {
151
+ type: 'string'
152
+ },
153
+ price: {
154
+ type: 'integer'
155
+ },
156
+ vatPercent: {
157
+ type: 'number'
158
+ },
159
+ discountPercent: {
160
+ type: 'number'
161
+ },
162
+ quantity: {
163
+ type: 'integer'
164
+ },
165
+ totalUntaxed: {
166
+ type: 'number'
167
+ },
168
+ totalWithTax: {
169
+ type: 'integer'
170
+ }
171
+ },
172
+ required: [
173
+ 'id',
174
+ 'productId',
175
+ 'productName',
176
+ 'price',
177
+ 'vatPercent',
178
+ 'discountPercent',
179
+ 'quantity',
180
+ 'totalUntaxed',
181
+ 'totalWithTax'
182
+ ]
183
+ }
184
+ ]
185
+ }
186
+ },
187
+ required: [
188
+ 'id',
189
+ 'purchaseOrderNumber',
190
+ 'notes',
191
+ 'status',
192
+ 'totalAmount',
193
+ 'recipients',
194
+ 'createdBy',
195
+ 'products'
196
+ ]
197
+ },
198
+ company: {
199
+ type: 'object',
200
+ properties: {
201
+ vat_id: {
202
+ type: 'string'
203
+ },
204
+ address: {
205
+ type: 'object',
206
+ properties: {
207
+ region: {
208
+ type: 'string'
209
+ },
210
+ street: {
211
+ type: 'string'
212
+ },
213
+ country: {
214
+ type: 'string'
215
+ },
216
+ locality: {
217
+ type: 'string'
218
+ },
219
+ postal_code: {
220
+ type: 'string'
221
+ },
222
+ street_number: {
223
+ type: 'string'
224
+ }
225
+ },
226
+ required: [
227
+ 'region',
228
+ 'street',
229
+ 'country',
230
+ 'locality',
231
+ 'postal_code',
232
+ 'street_number'
233
+ ]
234
+ },
235
+ lastname: {
236
+ type: 'string'
237
+ },
238
+ firstname: {
239
+ type: 'string'
240
+ },
241
+ tax_number: {
242
+ type: 'string'
243
+ },
244
+ company_name: {
245
+ type: 'string'
246
+ }
247
+ },
248
+ required: [
249
+ 'vat_id',
250
+ 'address',
251
+ 'lastname',
252
+ 'firstname',
253
+ 'tax_number',
254
+ 'company_name'
255
+ ]
256
+ },
257
+ businessParnter: {
258
+ type: 'object',
259
+ properties: {
260
+ id: {
261
+ type: 'string'
262
+ },
263
+ createdAt: {
264
+ type: 'string'
265
+ },
266
+ updatedAt: {
267
+ type: 'string'
268
+ },
269
+ active: {
270
+ type: 'boolean'
271
+ },
272
+ deletedAt: {
273
+ type: 'null'
274
+ },
275
+ companyName: {
276
+ type: 'string'
277
+ },
278
+ description: {
279
+ type: 'string'
280
+ },
281
+ number: {
282
+ type: 'string'
283
+ },
284
+ firstName: {
285
+ type: 'string'
286
+ },
287
+ lastName: {
288
+ type: 'string'
289
+ },
290
+ email: {
291
+ type: 'string'
292
+ },
293
+ phoneNumbers: {
294
+ type: 'array',
295
+ items: [
296
+ {
297
+ type: 'object',
298
+ properties: {
299
+ id: {
300
+ type: 'string'
301
+ },
302
+ createdAt: {
303
+ type: 'string'
304
+ },
305
+ updatedAt: {
306
+ type: 'string'
307
+ },
308
+ type: {
309
+ type: 'string'
310
+ },
311
+ number: {
312
+ type: 'string'
313
+ }
314
+ },
315
+ required: [
316
+ 'type',
317
+ 'number'
318
+ ]
319
+ }
320
+ ]
321
+ },
322
+ paymentTerms: {
323
+ type: 'integer'
324
+ },
325
+ taxNumber: {
326
+ type: 'string'
327
+ },
328
+ glnNumber: {
329
+ type: 'string'
330
+ },
331
+ taxSubject: {
332
+ type: 'boolean'
333
+ },
334
+ accountsReceivable: {
335
+ type: 'array',
336
+ items: {}
337
+ },
338
+ accountsPayable: {
339
+ type: 'array',
340
+ items: {}
341
+ },
342
+ addresses: {
343
+ type: 'array',
344
+ items: [
345
+ {
346
+ type: 'object',
347
+ properties: {
348
+ id: {
349
+ type: 'string'
350
+ },
351
+ createdAt: {
352
+ type: 'string'
353
+ },
354
+ updatedAt: {
355
+ type: 'string'
356
+ },
357
+ type: {
358
+ type: 'string'
359
+ },
360
+ country: {
361
+ type: 'string'
362
+ },
363
+ region: {
364
+ type: 'string'
365
+ },
366
+ locality: {
367
+ type: 'string'
368
+ },
369
+ street: {
370
+ type: 'string'
371
+ },
372
+ streetNumber: {
373
+ type: 'string'
374
+ },
375
+ lines: {
376
+ type: 'string'
377
+ },
378
+ postalCode: {
379
+ type: 'string'
380
+ }
381
+ },
382
+ required: [
383
+ 'id',
384
+ 'type',
385
+ 'country',
386
+ 'region',
387
+ 'locality',
388
+ 'street',
389
+ 'streetNumber',
390
+ 'lines',
391
+ 'postalCode'
392
+ ]
393
+ }
394
+ ]
395
+ },
396
+ bankAccounts: {
397
+ type: 'array',
398
+ items: [
399
+ {
400
+ type: 'object',
401
+ properties: {
402
+ id: {
403
+ type: 'string'
404
+ },
405
+ createdAt: {
406
+ type: 'string'
407
+ },
408
+ updatedAt: {
409
+ type: 'string'
410
+ },
411
+ name: {
412
+ type: 'string'
413
+ },
414
+ iban: {
415
+ type: 'string'
416
+ },
417
+ swift: {
418
+ type: 'string'
419
+ }
420
+ },
421
+ required: [
422
+ 'id',
423
+ 'name',
424
+ 'iban',
425
+ 'swift'
426
+ ]
427
+ }
428
+ ]
429
+ }
430
+ },
431
+ required: [
432
+ 'id',
433
+ 'active',
434
+ 'companyName',
435
+ 'description',
436
+ 'number',
437
+ 'firstName',
438
+ 'lastName',
439
+ 'email',
440
+ 'phoneNumbers',
441
+ 'paymentTerms',
442
+ 'taxNumber',
443
+ 'glnNumber',
444
+ 'taxSubject',
445
+ 'addresses',
446
+ 'bankAccounts'
447
+ ]
448
+ }
449
+ },
450
+ required: [
451
+ 'order',
452
+ 'company',
453
+ 'businessParnter'
454
+ ]
455
+ }
@@ -62,11 +62,12 @@ module.exports = {
62
62
  description: 'Price types sorted by priority.',
63
63
  type: 'array',
64
64
  uniqueItems: true,
65
- default: ['scaled', 'time-based', 'branch'],
65
+ default: ['scaled', 'time-based', 'location-based', 'branch'],
66
66
  items: {
67
67
  type: 'string',
68
68
  enum: [
69
69
  'time-based',
70
+ 'location-based',
70
71
  'branch',
71
72
  'scaled'
72
73
  ]
@@ -82,6 +82,11 @@ module.exports = {
82
82
  type: 'object',
83
83
  ...searchBehavior
84
84
  },
85
+ stock_adjustment: {
86
+ description: 'Stock adjustment view',
87
+ type: 'object',
88
+ ...searchBehavior
89
+ },
85
90
  tile_view: {
86
91
  description: 'Tile view, no limitations, probably account requirements dependent',
87
92
  type: 'object',
@@ -14,9 +14,10 @@ module.exports = {
14
14
  description: 'Type of the product prices',
15
15
  type: 'string',
16
16
  enum: [
17
- 'scaled',
18
- 'branch',
19
- 'time-based'
17
+ 'scaled', // defined by product
18
+ 'branch', // defined by product
19
+ 'time-based', // defined by pricebook-entry
20
+ 'location-based' // defined by pricebook-entry
20
21
  ],
21
22
  example: 'scaled'
22
23
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tillhub/schemas",
3
- "version": "6.217.0",
3
+ "version": "6.219.0",
4
4
  "private": false,
5
5
  "description": "All Tillhub API OpenAPI 3 compatible JSON Schemas.",
6
6
  "main": "./lib/index.js",
@@ -19,6 +19,15 @@ test('PDFs: create invoices schema validation', function (t) {
19
19
  t.end()
20
20
  })
21
21
 
22
+ test('PDFs: create purchase orders schema validation', function (t) {
23
+ t.plan(2)
24
+ const createRequest = require('../../lib/v0/pdfs').templates.purchase_orders.create.request
25
+ const { valid, error } = validate(createRequest)
26
+ t.ok(valid, 'create schema is valid')
27
+ t.error(error, 'should not get any error')
28
+ t.end()
29
+ })
30
+
22
31
  test('PDFs: create delivery notes schema validation', function (t) {
23
32
  t.plan(2)
24
33
  const createRequest = require('../../lib/v0/pdfs').templates.delivery_notes.create.request