I've been working on a blogging app for my personal website, and I want to only allow myself to post new blog posts, but allow all the logged in users to add comments to the posts.
Here is currently how a data looks like:
"posts": {
"-KpZlH9PYs7mAf8avBmI" : {
"comments" : {
"-KpZwWIrbM3JQ2ug1c5_" : {
"message" : "How are you today?",
"timestamp" : 1500637173055,
"user" : "Florin Pop"
},
"-KpZyxoC0OTxnDZymP-M" : {
"message" : "I'm fine, thank you!",
"timestamp" : 1500637814102,
"user" : "Florin Pop"
}
},
"likes" : 0,
"text" : "asxszx",
"timestamp" : 1500634227427,
"title" : "qwqew"
}
}
As you can see a post has: a list of comments, likes, text, timestamp and title.
I'm not sure if the structure is the best for what I want.
Is there way I can check if I'm the currently logged in user and only then allow for creating a new post?
Should I have the comments separately?
P.S.
Currently my database rules are:
{
"rules": {
".read": true,
".write": "auth != null"
}
}