I use firebase realtime as database for my app and off course i used rules to secure my data so more node database then more rules and now have a big code inside it
my question is about how to define function to make my rules more readable and make it less code
I would to get like this
"rules": {
function isMerchant(auth){
return "root.child('Merchant').child(auth.token.phone_number).exists()";
}
"UsersMetaData" :{
"HistoryMarketVisit":{
"$visitId":{
".read" : isMerchant(auth),
".write" : isMerchant(auth),
}
},
},
},
i see this answer for same question but is for firestore , but want to achieve it in firebase real time
thanks for help