-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feat/#464 이미지 s3 도입 #479
The head ref may contain hidden characters: "feat/#464_\uC774\uBBF8\uC9C0_s3_\uB3C4\uC785"
Feat/#464 이미지 s3 도입 #479
Conversation
# Conflicts: # backend/src/main/resources/application-prod.properties
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Override | ||
public void delete(final String imagePath) { | ||
throw new BusinessLogicException(UNSUPPORTED_METHOD_CALL); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
뭔가 상태패턴 보는 것 같고 좋네요 이리내! 👍🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생하셨습니다. 이리 저리 내🙇♂️
답글을 남겨주신다면 어프로브를 드리겠습니다.
backend/src/main/java/edonymyeon/backend/image/application/ImageService.java
Show resolved
Hide resolved
backend/src/main/java/edonymyeon/backend/image/application/ImageService.java
Show resolved
Hide resolved
|
||
@Override | ||
public void migrate(final File image, final String directory, final String storeName) { | ||
System.out.println("아무것도 안하지롱"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이리내 같네요 🚽
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🫵
|
||
@RequiredArgsConstructor | ||
@Service | ||
public class ImageMigrationService { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 서비스는 migration 끝나면 제거할건가유?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
핫픽스 해야되지 않을까욤
@@ -12,4 +12,7 @@ public interface CommentImageInfoRepository extends JpaRepository<CommentImageIn | |||
@Modifying //todo: 옵션.. 이대로 괜찮은가? | |||
@Query("update CommentImageInfo c set c.deleted = true where c.id in :ids") | |||
void deleteAllById(@Param("ids") List<Long> ids); | |||
|
|||
@Query(value = "select * from comment_image_info", nativeQuery = true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
혹시 이거 findAll()을 안쓰고 native Query를 사용하는 이유 알려주실 수 있나염?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JPARepo를 사용하면 삭제된 이미지는 where절에서 걸려서 조회 안되서 긍듯여
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오홍 그렇고만요 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이리내상 ~~ 로컬에서는 잘 돌아가는 거 확인했습니다,,,
실 서버에서는.... 힘들어서...스루ㅜㅜ
깔끔하게 잘 구현해주셨습니다 !! 수고 많으셨어여!!!
|
||
private final ImageFileNameStrategy imageFileNameStrategy; | ||
|
||
private final Domain domain; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이미지 서비스가 생기면서 각각 서비스에서 사용하던
도메인을 한곳에서 관리하니 편하네여!!!!
@@ -128,7 +129,7 @@ private WriterDetailResponse getWriterResponse(final Member member) { | |||
return new WriterDetailResponse( | |||
member.getId(), | |||
member.getNickname(), | |||
domain.getDomain() + member.getProfileImageInfo().getStoreName() | |||
imageService.findBaseUrl(ImageType.POST) + member.getProfileImageInfo().getStoreName() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이미지 서비스에 이미지 타입과 파일 이름을 넘겨서 완성된 파일 경로를 가져오는 것은 어떤가요...??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넴 메서드를 하나 더 만들어보겟습니다
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
convert메서드 사용하면 안되는 건가염??
@@ -12,4 +12,7 @@ public interface CommentImageInfoRepository extends JpaRepository<CommentImageIn | |||
@Modifying //todo: 옵션.. 이대로 괜찮은가? | |||
@Query("update CommentImageInfo c set c.deleted = true where c.id in :ids") | |||
void deleteAllById(@Param("ids") List<Long> ids); | |||
|
|||
@Query(value = "select * from comment_image_info", nativeQuery = true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JPARepo를 사용하면 삭제된 이미지는 where절에서 걸려서 조회 안되서 긍듯여
return true; | ||
} | ||
|
||
@Override |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
어케 구현할지 궁금했는데 @Profile
을 이용해서 완전 깔쌈하게 구현해주셨군여 !!!!
감덩감덩 쓰나미쓰나미
private String domain; | ||
|
||
public List<String> removeDomainFromUrl(final List<String> imageUrls) { | ||
public List<String> removeDomainFromUrl(final List<String> imageUrls, final String typeDirectory) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 메서드 명이 뭔가... 어색한것 같아여...
밑에는 convertToImageUrl()인데 얘도 맞춰서 convertToFileName이나 convertToStoredName같은 걸로 바뀌면 좋을 것 같아여
그럼 이 밑에 메서드랑보다 상위 메서드인게 더 잘 보일 것 같아염
backend/src/main/java/edonymyeon/backend/image/application/ImageService.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
굳굳 👍
# Conflicts: # backend/src/main/java/edonymyeon/backend/comment/application/CommentService.java # backend/src/main/java/edonymyeon/backend/global/exception/ExceptionInformation.java # backend/src/main/java/edonymyeon/backend/image/ImageFileUploader.java # backend/src/main/java/edonymyeon/backend/member/application/MemberService.java # backend/src/main/java/edonymyeon/backend/post/application/PostReadService.java # backend/src/test/java/edonymyeon/backend/auth/application/AuthServiceTest.java
# Conflicts: # backend/src/main/java/edonymyeon/backend/member/application/MemberService.java # backend/src/test/java/edonymyeon/backend/member/docs/MemberControllerDocsTest.java
|
||
@RequiredArgsConstructor | ||
@Component | ||
public class ImageInfoFactory { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오홍 네이밍 좋구여👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
버저닝 변경된거 까지 확인했습니다. 👍
고생하셨어유 이리 저리 이리이리내씨
🔥 연관 이슈
📝 작업 요약
application의 profile이 prod일때는 s3를, 그 외(테스트 포함)는 local 기존 경로에 이미지를 저장하도록 했습니다.
s3 -> 이미지 업로드 구현, 이미지 삭제 미구현
local -> 이미지 업로드 구현, 이미지 삭제 구현(프로필용)
s3 이용시 사용자에게 전달되는 이미지 주소는
{클라우드 프론트 도메인}/images/post/KakaoTalk_Photo_2023-09-13-10-03-02.jpeg
입니다.현재 시각 기준 테스트 서버에 현재 s3 브랜치가 반영되어 있으니 확인해보셔도 조하요
다음 커밋이 s3 반영한 커밋이구요. 그 이전은 환경에따라 localimageclinet <-> s3imageclient를 바꿔 사용하기 위한 구조 리팩터링입니다
그리고 imageService에서 데이터베이스에 post 이미지, comment 이미지 repository에 저장하는 로직도 넣어보려다가
너무 힘들어보여서 기존 상태를 유지하였읍니다. (imageService의 todo는 무시하셔도 좋다는 이야기~)
추후 해야할 일
테스트서버 관련해서 해야하는 일
운영서버 관련해서 해야하는 일