Skip to content

Commit

Permalink
[refactor] @Trasactional 정리 #54
Browse files Browse the repository at this point in the history
[refactor] @Trasactional 정리
  • Loading branch information
yangchef1 authored May 29, 2024
2 parents 9636285 + 1fe44ad commit fb0ad55
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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())) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public List<MemberResponse> getInactiveMembers() {
.collect(Collectors.toList());
}

@Transactional
public void activateMember(Long id) {
Member member = memberRepository.findById(id)
.orElseThrow(() -> new IllegalArgumentException("해당 회원 가입 신청이 존재하지 않습니다."));
Expand Down

0 comments on commit fb0ad55

Please sign in to comment.