periodicjs.core.controller
Advanced tools
Comparing version 4.0.3 to 4.0.4
@@ -752,3 +752,59 @@ /* | ||
Controller.prototype.updateMultipleModel = function(options){ | ||
logger.warn('cached documents not clearing and revisions on multple documents not saved'); | ||
var model = options.model, | ||
// id = options.id, | ||
updatequery = options.updatequery, | ||
updateattributes = options.updateattributes, | ||
req = options.req, | ||
res = options.res, | ||
callback = options.callback, | ||
successredirect = options.successredirect, | ||
// originalrevision = options.originalrevision, | ||
// appendid = options.appendid, | ||
responseData = {};//, | ||
// updateOperation, | ||
// cached = (typeof options.cached === 'boolean' && options.cached===true) && true, | ||
// useCacheTest = (useCache && global.CoreCache && cached && req.headers.periodicCache!=='no-periodic-cache'); | ||
model.update(updatequery, updateattributes, { multi: true }, function (err, numAffected) { | ||
if (err) { | ||
if (callback) { | ||
callback(err, null); | ||
} | ||
else { | ||
this.handleDocumentQueryErrorResponse({ | ||
err: err, | ||
errorflash: err.message, | ||
res: res, | ||
req: req | ||
}); | ||
} | ||
} | ||
else { | ||
if (callback) { | ||
callback(null, numAffected); | ||
} | ||
else if (req.query.format === 'json' || req.params.ext === 'json') { | ||
req.flash('success', 'Saved'); | ||
responseData.result = 'success'; | ||
responseData.data = { | ||
numAffected: numAffected | ||
}; | ||
responseData.data.flash_messages = req.flash(); | ||
res.send(responseData); | ||
} | ||
else { | ||
req.flash('success', 'Saved'); | ||
res.redirect(successredirect); | ||
} | ||
// if(useCacheTest){ | ||
// updatedoc.id = id; | ||
// clearModelDocCache({model:model,doc:updatedoc,req:req}); | ||
// } | ||
} | ||
}); | ||
}; | ||
/** | ||
@@ -755,0 +811,0 @@ * short hand mongoose update document query |
{ | ||
"name": "periodicjs.core.controller", | ||
"description": "Customizable CMS platform", | ||
"version": "4.0.3", | ||
"version": "4.0.4", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "engines": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
143425
1608