I haven’t used dataloader yet but am trying to understand step by step each part.
Currently, I’m successfully getting an association with products, such as store information they belong to.
object :product do
field(:id, non_null(:id))
field(:product_name, non_null(:string))
field(:product_description, non_null(:string))
field(:product_price, non_null(:decimal))
field(:product_type, non_null(:integer))
field(:is_returnable, non_null(:boolean))
field(:store, :store_obj)
end
This associated is working since in the Schema we have belongs_to(:store, Hunters.Stores.Store)
and
def get_store!(id) do
Repo.get!(Store, id)
|> Repo.preload([:user])
end
What I would like to understand is how could I go a step further? or would this be something advised not to do? Like for example if I wanted
Product {
Store {
StoreOwner
}
}
When I tried adding user information within the :store object I’m getting null. How would we preload something that isn’t associated with product?
Thank you for the advice and learning how this is done.