具有快速API路由的Node.js 然后将数据库配置为ORM
我需要将(req)传递给类似(User module)的模块
在样本下
var models = require('./models',{pass the req here});
所以我可以在钩子中使用它来审核数据
beforeBulkUpdate: function (object,options, callback) {
console.log("000000 ", object)
console.log(' user data', options);
sequelize.models.Order.findOne({
where:{id:object.where.id}
}).then(function (data_before_update) {
sequelize.models.History.create({
data : data_before_update,
model: "Order",
primary_key: object.where.id
/// here using the passed req to save some data
}).then(function () {
//callback(null);
})
})
}