Better Programming with multi-tenancy
Product.addProductsInBulk = function (id, data) { .... .... // function algorithm .... return promise; }Organisation.remoteMethod('addProducts', { accepts: [ {arg: 'id', type: 'string', required: true}, {arg: 'data', type: 'object', required: true, http: {source: 'body'}} ], http: {path: '/:id/products/add', verb: 'post'}, returns: {arg:'products', type: 'object', root: true} }); Organisation.addProducts = function (id, data, cb) { app.models.Product.addProductsInBulk(id, data) .then(function (response) { cb(null, response); }) .catch(function(error){ cb(error); }); };
Last updated