search

Description
POST - Search route of entity. Mainly used by ajax selects

Methods


start( data )

Description
Called to search entity results paginated and / or filtered. This route is used by ajax select
Parameters
Name Type Description
data object
Name Type Attributes Default Description
req object Request - See expressjs definition
res object Response - See expressjs definition
transaction object <optional>
Database transaction. undefined by default, provide your own when necessary
search string The search filter wrapped in '%' char. If no filter is provided `data.search` will equals to '%%'
searchField Array.<string> The field on which the search filter is to be applied
limit number SELECT_PAGE_SIZE Limit the number of results. Defaults to `SELECT_PAGE_SIZE` global
offset number The offset of search results. Equals to page number * `data.limit`

beforeQuery( data )

Description
Before the Sequelize query, usefull to customize default query behaviour
Parameters
Name Type Description
data object
Name Type Attributes Description
req object Request - See expressjs definition
res object Response - See expressjs definition
transaction object <optional>
Database transaction. undefined by default, provide your own when necessary
query object Query object that will be used in Sequelize query, customizable

beforeResponse( data )

Description
Called before json response
Parameters
Name Type Description
data object
Name Type Attributes Default Description
req object Request - See expressjs definition
res object Response - See expressjs definition
transaction object <optional>
Database transaction. undefined by default, provide your own when necessary
search string The search filter wrapped in '%' char. If no filter is provided `data.search` will equals to '%%'
searchField Array.<string> The field on which the search filter is to be applied
limit number SELECT_PAGE_SIZE Limit the number of results. Defaults to `SELECT_PAGE_SIZE` global
offset number The offset of search results. Equals to page number * `data.limit`
results object Search result sent to response