2016-03-02 16:20:36 +01:00

34 lines
475 B
JavaScript

'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';
},
/**
* Find primary key
*/
getCount: function (type) {
return strapi.bookshelf.collections[type].forge().count().then(function (count) {
return count;
});
}
};