Skip to content

Latest commit

 

History

History
61 lines (44 loc) · 1.75 KB

File metadata and controls

61 lines (44 loc) · 1.75 KB

Disclaimer

This is repo is cloned from https://github.com/joinbox/loopback-component-relation-filter, and I am just adding mysql support suggested by another user in the same repo. All the credit goes to them and their contributors.

loopback-relation-filter

Enables where query filters on related loopback models.

Configuration

Enable/disable extended searching for all models in your component-config:

{
    "loopback-component-relation-filter": {
        "enabled": true,
        "rejectUnknownProperties": true,
        "preserveColumnCase": true
    }
}

Enable/disable searching in a specific model config:

{
    "relationFilter": {
        "enabled": true,
        "rejectUnknownProperties": true,
        "preserveColumnCase": false
    }
}

RejectUnknownProperties

If rejectUnknownProperties (default is true) is set to false the component will not throw an error during the normalization if the queried property/relation does not exist on the queried model. One can use this configuration value to ensure that legacy queries still work properly and do not fail.

PreserveColumnCase

If preserveColumnCase is set to false, column names are converted to lowercase when building the query. This option allows the user to make the filtering work with older, auto generated models (i.e. using automigrate/-update) where the column names were lowercased (e.g. property startDate will be converted to a column startdate).

Testing

Check the package.json to see how to execute tests:

  • all: npm test
  • unit: npm run test:unit
  • integration: npm run test:integration
  • watch tests during development: npm run test:watch (uses mocha's --watch option)
  • linting: npm run lint