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

refactor: Image 업로드 시 ImageKey 관리 #226

Merged
merged 6 commits into from
Jan 26, 2024

Conversation

kdomo
Copy link
Member

@kdomo kdomo commented Jan 25, 2024

🌱 관련 이슈

📌 작업 내용 및 특이사항

  • Image Key를 담을 Image Domain을 생성하였습니다.
  • 이미지 업로드 시 UUID를 통해 이미지 키를 생성하고 저장합니다.
  • 이미지 업로드 처리 완료시에 이미지 키를 조회하고 해당 이미지 키 값을 사용하여 ImageUrl을 설정합니다.
  • ImageUrl을 설정하는 부분에서 CDN 주소를 사용하도록 추가하였습니다.
  • 테스트코드에 파일명 이스케이프 처리하였습니다.

@kdomo kdomo added the ♻️ refactor 기능 개선 label Jan 25, 2024
@kdomo kdomo added this to the 2.5차 스프린트 milestone Jan 25, 2024
@kdomo kdomo requested review from char-yb and uwoobeat January 25, 2024 12:20
@kdomo kdomo self-assigned this Jan 25, 2024
Copy link
Member

@char-yb char-yb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

리뷰 달았어용

Comment on lines 22 to 26
private Long targetId;

private String imageKey;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UUID면 char(36)으로 지정하는게 낫지 않을까용

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String이 아닌 char 배열을 사용하는게 낫다라는 뜻일까요?
아니면 컬럼의 length를 맞춰주는게 좋겠다 라는 뜻일까요?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

length를 맞추는게 좋을 거 같아용

Comment on lines +11 to +15
@Query(
"select i from Image i where i.imageType = :imageType and i.targetId = :targetId and i.imageFileExtension = :imageFileExtension order by i.id desc limit 1")
Optional<Image> queryImageKey(
ImageType imageType, Long targetId, ImageFileExtension imageFileExtension);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

가장 최근 row를 가져오는 이유는
최근 갱신된 imageKey를 가져오기 위함인가용?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

네 맞습니다 presignedUrl을 생성하고 이미지 업로드를 처리하지 않았을 경우 해당 key값은 사용되지 않아서,
가장 최신껄 가져오도록 해놨습니당

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

설명 감사합니당:)

Copy link
Member

@char-yb char-yb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
length를 설정하는 게 필수는 아니여서 지금 코드도 좋아보입니당

@kdomo kdomo force-pushed the refactor/185-image-improvement branch from 1c5a6b5 to 09daed5 Compare January 26, 2024 05:24
Copy link

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

49 New issues
0 Security Hotspots
53.6% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud

@kdomo kdomo merged commit 43b32f3 into develop Jan 26, 2024
2 checks passed
@github-actions github-actions bot added the merged 머지된 PR label Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged 머지된 PR ♻️ refactor 기능 개선
Projects
Status: 완료
Development

Successfully merging this pull request may close these issues.

♻️ 이미지 접근 속도 개선
2 participants