out update validation in Bolt

Lets assume we have a data structure similar to the one below, and using fan-out update we want to convert an invitation to a user.

  • root
  • users
  • KC88nKzEqsx6AlPjrvp
  • email : test1@yahoo.com
  • uid: 19570b6c-afd0-xxxx-xxxx-650be04c5767
  • KCAW6T_au2ROnJcaf85
  • email : test2@yahoo.com
  • uid: 22570b6c-afd0-xxxx-xxxx-650be04c5767
  • invitations
  • KCZndfnKzEqrtr6AlPjrvp
  • email : test3@yahoo.com
  • BYYAW6T_au2Rffeaf85
  • email : test4@yahoo.com
  • Update code:

    var update = {}
    update[‘invitations/KCZndfnKzEqrtr6AlPjrvp’] = null
    update[‘users/DDd83sx6AlPjrvp’] = {email:test3@yahoo.com, uid: 773492-afd0-344-4535-650be04c5767}
    
    ref.update(update);
    

    How can i write validate rules in Bolt, that will check if:

  • Invitation for such email existed.
  • The newly created user email is equal to email on invitation
  • User uid is his actual id from auth object.
  • 链接地址: http://www.djcxy.com/p/84214.html

    上一篇: 如何防止用户名在Firebase中重复注册?

    下一篇: 在博尔特进行更新验证