Skip to content

Commit

Permalink
[#3]♻️Feat: LoginUser의 memberId로 가져오기
Browse files Browse the repository at this point in the history
  • Loading branch information
sumin220 committed Nov 20, 2024
1 parent 370b607 commit f125ca8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class MemberController {
@PostMapping("/saveAdditionalInfo")
public void saveAdditionalInfo(@User LoginUser loginUser, @Valid @RequestBody MemberSignUpDTO memberSignUpDTO) throws Exception {
Long memberId = loginUser.getMemberId();
memberService.saveAdditionalInfo(memberSignUpDTO, memberId);
memberService.saveAdditionalInfo(memberId, memberSignUpDTO);
}

/**
Expand All @@ -40,8 +40,9 @@ public void saveAdditionalInfo(@User LoginUser loginUser, @Valid @RequestBody Me
@PutMapping
@Operation(summary = "회원 정보 수정", description = "회원 정보를 수정합니다.")
@ResponseStatus(HttpStatus.OK)
public void updateInfo(@Valid @RequestBody MemberUpdateDTO memberUpdateDTO) throws Exception {
memberService.updateInfo(memberUpdateDTO);
public void updateInfo(@User LoginUser loginUser, @Valid @RequestBody MemberUpdateDTO memberUpdateDTO) throws Exception {
Long memberId = loginUser.getMemberId();
memberService.updateInfo(memberId, memberUpdateDTO);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public interface MemberService {
/**
* 추가 정보 수집
*/
void saveAdditionalInfo(MemberSignUpDTO dto, Long memberId) throws Exception;
void saveAdditionalInfo(Long memberId, MemberSignUpDTO dto) throws Exception;

/**
* 첫 로그인 확인
Expand All @@ -26,7 +26,7 @@ public interface MemberService {
/**
* 회원 정보 수정
*/
void updateInfo(MemberUpdateDTO dto) throws Exception;
void updateInfo(Long memberId, MemberUpdateDTO dto) throws Exception;

/**
* 내 정보 조회
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class MemberServiceImpl implements MemberService {
private final MemberRepository memberRepository;

@Override
public void saveAdditionalInfo(MemberSignUpDTO memberSignUpDTO, Long memberId) throws Exception {
public void saveAdditionalInfo(Long memberId, MemberSignUpDTO memberSignUpDTO) throws Exception {

if (memberId == null) {
throw new IllegalArgumentException("회원 ID가 null입니다. 인증 정보를 확인하세요.");
Expand Down Expand Up @@ -68,7 +68,7 @@ public void withdraw(Long memberId, MemberWithdrawDTO memberWithdrawDTO) throws
}

@Override
public void updateInfo(MemberUpdateDTO memberUpdateDTO) throws Exception {
public void updateInfo(Long memberId, MemberUpdateDTO memberUpdateDTO) throws Exception {

Member member = memberRepository.getByUsernameOrThrow(SecurityUtil.getLoginUsername());

Expand Down

0 comments on commit f125ca8

Please sign in to comment.