What would you do, if you had a normalized redux store and using ids for entities, but also have other additional unique identifiers and need to use them as well.
Example
{
entities: {
users: {
1: {
name: 'foo',
id: 1, //unique
uuid: '3d89afe9-6a85-46ed-ac0d-28e10b21d09e' // unique
},
// ...
}
}
}
Most of the I'm using id
property to find an entity, but sometimes i just have the uuid
property.
Is there a way to use a more advanced schema to have a second dictionary which maps uuid
to id
, use es6 Map to have a key which consists of both id
and uuid
or some other way i didnt think of?
Following would be useful:
{
entities: {
users: {
1: {
name: 'foo',
id: 1, //unique
uuid: '3d89afe9-6a85-46ed-ac0d-28e10b21d09e' // unique
},
// ...
}
usersUuidToIdMapping: {
'3d89afe9-6a85-46ed-ac0d-28e10b21d09e': 1
// ...
}
}
}
Best, Faruk