@wizeapps/charts-runtime

1.1.4 • Public • Published

@wizeapps/charts-runtime

Description

Enables analytics on app sequelize models. It works only on postgres DB. It has dependency on @wizni/wize-runtime-load-routes, @wizni/wize-sequelize-runtime & @wizni/wize-sequelize-source. It reads config.json for all models defined in app.

Models

  • ChartSettings: Stores query data, report name, access and chart settings data.
  • ReportCategories: Stores all report categories defined by admin user.
  • ReportCategoryFields: Stores all fields under report category defined by admin user.

APIs

  • [GET] /api/metadata/dbschema - Lists all DB models & their meta information.
  • [POST] /api/metadata/executeQuery - Executes query in DB to fetch chart data.
  • [POST] /api/reportcategories - Create new report category.
  • [PATCH] /api/reportcategories - update existing report category.

Chart Settings

{
  "id": <Auto-increment> INTEGER,
  "name": STRING (Report Name),
  "description": STRING (Report Description),
  "type": STRING (Chart Type),
  "chartSettings": JSONB (Chart display settings & format etc.),
  "dataQuery": JSONB (Tables, columns, matrics, filters, pivots information to be executes as query in DB)
}

Usage

Installation

npm install --save @wizeapps/charts-runtime

Initialize

import chartsApis from '@wizeapps/charts-runtime';
.
.
.
/*
app: koa-app returned from 'const app = createServer({});'
sequelizeSource: sequelize object returned from 'import sequelizeSource from './sources/postgresql';'
*/
chartsApis(app, sequelizeSource);

Model Definition

Module assumes that model has system fields - createdBy and modifiedBy, which are used to store the actor. Supply createdBy in instance during Create and modifiedBy during Update and Delete operations.

Test

npm run test

License

MIT License

Readme

Keywords

none

Package Sidebar

Install

npm i @wizeapps/charts-runtime

Weekly Downloads

0

Version

1.1.4

License

MIT

Last publish

Collaborators

  • praveennegi
  • harishtejwani