I have this items
node:
items
|
|----item_id_1
-name:
-type:
-price:
The idea is when one user gets an item, 2 things happen:
- The item gets removed from the
items
node. - The item gets added to his/her
my_items
node.
These are items that only one user can get, obviously the user that requested them first, and then they get removed.
The problem:
If multiple users requested the item at the same time, how do I handle where this item will go?
Question:
How to make sure that if multiple users requested an item at the same time, only one will get it (No One Else)?
Are Security rules able to solve this?
I am aware of Firebase Transaction operations, but not sure if they help in my case.
Any advice is appreciated.
Thanks.