Skip to content

API Explorer ignores where filter #2804

@dhmlau

Description

@dhmlau

Description

In the API Explorer, the where filter is being ignored.

Steps to reproduce

Using todo-list example,

  1. create todolist with ids 1, 2, and 3.
  2. create 3 todo's, one for each todolist:
[
  {
    "id": 10,
    "title": "todo 1",
    "desc": "string",
    "isComplete": false,
    "todoListId": 1
  },
  {
    "id": 20,
    "title": "todo 2",
    "desc": "string",
    "isComplete": false,
    "todoListId": 2
  },
  {
    "id": 30,
    "title": "todo 3",
    "desc": "string",
    "isComplete": false,
    "todoListId": 3
  }
]
  1. in the API explorer, call GET /todos with the following filter:
{
  "where": {"todoListId": 1}
}

It returns all the todo instances regardless of the todoListId.

However, if I call http://localhost:3000/todos?filter[where][todoListId]=1 from a browser, it's returning the right response.

Investigation

From @nabdelgadir.
Printing out what get passed into filter

async findTodos(
    @param.query.object('filter', getFilterSchemaFor(Todo)) filter?: Filter,
  ): Promise<Todo[]> {
    console.log(filter);
    return await this.todoRepo.find(filter);
  }

it returns undefined from the explorer but { where: { todoListId: '1' } } from the link

Current Behavior

API Explorer ignores the where filter.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions