Skip to content

Commit

Permalink
fix: delete 메서드에 clearAutomatically 속성 제거 및 flush 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
junpakPark committed Sep 18, 2023
1 parent bd946c3 commit 20113c8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ public LoginTokens issueTokens(Long memberId) {
refreshTokenRepository.findByMemberId(memberId)
.ifPresent(refreshTokenRepository::delete);

refreshTokenRepository.flush();

refreshTokenRepository.save(new RefreshToken(refreshToken, memberId));

return new LoginTokens(accessToken, refreshToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,11 @@

import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;

public interface RefreshTokenRepository extends JpaRepository<RefreshToken, String> {

Optional<RefreshToken> findByMemberId(Long memberId);

void deleteByMemberId(Long memberId);

@Modifying(clearAutomatically = true)
void delete(RefreshToken token);

}

0 comments on commit 20113c8

Please sign in to comment.