Skip to content

Commit

Permalink
[ fix ] Apply transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
Minuooooo committed Aug 21, 2023
1 parent ce2f73d commit e89e03d
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import greeny.backend.exception.situation.SelfLikeNotAllowedException;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Optional;

Expand All @@ -21,6 +22,8 @@ public class PostLikeService {
private final PostRepository postRepository;

// 좋아요 or 취소

@Transactional
public void togglePostLike(Long postId, Member liker) {
Optional<PostLike> postLike = postLikeRepository.findByPostIdAndLikerId(postId, liker.getId());
// 이미 좋아요 눌렀는지 확인
Expand Down

0 comments on commit e89e03d

Please sign in to comment.