Simon
Simon

Reputation: 2538

Firebase - Best way to structure user posts and posts to a feed

Here is my scenario that I need help with. I have a "feed" for a specific location that has posts. posts are created by users and anyone can see a post from a specific location.

So essentially: user writes post -> gets submitted to location -> user can also view their own posts on their profile -> anyone can view posts from a location.

So here is the way I thought it was best to structure:

enter image description here

(sorry if the syntax is bad I'm just playing around at the moment). So essentially, I would send ALL post data that the user created to the location AND the user's profile.. Is that bad practice? Doubling the size of the db as well as keeping both posts up to date.. If the score (i.e upvoting/downvoting) changes for the post I would have to update in both sections...

Is there a better way? Please let me know! Thank you.

Upvotes: 0

Views: 634

Answers (1)

LJ01
LJ01

Reputation: 589

If I understand your requirement correctly, you should have a table for posts, a table for users and a table for locations.

A post is written by a user who assigns it to a location.

Upvotes: 1

Related Questions