UNPKG

@opengis/bi

Version:

BI data visualization module

34 lines (30 loc) 1.33 kB
/* eslint-disable import/extensions */ import widgetAdd from './controllers/widget.add.js'; import widgetEdit from './controllers/widget.edit.js'; import widgetDel from './controllers/widget.del.js'; import dashboardEdit from './controllers/dashboard.edit.js'; import dashboardAdd from './controllers/dashboard.add.js'; import dashboardDelete from './controllers/dashboard.delete.js'; const biSchema = { type: 'object', properties: { querystring: { widget: { type: 'string', pattern: '^([\\d\\w]+)$' }, dashboard: { type: 'string', pattern: '^([\\d\\w]+)$' }, list: { type: 'string', pattern: '^([\\d])$' }, sql: { type: 'string', pattern: '^([\\d])$' }, }, params: { name: { type: 'string', pattern: '^([\\d\\w]+)$' }, widget: { type: 'string', pattern: '^([\\d\\w]+)$' }, }, }, }; export default async function route(fastify) { fastify.post(`/bi-dashboard/:name`, { schema: biSchema }, widgetAdd); fastify.put(`/bi-dashboard/:name/:widget`, { schema: biSchema }, widgetEdit); fastify.delete(`/bi-dashboard/:name/:widget`, { schema: biSchema }, widgetDel); fastify.post(`/bi-dashboard`, { schema: biSchema }, dashboardAdd); fastify.put(`/bi-dashboard/:name`, { schema: biSchema }, dashboardEdit); fastify.delete(`/bi-dashboard/:id`, {}, dashboardDelete); }