Skip to content

herbertscruz/loopback-extra-filters

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DEPRECATED - Use the package loopback-extra-query-filters


# loopback-extra-filters This package is designed to provide filter alternatives under the loopback query data.

The extra filters do not change queries generated by loopback-datasource-juggler, but are applied to the resulting object.

Install

// server/boot/extra-filters.js
'use strict';

const Boot = require('loopback-extra-filters/lib/boot');

module.exports = function(server) {
  Boot.apply(server);
};

Filters

  • has - Check if you have the property.
  • notHas - Check if you do not have the property.
  • isEmpty -Check if array property is empty
  • isNotEmpty - Check if array property is not empty.

Examples

  • Filter:
// Product has category (Ex.: relation belongsTo)
{
  "include": {
    "relation": "category",
  },
  "isHas": "category" //or ["category", ...]
}

// Product has no category (Ex.: relation belongsTo)
{
  "include": {
    "relation": "category",
  },
  "isHas": "category" //or ["category", ...]
}

// Product without items (Ex.: relation hasMany)
{
  "include": {
    "relation": "items",
  },
  "isEmpty": "items" //or ["items", ...]
}

// Product with items (Ex.: relation hasMany)
{
  "include": {
    "relation": "items",
  },
  "isNotEmpty": "items" //or ["items", ...]
}

About

This package is designed to provide filter alternatives under the loopback query data.

Resources

License

Stars

Watchers

Forks

Packages

No packages published