From 1fe44ad7e9705f86c917181fa9bb2143030ea6af Mon Sep 17 00:00:00 2001 From: yang Date: Wed, 29 May 2024 17:46:31 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20MemerService=20=EB=B0=8F=20JoinServ?= =?UTF-8?q?ice=20Trasactional=20=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sanbosillokserver/api/member/service/JoinService.java | 3 +++ .../sanbosillokserver/api/member/service/MemberService.java | 1 + 2 files changed, 4 insertions(+) diff --git a/src/main/java/com/sanbosillok/sanbosillokserver/api/member/service/JoinService.java b/src/main/java/com/sanbosillok/sanbosillokserver/api/member/service/JoinService.java index b57eb95..b4eb5a2 100644 --- a/src/main/java/com/sanbosillok/sanbosillokserver/api/member/service/JoinService.java +++ b/src/main/java/com/sanbosillok/sanbosillokserver/api/member/service/JoinService.java @@ -10,14 +10,17 @@ import lombok.RequiredArgsConstructor; import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; @Service @RequiredArgsConstructor +@Transactional(readOnly = true) public class JoinService { private final MemberRepository memberRepository; private final ImageService imageService; private final BCryptPasswordEncoder bCryptPasswordEncoder; + @Transactional public void join(JoinRequest joinRequest) { if (!memberRepository.existsByUsername(joinRequest.getUsername())) { diff --git a/src/main/java/com/sanbosillok/sanbosillokserver/api/member/service/MemberService.java b/src/main/java/com/sanbosillok/sanbosillokserver/api/member/service/MemberService.java index c2fb09d..5572fb4 100644 --- a/src/main/java/com/sanbosillok/sanbosillokserver/api/member/service/MemberService.java +++ b/src/main/java/com/sanbosillok/sanbosillokserver/api/member/service/MemberService.java @@ -24,6 +24,7 @@ public List getInactiveMembers() { .collect(Collectors.toList()); } + @Transactional public void activateMember(Long id) { Member member = memberRepository.findById(id) .orElseThrow(() -> new IllegalArgumentException("해당 회원 가입 신청이 존재하지 않습니다."));