-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
19ec3fa
commit 6f1857f
Showing
3 changed files
with
34 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/java/com/taba/nimonaemo/member/service/MemberWithdrawService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.taba.nimonaemo.member.service; | ||
|
||
import com.taba.nimonaemo.member.exception.UserNotFoundException; | ||
import com.taba.nimonaemo.member.model.MemberStatus; | ||
import com.taba.nimonaemo.member.model.entity.Member; | ||
import com.taba.nimonaemo.member.repository.MemberRepository; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.transaction.annotation.Transactional; | ||
|
||
@Service | ||
@RequiredArgsConstructor | ||
@Transactional(readOnly = true) | ||
public class MemberWithdrawService { | ||
private final MemberRepository memberRepository; | ||
|
||
@Transactional | ||
public void withdraw(Long userId) { | ||
Member member = memberRepository.findById(userId).orElseThrow(UserNotFoundException::new); | ||
member.changeStatus(MemberStatus.INACTIVE); | ||
} | ||
} |