Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] url 컴포넌트 profilephoto 경로 수정, repsitory 경로 수정 #109

Merged
merged 1 commit into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
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 @@ -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);
}
Loading