Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* @param {Function(Object)} update
* @param {Function(Object)} count
*/
this.controller = controller;
// define CRUD middleware
this.create = [];
this.readOne = [];
this.readList = [];
this.update = [];
this.delete = [];
// define CRUD Query middleware
function noopReturn(query) {return query;}
middlewarify.make(this, 'createQuery', noopReturn);
middlewarify.make(this, 'readOneQuery', noopReturn);
middlewarify.make(this, 'readListQuery', noopReturn);
middlewarify.make(this, 'updateQuery', noopReturn);
middlewarify.make(this, 'deleteQuery', noopReturn);
var self = this;
function use(middleware) {
this.push(middleware);
return self;
}
this.create.use = use;
this.readOne.use = use;
this.readList.use = use;
this.update.use = use;
this.delete.use = use;
this._setDefaults();
*/
this.controller = controller;
// define CRUD middleware
this.create = [];
this.readOne = [];
this.readList = [];
this.update = [];
this.delete = [];
// define CRUD Query middleware
function noopReturn(query) {return query;}
middlewarify.make(this, 'createQuery', noopReturn);
middlewarify.make(this, 'readOneQuery', noopReturn);
middlewarify.make(this, 'readListQuery', noopReturn);
middlewarify.make(this, 'updateQuery', noopReturn);
middlewarify.make(this, 'deleteQuery', noopReturn);
var self = this;
function use(middleware) {
this.push(middleware);
return self;
}
this.create.use = use;
this.readOne.use = use;
this.readList.use = use;
this.update.use = use;
this.delete.use = use;
this._setDefaults();
if (this.express) {
var Entity = module.exports = function(Model, optUdo) {
EventEmitter.call(this);
/** @type {mongoose.Model} The mongoose model */
this.Model = Model;
/** @type {?Object} The current user or null for anonymous */
this.udo = optUdo || null;
// Create primitive middlewares
midd.make(this, 'create', this._create.bind(this));
midd.make(this, 'read', this._read.bind(this));
midd.make(this, 'readOne', this._readOne.bind(this));
midd.make(this, 'readLimit', this._readLimit.bind(this));
midd.make(this, 'update', this._update.bind(this));
midd.make(this, 'delete', this._delete.bind(this));
midd.make(this, 'count', this._count.bind(this));
};
util.inherits(Entity, EventEmitter);
this.controller = controller;
// define CRUD middleware
this.create = [];
this.readOne = [];
this.readList = [];
this.update = [];
this.delete = [];
// define CRUD Query middleware
function noopReturn(query) {return query;}
middlewarify.make(this, 'createQuery', noopReturn);
middlewarify.make(this, 'readOneQuery', noopReturn);
middlewarify.make(this, 'readListQuery', noopReturn);
middlewarify.make(this, 'updateQuery', noopReturn);
middlewarify.make(this, 'deleteQuery', noopReturn);
var self = this;
function use(middleware) {
this.push(middleware);
return self;
}
this.create.use = use;
this.readOne.use = use;
this.readList.use = use;
this.update.use = use;
this.delete.use = use;
this._setDefaults();
if (this.express) {
this.addRoutes(this.express);
* @param {Function(Object)} count
*/
this.controller = controller;
// define CRUD middleware
this.create = [];
this.readOne = [];
this.readList = [];
this.update = [];
this.delete = [];
// define CRUD Query middleware
function noopReturn(query) {return query;}
middlewarify.make(this, 'createQuery', noopReturn);
middlewarify.make(this, 'readOneQuery', noopReturn);
middlewarify.make(this, 'readListQuery', noopReturn);
middlewarify.make(this, 'updateQuery', noopReturn);
middlewarify.make(this, 'deleteQuery', noopReturn);
var self = this;
function use(middleware) {
this.push(middleware);
return self;
}
this.create.use = use;
this.readOne.use = use;
this.readList.use = use;
this.update.use = use;
this.delete.use = use;
this._setDefaults();
var Entity = module.exports = function(Model, optUdo) {
EventEmitter.call(this);
/** @type {mongoose.Model} The mongoose model */
this.Model = Model;
/** @type {?Object} The current user or null for anonymous */
this.udo = optUdo || null;
// Create primitive middlewares
midd.make(this, 'create', this._create.bind(this));
midd.make(this, 'read', this._read.bind(this));
midd.make(this, 'readOne', this._readOne.bind(this));
midd.make(this, 'readLimit', this._readLimit.bind(this));
midd.make(this, 'update', this._update.bind(this));
midd.make(this, 'delete', this._delete.bind(this));
midd.make(this, 'count', this._count.bind(this));
};
util.inherits(Entity, EventEmitter);
var Entity = module.exports = function(Model, optUdo) {
EventEmitter.call(this);
/** @type {mongoose.Model} The mongoose model */
this.Model = Model;
/** @type {?Object} The current user or null for anonymous */
this.udo = optUdo || null;
// Create primitive middlewares
midd.make(this, 'create', this._create.bind(this));
midd.make(this, 'read', this._read.bind(this));
midd.make(this, 'readOne', this._readOne.bind(this));
midd.make(this, 'readLimit', this._readLimit.bind(this));
midd.make(this, 'update', this._update.bind(this));
midd.make(this, 'delete', this._delete.bind(this));
midd.make(this, 'count', this._count.bind(this));
};
util.inherits(Entity, EventEmitter);
* @param {Function(Object)} readOne
* @param {Function(Object)} update
* @param {Function(Object)} count
*/
this.controller = controller;
// define CRUD middleware
this.create = [];
this.readOne = [];
this.readList = [];
this.update = [];
this.delete = [];
// define CRUD Query middleware
function noopReturn(query) {return query;}
middlewarify.make(this, 'createQuery', noopReturn);
middlewarify.make(this, 'readOneQuery', noopReturn);
middlewarify.make(this, 'readListQuery', noopReturn);
middlewarify.make(this, 'updateQuery', noopReturn);
middlewarify.make(this, 'deleteQuery', noopReturn);
var self = this;
function use(middleware) {
this.push(middleware);
return self;
}
this.create.use = use;
this.readOne.use = use;
this.readList.use = use;
this.update.use = use;
this.delete.use = use;
var Entity = module.exports = function(Model, optUdo) {
EventEmitter.call(this);
/** @type {mongoose.Model} The mongoose model */
this.Model = Model;
/** @type {?Object} The current user or null for anonymous */
this.udo = optUdo || null;
// Create primitive middlewares
midd.make(this, 'create', this._create.bind(this));
midd.make(this, 'read', this._read.bind(this));
midd.make(this, 'readOne', this._readOne.bind(this));
midd.make(this, 'readLimit', this._readLimit.bind(this));
midd.make(this, 'update', this._update.bind(this));
midd.make(this, 'delete', this._delete.bind(this));
midd.make(this, 'count', this._count.bind(this));
};
util.inherits(Entity, EventEmitter);
var Entity = module.exports = function(Model, optUdo) {
EventEmitter.call(this);
/** @type {mongoose.Model} The mongoose model */
this.Model = Model;
/** @type {?Object} The current user or null for anonymous */
this.udo = optUdo || null;
// Create primitive middlewares
midd.make(this, 'create', this._create.bind(this));
midd.make(this, 'read', this._read.bind(this));
midd.make(this, 'readOne', this._readOne.bind(this));
midd.make(this, 'readLimit', this._readLimit.bind(this));
midd.make(this, 'update', this._update.bind(this));
midd.make(this, 'delete', this._delete.bind(this));
midd.make(this, 'count', this._count.bind(this));
};
util.inherits(Entity, EventEmitter);