I'm developing simple chat app with Vue and Firebase. I'm struggling with getting data as I want.
I will have data structure roughly like this:
{
user:{
id:{
.......
}
},
chats:{
id:{
......
},
members:{
chatId:{
userId:{
......
}
}
}
}
I wonder how to know if there is chat exist between users. I want to know if there is function that gets chat id(between user A and B) with parameters(user A and B ids).
For instance, when there is chat between user A and B, data would be like this:
{
user:{
A:{...}, B:{...}
},
chat:{
chatBetweenAandB:{...}
},
members:{
chatBetweenAandB:{
A:{...}, B:{...}
}
},
}
In this case, how can I find chatBetweenAandB with parameters A and B?