hasOne hasMany relations need foreignkey at query when filter fields has where statement to foreign table
Closed this issue · 0 comments
fasibio commented
{
queryUser(filter: {cat: {name: {eq: "Paco"}}}) {
data {
id
name
cat {
id
name
}
}
}
}
Will return error:
failed to assign association &model.Cat{ID:1, Name:\"die katz\", Age:(*int)(nil), UserID:0, Alive:false}, make sure foreign fields exists
{
queryUser(filter: {cat: {name: {eq: "Paco"}}}) {
data {
id
name
cat {
id
name
UserID # here is the new line
}
}
}
}
Will work like it should
There need some better logik inside ./runtimehelper/helper.go methode GetNestedPreloadsMap