Skip to content

Create endpoint to simulate Filters and Includes #2

Description

@victorlucss

The user can filter data on list endpoint, not depending to create another endpoint to filter or include data. The user can do something like this:

/categories?user=victor&include=product,owner

So, the include will do a subquery including the fields that are in parent model and the filter will filter the response (also in the query) bringing only the data that matches with relation key-value on the filter (in the example case, all users that have user matching with "victor").

To include filters or include on req (request) object the route must have a Filter and an Include Middleware (as below,).

app.VERB('/', [RetrieveFilters, RetrieveIncludes CheckToken], (req,res) => this.controller.METHOD(req,res));

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions