2016-11-13 20:33:23 +01:00
|
|
|
'use strict';
|
|
|
|
|
2016-11-11 15:46:59 +01:00
|
|
|
const joi = require('joi');
|
|
|
|
|
2017-11-02 09:23:38 +01:00
|
|
|
const countSchema = joi
|
|
|
|
.object()
|
|
|
|
.options({ stripUnknown: true })
|
|
|
|
.keys({
|
|
|
|
yes: joi
|
|
|
|
.number()
|
|
|
|
.required()
|
|
|
|
.min(0)
|
|
|
|
.default(0),
|
|
|
|
no: joi
|
|
|
|
.number()
|
|
|
|
.required()
|
|
|
|
.min(0)
|
|
|
|
.default(0),
|
|
|
|
});
|
2017-08-04 11:24:58 +02:00
|
|
|
|
2017-11-02 09:23:38 +01:00
|
|
|
const clientMetricsSchema = joi
|
|
|
|
.object()
|
|
|
|
.options({ stripUnknown: true })
|
|
|
|
.keys({
|
|
|
|
appName: joi.string().required(),
|
|
|
|
instanceId: joi.string().required(),
|
|
|
|
bucket: joi
|
|
|
|
.object()
|
|
|
|
.required()
|
|
|
|
.keys({
|
|
|
|
start: joi.date().required(),
|
|
|
|
stop: joi.date().required(),
|
|
|
|
toggles: joi.object().pattern(/.*/, countSchema),
|
|
|
|
}),
|
|
|
|
});
|
2016-11-11 15:46:59 +01:00
|
|
|
|
2017-06-28 23:13:29 +02:00
|
|
|
module.exports = { clientMetricsSchema };
|