具有快速API路由的Nodejs和用于将DB配置为ORM的sequelize
我需要的是将(req)传递给模块(用户模块)
在样本下面
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);
})
})
}