I am trying to directly map API response to my Redux-Orm models. I have two models:
Product hasMany ProductProperties
ProductProperty belongsTo Product
The API response I receive is:
{
products: [
{name: 'P1', id: 1},
{name: 'P2', id: 2}
],
product_properties: [
{name: 'Test1', id: 10, product_id: 1},
{name: 'Test2', id: 11, product_id: 1},
{name: 'Test3', id: 12, product_id: 2}
{name: 'Test4', id: 13, product_id: 2}
]
}
I can tweak the API response to match with the redux-orm.
My Question is:
I want to avoid doing ProductProperty.first().set({product: Product.first}) -- That is I don't want to set the associations (child records) explicitly and have redux-orm infer them automatically.
Is there some way I can specify the foreign key that redux-orm can look for?