Nested entities with different interfaces example needed
sheikalthaf opened this issue · 5 comments
I want to how ngrx handles nested entities with different entities. This will be very useful to understand entities handling
Nice idea, I can make an exercice around this idea
Do you have exemple of issue you are struggling with ?
For instance, I come up with the following use case (don't know if it is exactly what the issue is meant):
- A process interface with several subtypes which share some common properties but has a different one mapped to a correspondent interface (i.e: Data).
As an example, a Process which has id, type and data. Id and type are shared (actually, type is the way to differentiate the data property type), but data is type of T, different per type.
So, the structure in state would be the following:
"process": {
"p1": {
"id": "p1",
"type": "type1",
"data": { "name": 'test' }
},
"p2": {
"id": "p2",
"type": "type2",
"data": { "telephone": 6788765 }
}
}
I'm sorry, but I don't understand how you end up with that data in the store. I need a use case to have a better understanding.
I understand that you might need it this way in your template but how did you retrieve this data from your backend ? How does it look like in your DB ?
@tomalaforge sorry for the late reply, I can final spent some time on what i have initially asked,
You can review the code and usage of ngrx https://github.com/sheikalthaf/angular-tree
It is still incomplete, will add CRUD operation