diff --git a/src/main/java/me/snaptime/component/url/UrlComponentImpl.java b/src/main/java/me/snaptime/component/url/UrlComponentImpl.java index 78c81bde..600aae51 100644 --- a/src/main/java/me/snaptime/component/url/UrlComponentImpl.java +++ b/src/main/java/me/snaptime/component/url/UrlComponentImpl.java @@ -18,6 +18,6 @@ public String makePhotoURL(String fileName, boolean isEncrypted) { @Override public String makeProfileURL(Long id) { return request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort() + - "/profile_photos/"+id; + "/profile-photos/"+id; } } diff --git a/src/main/java/me/snaptime/config/SecurityConfig.java b/src/main/java/me/snaptime/config/SecurityConfig.java index 88a1f65e..61d90083 100644 --- a/src/main/java/me/snaptime/config/SecurityConfig.java +++ b/src/main/java/me/snaptime/config/SecurityConfig.java @@ -38,7 +38,7 @@ protected SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exce requests .requestMatchers("/swagger-resources/**", "/swagger-ui/index.html", "/webjars/**", "/swagger/**", "/users/exception", "/v3/api-docs/**", "/swagger-ui/**").permitAll() .requestMatchers("/users/sign-in", "/users/sign-up").permitAll() - .requestMatchers(HttpMethod.GET,"/users/profile", "/profile_photos/**","/snap/**","/friends/**").permitAll() + .requestMatchers(HttpMethod.GET,"/users/profile", "/profile-photos/**","/snap/**","/friends/**").permitAll() .requestMatchers("**exception**").permitAll() .anyRequest().hasRole("USER") ) diff --git a/src/main/java/me/snaptime/profile/repository/ProfileRepository.java b/src/main/java/me/snaptime/profile/repository/ProfileRepository.java index 65d27050..b76bc76a 100644 --- a/src/main/java/me/snaptime/profile/repository/ProfileRepository.java +++ b/src/main/java/me/snaptime/profile/repository/ProfileRepository.java @@ -1,6 +1,13 @@ package me.snaptime.profile.repository; -public interface ProfileRepository { +import me.snaptime.profile.dto.res.AlbumSnapResDto; +import me.snaptime.profile.dto.res.ProfileTagSnapResDto; +import me.snaptime.user.domain.User; - // 프로필 repo 로직을 이쪽으로 옮겨주세요. UserCustomRepository를 UserRepository와 분리하면 될거같습니다. +import java.util.List; + +public interface ProfileRepository{ + + List findAlbumSnap(User targetUser, Boolean checkPermission); + List findTagSnap(User reqUser); } diff --git a/src/main/java/me/snaptime/user/repository/impl/UserCustomRepositoryImpl.java b/src/main/java/me/snaptime/profile/repository/impl/ProfileRepositoryImpl.java similarity index 96% rename from src/main/java/me/snaptime/user/repository/impl/UserCustomRepositoryImpl.java rename to src/main/java/me/snaptime/profile/repository/impl/ProfileRepositoryImpl.java index 1edcd002..cfcd1225 100644 --- a/src/main/java/me/snaptime/user/repository/impl/UserCustomRepositoryImpl.java +++ b/src/main/java/me/snaptime/profile/repository/impl/ProfileRepositoryImpl.java @@ -1,4 +1,4 @@ -package me.snaptime.user.repository.impl; +package me.snaptime.profile.repository.impl; import com.querydsl.core.BooleanBuilder; import com.querydsl.core.Tuple; @@ -7,8 +7,8 @@ import me.snaptime.component.url.UrlComponent; import me.snaptime.profile.dto.res.AlbumSnapResDto; import me.snaptime.profile.dto.res.ProfileTagSnapResDto; +import me.snaptime.profile.repository.ProfileRepository; import me.snaptime.user.domain.User; -import me.snaptime.user.repository.UserCustomRepository; import org.springframework.stereotype.Repository; import java.util.ArrayList; @@ -24,7 +24,7 @@ @Repository @RequiredArgsConstructor -public class UserCustomRepositoryImpl implements UserCustomRepository { +public class ProfileRepositoryImpl implements ProfileRepository { private final JPAQueryFactory jpaQueryFactory; private final UrlComponent urlComponent; diff --git a/src/main/java/me/snaptime/profile/service/impl/ProfileServiceImpl.java b/src/main/java/me/snaptime/profile/service/impl/ProfileServiceImpl.java index db8adfcd..b5453d26 100644 --- a/src/main/java/me/snaptime/profile/service/impl/ProfileServiceImpl.java +++ b/src/main/java/me/snaptime/profile/service/impl/ProfileServiceImpl.java @@ -11,6 +11,7 @@ import me.snaptime.profile.dto.res.ProfileCntResDto; import me.snaptime.profile.dto.res.ProfileTagSnapResDto; import me.snaptime.profile.dto.res.UserProfileResDto; +import me.snaptime.profile.repository.ProfileRepository; import me.snaptime.profile.service.ProfileService; import me.snaptime.snap.repository.SnapRepository; import me.snaptime.user.domain.User; @@ -25,6 +26,7 @@ @Service @Transactional public class ProfileServiceImpl implements ProfileService { + private final ProfileRepository profileRepository; private final UserRepository userRepository; private final UrlComponent urlComponent; private final SnapRepository snapRepository; @@ -35,7 +37,7 @@ public class ProfileServiceImpl implements ProfileService { public List getAlbumSnap(String ownLoginId, String targetLoginId) { User targetUser = userRepository.findByLoginId(targetLoginId).orElseThrow(() -> new CustomException(ExceptionCode.USER_NOT_EXIST)); - return userRepository.findAlbumSnap(targetUser, ownLoginId.equals(targetLoginId)); + return profileRepository.findAlbumSnap(targetUser, ownLoginId.equals(targetLoginId)); } @Override @@ -74,7 +76,7 @@ public ProfileCntResDto getUserProfileCnt(String loginId) { public List getTagSnap(String loginId) { User user = userRepository.findByLoginId(loginId).orElseThrow(() -> new CustomException(ExceptionCode.USER_NOT_EXIST)); - return userRepository.findTagSnap(user); + return profileRepository.findTagSnap(user); } } diff --git a/src/main/java/me/snaptime/user/repository/UserCustomRepository.java b/src/main/java/me/snaptime/user/repository/UserCustomRepository.java deleted file mode 100644 index fc8b1a9c..00000000 --- a/src/main/java/me/snaptime/user/repository/UserCustomRepository.java +++ /dev/null @@ -1,12 +0,0 @@ -package me.snaptime.user.repository; - -import me.snaptime.profile.dto.res.AlbumSnapResDto; -import me.snaptime.profile.dto.res.ProfileTagSnapResDto; -import me.snaptime.user.domain.User; - -import java.util.List; - -public interface UserCustomRepository { - List findAlbumSnap(User targetUser, Boolean checkPermission); - List findTagSnap(User reqUser); -} diff --git a/src/main/java/me/snaptime/user/repository/UserRepository.java b/src/main/java/me/snaptime/user/repository/UserRepository.java index a7086dd9..f7a7cc03 100644 --- a/src/main/java/me/snaptime/user/repository/UserRepository.java +++ b/src/main/java/me/snaptime/user/repository/UserRepository.java @@ -7,6 +7,6 @@ import java.util.Optional; @Repository -public interface UserRepository extends JpaRepository,UserCustomRepository{ +public interface UserRepository extends JpaRepository{ Optional findByLoginId(String loginId); }