Entity
Attributes
- User: email, password, username, bio, image, written_articles, followed_by, following, comments, favorites
- email should be unique (users authenticate with an email)
- username should be unique (profiles API queries a user by given username)
- Article: title, description, body, tag, author, slug, comments, favorites_count, created_at, updated_at
- Comment: created_at, updated_at, body, author
- Tag: name
Relationships
- User <-> User (follow)
- User |-> Article (write)
- User |-> Comment (write)
- User <-> Article (add to favorite)
- Article |-> Comment (be commented on)
- Article <-> Tag (tagged)
<->
means N:N relationship.
|->
means 1:N relationship.
Oh no
I don't know the differences between the User entity and the Profile entity1.
I think it's OK to store those on the same table because they deal with the same topic, the User. To present those on different APIs might be enough.