Closed eugenesimakin closed 9 months ago
@Washubrnfg85 db schema needs to be improved (before we move to implementation).
Notes/Questions:
profile_details
and links
tablesHave some questions: Is login_email final? May it be replaced in future? It depends on user_email field in profile_details? When person register for the first time, profile initialises and login_email duplicates to profile_details.user_email and can be modified? Or they are totally different instances?
I suggest we make two tables: "users" and "user_profiles". Table "users" contains auth information and user primary id (email). Table "user_profiles" contains all profile details. Tables have one-to-one relationship on user primary id. Links for each user could be stored in one cell as JSON string (this is flexible and reasonable).
Is login_email final? May it be replaced in future?
Are you asking about naming? You could call it email
(auth) and public_email
(profile details).
It depends on user_email field in profile_details?
email
(auth) is primary id and email
(in the table "profile_details") is foreign id.
When person register for the first time, profile initialises and login_email duplicates to profile_details.user_email and can be modified?
We could do that or leave it empty.
Or they are totally different instances?
They might be different emails.
@Entity
classes based on schemaGot it. Just now making research on DB relations. Think that article should be useful: https://habr.com/ru/articles/488054/
Links for each user could be stored in one cell as JSON string (this is flexible and reasonable).
So it sort of very long string with special characters, which we use to devide one link from another? To present links in UI we'll create spetial method to make list of links from that JSON string? Same list is usefull for sharing links.
(why do we need the username? where do we use it?
I couldn't think of anything but personal appeal. "Hello, username!" or something.
The email thing.... We use login_emai for loging (obviously). I see good point in it. But why the heck we need user_email in profile?
But why the heck we need user_email in profile?
Take a look at this page of another link-sharing app - https://link-sharing-app.fly.dev/profile
Ok. We'll use this email to distribute adds and spam. Mooahaha.
Washubrnfg85:
Basic thoughts:
eugenesimakin:
Think about whole picture. You need to have:
Any ideas?
You could use a database schema diagrams service to illustrate it. For example, https://dbdiagram.io/home
Washubrnfg85:
https://dbdiagram.io/e/65722e0c56d8064ca09be431/65722f9956d8064ca09bf531