Skip to content

Commit

Permalink
[Merge] main <- hyungjun url 컴포넌트 경로 수정, repository 수정
Browse files Browse the repository at this point in the history
[Fix] url 컴포넌트 profilephoto 경로 수정, repsitory 경로 수정
  • Loading branch information
sukangpunch authored Jul 17, 2024
2 parents 2e5e5cd + 568f969 commit 2137652
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
2 changes: 1 addition & 1 deletion src/main/java/me/snaptime/config/SecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -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")
)
Expand Down
Original file line number Diff line number Diff line change
@@ -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<AlbumSnapResDto> findAlbumSnap(User targetUser, Boolean checkPermission);
List<ProfileTagSnapResDto> findTagSnap(User reqUser);
}
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand All @@ -24,7 +24,7 @@

@Repository
@RequiredArgsConstructor
public class UserCustomRepositoryImpl implements UserCustomRepository {
public class ProfileRepositoryImpl implements ProfileRepository {

private final JPAQueryFactory jpaQueryFactory;
private final UrlComponent urlComponent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -35,7 +37,7 @@ public class ProfileServiceImpl implements ProfileService {
public List<AlbumSnapResDto> 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
Expand Down Expand Up @@ -74,7 +76,7 @@ public ProfileCntResDto getUserProfileCnt(String loginId) {
public List<ProfileTagSnapResDto> getTagSnap(String loginId) {
User user = userRepository.findByLoginId(loginId).orElseThrow(() -> new CustomException(ExceptionCode.USER_NOT_EXIST));

return userRepository.findTagSnap(user);
return profileRepository.findTagSnap(user);
}

}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
import java.util.Optional;

@Repository
public interface UserRepository extends JpaRepository<User,Long>,UserCustomRepository{
public interface UserRepository extends JpaRepository<User,Long>{
Optional<User> findByLoginId(String loginId);
}

0 comments on commit 2137652

Please sign in to comment.