34 lines
475 B
JavaScript
Raw Normal View History

'use strict';
/**
* Module dependencies
*/
// Public node modules.
const _ = require('lodash');
/**
* JSON API utils for BookShelf
*/
module.exports = {
/**
* Find primary key
*/
getPK: function (type) {
return global[_.capitalize(type)].idAttribute || 'id';
2016-03-02 16:20:36 +01:00
},
/**
* Find primary key
*/
2016-03-02 16:20:36 +01:00
getCount: function (type) {
return strapi.bookshelf.collections[type].forge().count().then(function (count) {
return count;
});
}
};