Getting relations using filtering strategy
antonkomarev opened this issue · 2 comments
antonkomarev commented
Project.find('1').then(project => {
project.tasks().all();
});
This code produces query: /projects/1/tasks
But I need to utilize filters instead:
/tasks?filter[project][type]=Project&filter[project][id]=1
Is there is an easy way to do it?
nicklandgrebe commented
project.tasks().where({ project: { type: 'Project', id: '1' }})
Though why, if you are requesting /projects/1
, do you need to specify the project id? Or the type for that matter?
antonkomarev commented
I don't need to have /projects/1
in my URI.
My URI: http://localhost/tasks?filter[project][type]=Project&filter[project][id]=1