Skip to content

ParsedRequest filter changes from 4.3.x introduce breaking change #394

@iamjoeker

Description

@iamjoeker

I updated to 4.4.1 in early January and notice that request filter handling changed. In some controllers, it is necessary to add additional filters before handing the request off to the service for database operations (e.g. to add authorization criteria to the database query). Below is an example of how I implemented this prior to 4.3.x.

@Override()
async getMany(@ParsedRequest() req: CrudRequest, @User() user: User) {
  // Simulating user only having access to remoteId == 10

  req.parsed.filter.push({
    field: 'remoteId',
    operator: '$eq',
    value: user.remoteId,
  });

  return await this.base.getManyBase(req);
}

After upgrading to 4.4.1, I notice that these filter conditions are not incorporated when generating the database query. I tracked the change down to this commit 7026039.

I have created a demonstration repository demonstrating the issue: https://github.com/iamjoeker/crud_filter_change_poc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions