Skip to content

Instantly share code, notes, and snippets.

View marcoskubis's full-sized avatar

Marcos Kubis marcoskubis

View GitHub Profile
@marcoskubis
marcoskubis / scopeQuery.js
Last active October 18, 2016 20:33 — forked from fabien/gist:76c28baa99de1bbdc141
Mixin for query scope on rest for loopback
module.exports = function(Model, options) {
var mergeQuery = require('loopback-datasource-juggler/lib/utils').mergeQuery;
var _ = require('lodash');
var scopes = options.scopes || _.keys(Model.scopes);
var validScopes = {};
_.each(Model.scopes, function(scope, name) {
if (scope.modelFrom === Model && scope.modelFrom === scope.modelTo) {