简体   繁体   中英

How to Allow only one user per referral code in flutter firestore?

I am builing a flutter firestore app in which I want to be able to send a referral code to a new user and per referral code only one new user should be able to join.

Please tell me how can I implement this in in flutter app.

Thanks.

You can generate them with function you like, store them as documents in separate collection (document name is referral code - this will give you uniqueness of codes) then when user uses it you write his auth id in special field. Then in security rules you make rules that field may be updated only if there is no id there already.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM