Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.springframework.security.core.Authentication;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import EatPic.spring.global.aws.s3.*;
Expand All @@ -40,7 +41,7 @@
import static EatPic.spring.global.common.code.status.ErrorStatus.*;

@Service
@Transactional
@Transactional(readOnly = true)
@RequiredArgsConstructor
public class UserServiceImpl implements UserService{

Expand All @@ -57,6 +58,7 @@ public class UserServiceImpl implements UserService{
private final AmazonS3Manager s3Manager;

// 회원가입
@Transactional(readOnly = false)
public SignupResponseDTO signup(SignupRequestDTO request) {
// 이메일 중복 검사
if (userRepository.existsByEmail(request.getEmail())) {
Expand Down Expand Up @@ -96,6 +98,7 @@ public SignupResponseDTO signup(SignupRequestDTO request) {

// 로그인
@Override
@Transactional(readOnly = false)
public LoginResponseDTO loginUser(LoginRequestDTO request){
User user = userRepository.findByEmail(request.getEmail())
.orElseThrow(()-> new ExceptionHandler(ErrorStatus.MEMBER_NOT_FOUND));
Expand Down Expand Up @@ -247,6 +250,7 @@ public boolean isNicknameDuplicate(String nickname) {
}

@Override
@Transactional(propagation = Propagation.REQUIRES_NEW, readOnly = false)
public User getLoginUser(HttpServletRequest request) {
Authentication authentication = jwtTokenProvider.extractAuthentication(request);
String email = authentication.getName();
Expand All @@ -269,6 +273,7 @@ public UserResponseDTO.DetailProfileDto getProfile(HttpServletRequest request, L
}

@Override
@Transactional(readOnly = false)
public UserResponseDTO.UserActionResponseDto unfollowUser(HttpServletRequest request, Long targetUserId) {
User user = getLoginUser(request);
User target = userRepository.findUserById(targetUserId);
Expand All @@ -284,6 +289,7 @@ public UserResponseDTO.UserActionResponseDto unfollowUser(HttpServletRequest req
}

@Override
@Transactional(readOnly = false)
public UserResponseDTO.UserActionResponseDto followUser(HttpServletRequest request, Long targetUserId) {
User user = getLoginUser(request);
if(user.getId().equals(targetUserId)) {
Expand All @@ -306,6 +312,7 @@ public UserResponseDTO.UserActionResponseDto followUser(HttpServletRequest reque

// 유저 프로필 이미지 업데이트
@Override
@Transactional(readOnly = false)
public UserResponseDTO.ProfileDto updateUserProfileImage(HttpServletRequest request, MultipartFile profileImage,User user) {

String profileImageUrl = null;
Expand Down Expand Up @@ -335,6 +342,7 @@ public UserResponseDTO.ProfileDto updateUserProfileImage(HttpServletRequest requ

// 유저 소개 업데이트
@Override
@Transactional(readOnly = false)
public UserResponseDTO.ProfileDto updateIntroduce(HttpServletRequest request, UserRequest.UpdateUserInroduceRequest introduce, User user) {

user.setIntroduce(introduce.getIntroduce()); // introduce 부분만 변경
Expand Down
Loading