Closed Vince-Ku closed 11 months ago
@asdfg429 if you are interested in this feature, welcome to join me.
@shadow3x3x3
These tables are designed according to the requirement from the Explore
module in iOS, please help to review.
@KaoWeiCheng @asdfg429 please take a look if available, welcome to join me.
@Vince-Ku
int id ,
varchar category,-- theme/products/discount....etc,
int referance_id, -- like products.id=1 than record 1 theme.id = 3 than record 3,
int sort
images location is {root}/{category}/{id}/{sort}.jpg (ex:products/2/3.jpg) but first we should put images at right dir LOL
@asdfg429
- Could upload a picture or something else to point out how you use these tables?
Uploading pictures and making a description of the usage of APIs is a quite large effort, maybe we discuss this in the meeting this week? it would be more straightforward.
The requirements are based on those APIs we've discussed in the previous few meetings. Board, Theme Distrubutor
2 I'm not sure is good or not. If images will be saved in local machine, should us created a table for record these images? Like
int id , varchar category,-- theme/products/discount....etc, int referance_id, -- like products.id=1 than record 1 theme.id = 3 than record 3, int sort
images location is {root}/{category}/{id}/{sort}.jpg (ex:products/2/3.jpg) but first we should put images at right dir LOL
That sounds great, BTW, we could also consider setting up an independent server specifically to handle image requests.
First, thanks for creating these visualized tables using Mermaid. This will be very helpful for discussions.
However, I still have some suggestions for your reference.
Old | New |
---|---|
```mermaid erDiagram Board { int id string code string image_url string action date created_date date updated_date } ``` | ```mermaid erDiagram Board { int id string code string image_url string link_type string link date created_date date updated_date } ``` |
I separated the action
into two columns, link_type
and link
.
link_type
: It used to indicate the type of the link, which can be deep link
, universal link
or web link
link
: The link value to the board. e.g. "orange://main_page"Therefore, the multiple type of links can be stored in the same table.
I am OK with the theme
table.
I am OK with the Distributor
table.
I recommend to use priority
instead of sort
as the table and column name.
Old | New |
---|---|
```mermaid erDiagram user_like_distributors { int id int distributor_id int user_id boolean like date created_date date updated_date } ``` | ```mermaid erDiagram user_like_distributors { int distributor_id int user_id date created_date } ``` |
I removed id
, like
, updated_date
columns for the following reasons:
id
: The primary key can be (distributor_id, user_id)
.like
: The existence of a record in the table means the distributor is liked by the user.updated_date
: The table only stores the creation date (like date) of the record.btw, I fixed the table name to user_like_distributors
.
How do you feel about this?
Board
Old New
erDiagram Board { int id string code string image_url string action date created_date date updated_date }
erDiagram Board { int id string code string image_url string link_type string link date created_date date updated_date }
I separated the
action
into two columns,link_type
andlink
.
link_type
: It used to indicate the type of the link, which can bedeep link
,universal link
orweb link
link
: The link value to the board. e.q. "orange://main_page"Therefore, the multiple type of links can be stored in the same table.
Separating into two columns is great.
How about we retain the term action
? (e.g. action_type, action) to ensure future extensibility, except for links, there are various behaviors that might happen in iOS, such as executing javascript
, presenting alerts
, and more.
Product Sort
I recommend to use
priority
instead ofsort
as the table and column name.
Sure.
Distributor_User_Like
Old New
erDiagram user_like_distributors { int id int distributor_id int user_id boolean like date created_date date updated_date }
erDiagram user_like_distributors { int distributor_id int user_id date created_date }
I removed
id
,like
,updated_date
columns for the following reasons:
id
: The primary key can be(distributor_id, user_id)
.
Agree.
like
: The existence of a record in the table means the distributor is liked by the user.updated_date
: The table only stores the creation date (like date) of the record.
The reason that I retain the column like
is only for the record, allowing us to potentially analyze user behavior in the future.
Do you think so?
if we want to do so, would it be more practical to split into two tables user_like_distributors
, user_like_distributors_log
?
then user_like_distributors
is able to delete the column like
and updated_date
.
btw, I fixed the table name to
user_like_distributors
.How do you feel about this?
The like behavior is created by the user instead of the distributor, I think your naming is better !!
Separating into two columns is great. How about we retain the term action? (e.g. action_type, action) to ensure future extensibility, except for links, there are various behaviors that might happen in iOS, such as executing javascript, presenting alerts, and more.
Sure. It makes sense.
The reason that I retain the column like is only for the record, allowing us to potentially analyze user behavior in the future. Do you think so?
if we want to do so, would it be more practical to split into two tables user_like_distributors, user_like_distributors_log ? then user_like_distributors is able to delete the column like and updated_date.
Yeah. Sepearating to Query and Log tables would be more KISS. Otherwise, there would be two situations can represent dislike, non-exists column and like
is false.
All are updated, please check.
All are updated, please check.
So far so good. 🚀
I'll keep this issue in the Review
status until the next meeting.
@KaoWeiCheng @asdfg429 If you guys want to join the discussion or have any questions or suggestions, feel free to leave a message :D ~
@Vince-Ku The columns "created_at" and "updated_at" in the DB table "boards" correspond to "created_date" and "updated_date" mentioned in the documentation. My program currently prioritizes the table's columns, so if any changes are needed, please let me know. Thank you.
Feature
Design the table format in the database.
Board
Example Data:
Theme
Example Data:
Distributor
Example Data :
Product_Priority
Example Data :
User_Like_Distributor, User_Like_Distributor_Log
Example Data for User_Like_Distributor :
Example Data for User_Like_Distributor_Log :
APIs Reference
Board, Theme Distributor Product related