@tillhub/schemas 6.448.0 → 6.449.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.
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
module.exports.request = {
|
|
2
|
+
$id: 'https://schemas.tillhub.com/v0/vouchers.export.request.schema.json',
|
|
3
|
+
$schema: 'http://json-schema.org/draft-07/schema#',
|
|
4
|
+
type: 'object',
|
|
5
|
+
additionalProperties: true,
|
|
6
|
+
required: ['format', 'documentType', 'email'],
|
|
7
|
+
properties: {
|
|
8
|
+
start: { type: 'string', format: 'date-time' },
|
|
9
|
+
updated_start: { type: 'string', format: 'date-time' },
|
|
10
|
+
updated_end: { type: 'string', format: 'date-time' },
|
|
11
|
+
deleted: { type: 'string', enum: ['true', 'false'] },
|
|
12
|
+
active: { type: 'string', enum: ['true', 'false'] },
|
|
13
|
+
issuable: { type: 'string', enum: ['true', 'false'] },
|
|
14
|
+
reissuable: { type: 'string', enum: ['true', 'false'] },
|
|
15
|
+
restriction_single_transaction: { type: 'string', enum: ['true', 'false'] },
|
|
16
|
+
partial_redemption: { type: 'string', enum: ['true', 'false'] },
|
|
17
|
+
limited_to_region: { type: 'string', enum: ['true', 'false'] },
|
|
18
|
+
refundable: { type: 'string', enum: ['true', 'false'] },
|
|
19
|
+
mutable: { type: 'string', enum: ['true', 'false'] },
|
|
20
|
+
exchange_for_cash: { type: 'string', enum: ['true', 'false'] },
|
|
21
|
+
is_campaign: { type: 'string', enum: ['true', 'false'] },
|
|
22
|
+
code: { type: 'string' },
|
|
23
|
+
regions: {
|
|
24
|
+
oneOf: [
|
|
25
|
+
{ type: 'array', minItems: 1, items: { type: 'string', minLength: 2, maxLength: 2 } },
|
|
26
|
+
{ type: 'string', minLength: 2, maxLength: 2 }
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
system: {
|
|
30
|
+
oneOf: [
|
|
31
|
+
{ type: 'array', minItems: 1, items: { type: 'string', format: 'uuid' } },
|
|
32
|
+
{ type: 'string', format: 'uuid' }
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
voucher_system: { type: 'string', format: 'uuid' },
|
|
36
|
+
amount_from: { type: 'string', minLength: 1, maxLength: 15 },
|
|
37
|
+
amount_to: { type: 'string', minLength: 1, maxLength: 15 },
|
|
38
|
+
expires_at_start: { type: 'string', format: 'date-time' },
|
|
39
|
+
expires_at_end: { type: 'string', format: 'date-time' },
|
|
40
|
+
location: {
|
|
41
|
+
oneOf: [
|
|
42
|
+
{ type: 'string' },
|
|
43
|
+
{ type: 'array', items: { type: 'string' } }
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
q: { type: 'string' },
|
|
47
|
+
cursor_field: { type: 'string' },
|
|
48
|
+
filename_prefix: { type: 'string' },
|
|
49
|
+
timezone: { type: 'string' },
|
|
50
|
+
limit: { type: 'string', maxLength: 10 },
|
|
51
|
+
offset: { type: 'string', maxLength: 10 },
|
|
52
|
+
page: { type: 'string', maxLength: 10 },
|
|
53
|
+
size: { type: 'string', maxLength: 10 },
|
|
54
|
+
pageSize: { type: 'string', maxLength: 10 },
|
|
55
|
+
|
|
56
|
+
format: { type: 'string', enum: ['csv', 'xls'] },
|
|
57
|
+
delimiter: { type: 'string', enum: ['comma', 'semicolon'] },
|
|
58
|
+
enclosure: { type: 'string', enum: ['single', 'double'] },
|
|
59
|
+
show_column_name: { type: 'string', enum: ['true', 'false'] },
|
|
60
|
+
column_selection: { type: 'array', items: { type: 'string' } },
|
|
61
|
+
|
|
62
|
+
documentType: { type: 'string', enum: ['VouchersListExport'] },
|
|
63
|
+
email: { type: 'string', minLength: 5 },
|
|
64
|
+
lang: { type: 'string' },
|
|
65
|
+
scheduled_id: { type: 'string', minLength: 1, maxLength: 64 },
|
|
66
|
+
existingId: { type: 'string', format: 'uuid' },
|
|
67
|
+
correlationId: { type: 'string', format: 'uuid' }
|
|
68
|
+
}
|
|
69
|
+
}
|
package/lib/v0/vouchers/index.js
CHANGED
package/lib/v0/vouchers/query.js
CHANGED
|
@@ -125,5 +125,38 @@ module.exports = {
|
|
|
125
125
|
expires_at_end: {
|
|
126
126
|
type: 'string',
|
|
127
127
|
format: 'date-time'
|
|
128
|
+
},
|
|
129
|
+
updated_start: {
|
|
130
|
+
type: 'string',
|
|
131
|
+
format: 'date-time'
|
|
132
|
+
},
|
|
133
|
+
updated_end: {
|
|
134
|
+
type: 'string',
|
|
135
|
+
format: 'date-time'
|
|
136
|
+
},
|
|
137
|
+
system: {
|
|
138
|
+
oneOf: [
|
|
139
|
+
{
|
|
140
|
+
type: 'array',
|
|
141
|
+
minItems: 1,
|
|
142
|
+
items: {
|
|
143
|
+
type: 'string',
|
|
144
|
+
format: 'uuid'
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
type: 'string',
|
|
149
|
+
format: 'uuid'
|
|
150
|
+
}
|
|
151
|
+
]
|
|
152
|
+
},
|
|
153
|
+
location: {
|
|
154
|
+
oneOf: [
|
|
155
|
+
{ type: 'string' },
|
|
156
|
+
{ type: 'array', items: { type: 'string' } }
|
|
157
|
+
]
|
|
158
|
+
},
|
|
159
|
+
q: {
|
|
160
|
+
type: 'string'
|
|
128
161
|
}
|
|
129
162
|
}
|
package/package.json
CHANGED
|
@@ -36,3 +36,12 @@ test('Vouchers: bulk create schema validation', function (t) {
|
|
|
36
36
|
t.error(error, 'should not get any error')
|
|
37
37
|
t.end()
|
|
38
38
|
})
|
|
39
|
+
|
|
40
|
+
test('Vouchers: export request schema validation', function (t) {
|
|
41
|
+
t.plan(2)
|
|
42
|
+
const exportRequest = require('../../lib/v0/vouchers').export.request
|
|
43
|
+
const { valid, error } = validate(exportRequest)
|
|
44
|
+
t.ok(valid, 'export request schema is valid')
|
|
45
|
+
t.error(error, 'should not get any error')
|
|
46
|
+
t.end()
|
|
47
|
+
})
|