-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
Description
Description
In the API Explorer, the where filter is being ignored.
Steps to reproduce
Using todo-list example,
- create todolist with ids 1, 2, and 3.
- 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
}
]
- in the API explorer, call
GET /todoswith 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.