mailtrain/models/lists.js
Tomas Bures 89c9615592 WiP on permissions
Doesn't run. This commit is just to backup the changes.
2017-07-26 22:42:05 +03:00

24 lines
No EOL
619 B
JavaScript

'use strict';
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, builder => builder.from('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,
getById
};