[회원 서비스 개선] MemberService와 MemberServiceImpl에서 updateMember 및 deleteRefreshToken 메서드의 반환 타입을 void로 변경하고, 메서드 순서를 정리하여 코드 가독성을 향상시킴.
This commit is contained in:
@@ -1,13 +1,13 @@
|
|||||||
package com.bio.bio_backend.domain.base.member.service;
|
package com.bio.bio_backend.domain.base.member.service;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.springframework.security.core.userdetails.UserDetails;
|
import org.springframework.security.core.userdetails.UserDetails;
|
||||||
import org.springframework.security.core.userdetails.UserDetailsService;
|
import org.springframework.security.core.userdetails.UserDetailsService;
|
||||||
|
|
||||||
import com.bio.bio_backend.domain.base.member.dto.MemberDto;
|
import com.bio.bio_backend.domain.base.member.dto.MemberDto;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public interface MemberService extends UserDetailsService {
|
public interface MemberService extends UserDetailsService {
|
||||||
|
|
||||||
UserDetails loadUserByUsername(String id);
|
UserDetails loadUserByUsername(String id);
|
||||||
@@ -16,9 +16,9 @@ public interface MemberService extends UserDetailsService {
|
|||||||
|
|
||||||
String getRefreshToken(String id);
|
String getRefreshToken(String id);
|
||||||
|
|
||||||
int deleteRefreshToken(String id);
|
void deleteRefreshToken(String id);
|
||||||
|
|
||||||
|
void updateMember(MemberDto member);
|
||||||
|
|
||||||
List<MemberDto> selectMemberList(Map<String, String> params);
|
List<MemberDto> selectMemberList(Map<String, String> params);
|
||||||
|
|
||||||
int updateMember(MemberDto member);
|
|
||||||
}
|
}
|
||||||
|
@@ -63,13 +63,12 @@ public class MemberServiceImpl implements MemberService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public int updateMember(MemberDto memberDto) {
|
public void updateMember(MemberDto memberDto) {
|
||||||
Member member = memberRepository.findActiveMemberByUserId(memberDto.getUserId())
|
Member member = memberRepository.findActiveMemberByUserId(memberDto.getUserId())
|
||||||
.orElseThrow(() -> new ApiException(ApiResponseCode.USER_NOT_FOUND));
|
.orElseThrow(() -> new ApiException(ApiResponseCode.USER_NOT_FOUND));
|
||||||
|
|
||||||
memberMapper.updateMemberFromDto(memberDto, member);
|
memberMapper.updateMemberFromDto(memberDto, member);
|
||||||
memberRepository.save(member);
|
memberRepository.save(member);
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -82,13 +81,12 @@ public class MemberServiceImpl implements MemberService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
public int deleteRefreshToken(String id) {
|
public void deleteRefreshToken(String id) {
|
||||||
Member member = memberRepository.findActiveMemberByUserId(id)
|
Member member = memberRepository.findActiveMemberByUserId(id)
|
||||||
.orElseThrow(() -> new ApiException(ApiResponseCode.USER_NOT_FOUND));
|
.orElseThrow(() -> new ApiException(ApiResponseCode.USER_NOT_FOUND));
|
||||||
|
|
||||||
member.setRefreshToken(null);
|
member.setRefreshToken(null);
|
||||||
memberRepository.save(member);
|
memberRepository.save(member);
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Reference in New Issue
Block a user