diff --git a/lib/v0/client_accounts/base.js b/lib/v0/client_accounts/base.js new file mode 100644 index 000000000..c24299709 --- /dev/null +++ b/lib/v0/client_accounts/base.js @@ -0,0 +1,52 @@ +const demoData = require('../demoData') + +module.exports = { + name: { + type: 'string' + }, + display_name: { + type: 'string', + pattern: '^[a-z0-9_-]*$' + }, + email: { + type: 'string', + format: 'email' + }, + email_confirmed: { + type: 'boolean' + }, + password: { + type: 'string', + minLength: 5, + maxLength: 36 + }, + test_account: { + type: 'boolean' + }, + template: { + type: 'string', + 'enum': [ + 'tillhub_init', + 'tillhub_init_legacy' + ], + 'default': 'tillhub_init' + }, + dashboard: { + type: 'string', + 'enum': [ + 'tillhub', + 'shore', + 'localsearch' + ], + 'default': 'tillhub' + }, + demo_data: { + anyOf: [ + { + ...demoData + }, + { + type: 'null' + } + ] + }} diff --git a/lib/v0/client_accounts/create.js b/lib/v0/client_accounts/create.js new file mode 100644 index 000000000..488945b12 --- /dev/null +++ b/lib/v0/client_accounts/create.js @@ -0,0 +1,13 @@ +const base = require('./base') + +module.exports.request = { + $id: 'https://schemas.tillhub.com/v0/client_accounts.create.request.schema.json', + $schema: 'http://json-schema.org/draft-07/schema#', + additionalProperties: false, + required: [ + 'email', + 'password' + ], + properties: base, + type: 'object' +} diff --git a/lib/v0/client_accounts/demoData.js b/lib/v0/client_accounts/demoData.js new file mode 100644 index 000000000..7f1d4355f --- /dev/null +++ b/lib/v0/client_accounts/demoData.js @@ -0,0 +1,64 @@ +module.exports = { + type: 'object', + required: [ + 'accounts', + 'expenses', + 'taxes', + 'payment_options', + 'branches_registers', + 'staff' + ], + properties: { + accounts: { + type: 'string', + 'enum': [ + 'de_skr_03', + 'de_skr_04', + 'ch' + ] + }, + expenses: { + type: 'string', + 'enum': [ + 'standard_german', + 'standard_english', + 'fleurop' + ] + }, + taxes: { + type: 'string', + 'enum': [ + 'de', + 'ch' + ] + }, + payment_options: { + 'type': 'array', + 'items': { + 'type': 'string', + 'enum': [ + 'voucher', + 'ccvfly', + 'rechnung', + 'amex', + 'concardis', + 'bar', + 'card_circuits' + ] + } + } + }, + branches_registers: { + type: 'string', + 'enum': [ + 'basic', + 'basic_v1' + ] + }, + staff: { + type: 'string', + 'enum': [ + 'default' + ] + } +} diff --git a/lib/v0/client_accounts/index.js b/lib/v0/client_accounts/index.js new file mode 100644 index 000000000..1f574111f --- /dev/null +++ b/lib/v0/client_accounts/index.js @@ -0,0 +1,2 @@ +module.exports.create = require('./create') +module.exports.update = require('./update') diff --git a/lib/v0/client_accounts/update.js b/lib/v0/client_accounts/update.js new file mode 100644 index 000000000..8b85f0e1f --- /dev/null +++ b/lib/v0/client_accounts/update.js @@ -0,0 +1,10 @@ +const base = require('./base') + +module.exports.request = { + $id: 'https://schemas.tillhub.com/v0/client_accounts.update.request.schema.json', + $schema: 'http://json-schema.org/draft-07/schema#', + additionalProperties: false, + type: 'object', + required: [], + properties: base +} diff --git a/lib/v0/index.js b/lib/v0/index.js index 088fd3512..8f990ab97 100644 --- a/lib/v0/index.js +++ b/lib/v0/index.js @@ -38,3 +38,4 @@ module.exports.voucher_systems = require('./voucher_systems') module.exports.manufacturers = require('./manufacturers') module.exports.custom_hooks = require('./custom_hooks') module.exports.analytics = require('./analytics') +module.exports.analytics = require('./client_accounts')