Reports ported to ReactJS and Knex
Note that the interface for the custom JS code inside a report template has changed. It now offers promise-based interface and exposes knex.
This commit is contained in:
parent
6d95fa515e
commit
d63eed9ca9
27 changed files with 649 additions and 953 deletions
|
@ -2,12 +2,23 @@
|
|||
|
||||
const knex = require('../lib/knex');
|
||||
const dtHelpers = require('../lib/dt-helpers');
|
||||
const interoperableErrors = require('../shared/interoperable-errors');
|
||||
|
||||
async function listDTAjax(params) {
|
||||
return await dtHelpers.ajaxList(params, tx => tx('lists'), ['lists.id', 'lists.name', 'lists.cid', 'lists.subscribers', 'lists.description']);
|
||||
}
|
||||
|
||||
async function getById(id) {
|
||||
const entity = await knex('lists').where('id', id).first();
|
||||
if (!entity) {
|
||||
throw new interoperableErrors.NotFoundError();
|
||||
}
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
|
||||
module.exports = {
|
||||
listDTAjax
|
||||
listDTAjax,
|
||||
getById
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue