Skip to content

Commit

Permalink
[refac] divide method responsibility
Browse files Browse the repository at this point in the history
  • Loading branch information
kgy1008 committed Jul 12, 2024
1 parent 94c3af0 commit 0a5cad1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ private void saveStoreHeart(final Long userId, final Long storeId) {
}

private void increaseStoreHeartCount(final Long storeId) {
storeFinder.getStore(storeId).updateHeartCount(false);
storeFinder.getStore(storeId).increaseHeartCount();
}

private void decreaseStoreHeartCount(final Long storeId) {
storeFinder.getStore(storeId).updateHeartCount(true);
storeFinder.getStore(storeId).decreaseHeartCount();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,11 @@ public class Store extends BaseTimeEntity {
@Column(nullable = false)
private boolean isDeleted;

public void updateHeartCount(boolean isDeleted) {
if (isDeleted) {
heartCount--;
}
else {
heartCount++;
}
public void decreaseHeartCount() {
heartCount--;
}

public void increaseHeartCount() {
heartCount++;
}
}

0 comments on commit 0a5cad1

Please sign in to comment.