Skip to content

Commit

Permalink
KKUMI-118 [FEATURE] #73 좋아요 테이블 Unique 조건 추가
Browse files Browse the repository at this point in the history
post_id, user_id로 unique 제약조건을 추가했습니다.
유저가 게시글에 좋아요를 처음누른다면 생성되고, 취소한다면 isDeleted가 true로 변하고, 다시 좋아요를 누르면 isDeleted가 false로 변하도록 했습니다.
눌렀다가 취소했다가를 빠르게 반복할 수 있기에 매번 생성되고 삭제되지 않도록 만들었습니다.
  • Loading branch information
eekrwl committed Oct 7, 2024
1 parent c357d4a commit b36c94a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/java/com/swmarastro/mykkumiserver/like/Likes.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor(access = AccessLevel.PROTECTED)
@Table(name = "likes", uniqueConstraints = {
@UniqueConstraint(columnNames = {"post_id", "user_id"})
})
public class Likes extends BaseEntity {

@Id
Expand Down

0 comments on commit b36c94a

Please sign in to comment.