var funs = {
getList: function (collectionName,req,res,next) {
var mainObj = transformCollctionName(collectionName);
if (!mainObj) {
next();
}
var options = req.query;
var sort = options.sort || mainObj.defaultSort;
var pageSize = options.pageSize || mainObj.defaultOptions.pageSize;
var currentPage = options.currentPage || 1;
var condition = options.condition || {}
},countList: function (collectionName,next) {
var mainObj = transformCollctionName(collectionName);
if (!mainObj) {
next();
}
var condition = req.query.condition || {}
mainObj.find(condition).count().exec(function (err,docs) {
if (err) {
next(err);
}
return res.json({'count': docs});
})
},HandleEvent: function (collectionName,actionsName,next) {
var mainFuns = getCollctionFuns(collectionName)
if (!mainFuns) {
next();
}
var fun = mainFuns[actionsName];
if (!fun) {
next();
}
fun(req,next);
}