@opengis/bi
Version:
BI data visualization module
39 lines (35 loc) • 1.02 kB
JavaScript
import data from './controllers/data.js';
const biSchema = {
type: 'object',
properties: {
querystring: {
widget: { type: 'string', pattern: '^([\\d\\w_]+)$' },
dashboard: { type: 'string', pattern: '^([\\d\\w_]+)$' },
sql: { type: 'string', pattern: '^([\\d])$' },
// metric: { type: 'string', pattern: '^([\\d\\w_]+)$' },
x: { type: 'string', pattern: '^([\\d\\w_]+)$' },
granularity: { type: 'string', pattern: '^(week|month|quarter|year)$' },
groupby: { type: 'string', pattern: '^([\\d\\w_]+)$' },
filterCustom: { type: 'string', pattern: '^([\\d\\w_,]+)$' },
},
params: {
id: { type: 'string', pattern: '^([\\d\\w]+)$' },
},
},
};
const policy = ['public'];
export default async function route(fastify, opts) {
fastify.route({
method: 'GET',
url: '/bi-data',
schema: biSchema,
config: {
policy,
rateLimit: {
max: 3000,
timeWindow: '1 minute',
}
},
handler: data,
});
}