Querying relations/associations #35
Labels
No Label
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: thereadme/hapi-sequelize-crud#35
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I have 2 models:
Association is:
The problem is:
When i try to GET
/api/v1/products?name[category]=Category 1
it outputs val.replace is not a function errorBut according to sequelize documentation on here, the way of querying relations/associations is by using its include parameter and then append its where parameter inside.
Maybe you could allow the current include parameter to accept object kind of:
include[]={model: 'category', where:{name: 'Category 1'}}
?@labibramadhan hmmm… the latter suggestion,
?include[]={"model": "category", "where":{"name": "Category 1"}}
should work. Just make sure you're sending valid JSON. Let me know if it doesn't work!@joeybaker, as i've mentioned, i think it doesn't work. seems like include parameter only accepts string or array of string
@labibramadhan ah! that makes sense. It should accept an array of JSON strings and doesn't.
alright, i have created PR, please review @joeybaker