amezenin / encyclopedia-kn

0 stars 0 forks source link

Why did you create this entity? what do you mean by status? is it for example 'like' and 'dislike'? you could have just created a 'likes' inside article itself #3

Open vahid-forghani opened 2 years ago

vahid-forghani commented 2 years ago

https://github.com/amezenin/encyclopedia-kn/blob/c71915518d43bdb8942f420fb19acd7cd83ed6c5/src/main/java/com/knits/product/model/VoteArticle.java#L14

it can be done like:

@ManyToMany
List<User> likes;

in manyToMany case there is gonna be a middle table which holds user_id, article_id so if you also wanna keep other information you can have them inside this table

amezenin commented 2 years ago

https://github.com/amezenin/encyclopedia-kn/blob/c71915518d43bdb8942f420fb19acd7cd83ed6c5/src/main/java/com/knits/product/model/VoteArticle.java#L14

it can be done like:

@ManyToMany
List<User> likes;

in manyToMany case there is gonna be a middle table which holds user_id, article_id so if you also wanna keep other information you can have them inside this table

there is information when the like was created. I always use one-to-many tables instead of many to many because I don't know what data might appear in the middle table. if necessary i can change to many to many

amezenin commented 2 years ago

Fixed