Skip to content

Instantly share code, notes, and snippets.

@helsont
Created December 29, 2015 23:22
Show Gist options
  • Save helsont/e015eda6311915b67ec3 to your computer and use it in GitHub Desktop.
Save helsont/e015eda6311915b67ec3 to your computer and use it in GitHub Desktop.
'use strict';
module.exports = function(Model, options) {
let property = options.property;
// Use 'ignoreFilters' to access deleted data.
Model.observe('access', function filterDelted(ctx, next) {
if (!ctx.query.ignoreFilters) {
if (!ctx.query.where) {
ctx.query.where = {};
}
ctx.query.where[property] = { neq: true };
}
next();
});
};
// My use:
"mixins": {
"IgnoreFilters": {
"property": "deleted"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment