Hi,
I am a newbie in cloud-firestrore and trying to find the optimal design for the following case.
I have 5 entities
The only limitation I got is that HistoryData can contain only the device_id as a link to other entities because it will be sent by a real device which will have this value hard-coded in the hardware and will login with an account and have only write access on that collection.
For the rest of the entities the I do not mind if they will all be different collections or sub collections.
What I need to achieve is that read access to HistoryData records should have
I believe that it would be possible to write a rule that from HistoryData would get the device_id, find the customer that belongs to and collect his users and then get the customer reseller and collect his users and finally check if the reader belongs to one of them.
But it really sounds like a very bad design. So, I am asking for advice if there is a better way to achieve that.
Special thanks to whoever has the kindness and the willing to provide advice.
Hello KK,
Thank you for posting this here. I believe the Google Cloud Community is intended to answer more general questions regarding the Google Cloud Platform. To suggest a better solution for your use case, I believe the best place to get help for this issue is likely to be Stack Overflow including the proper tag [google-cloud-firestore] on it. This will allow more user to reach the post and could be helpful for you to find some better solutions.
For more information about the data structure in firestore, this documentation might be helpful for your use case. Also security rules V2 might be useful when you are trying to restrict some documents from access.
I hope it helps.