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

[SKRR-26] fix: user 이미지 url앞에 bucket url prefix가 중복으로 붙는 문제 해결 #307

Merged
merged 1 commit into from
Jan 27, 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 @@ -21,7 +21,7 @@ public static CommentResponse of(CommentInfo commentInfo, String bucketUrl) {
commentInfo.content(),
commentInfo.authorId(),
commentInfo.author(),
commentInfo.authorImageUrl() == null ? null : bucketUrl + commentInfo.authorImageUrl(),
commentInfo.authorImageUrl(),
commentInfo.createdDate(),
commentInfo.lastModifiedDate(),
commentInfo.isPrivate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public static PostResponse from(PostInfo postInfo, String bucketUrl) {
postInfo.content(),
postInfo.authorId(),
postInfo.author(),
postInfo.authorImageUrl() == null ? null : bucketUrl + postInfo.authorImageUrl(),
postInfo.postImageUrl() == null ? null : bucketUrl + postInfo.postImageUrl(),
postInfo.authorImageUrl(),
postInfo.postImageUrl(bucketUrl),
postInfo.createdDate(),
postInfo.lastModifiedDate()
);
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/com/spaceclub/board/service/vo/PostInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,12 @@ public static PostInfo of(Post post, UserProfile userProfile) {
post.getLastModifiedAt()
);
}

public String postImageUrl(String bucketUrl) {
if (postImageUrl == null) {
return null;
}
return bucketUrl + postImageUrl;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class CommentControllerTest {
.andExpect(jsonPath("$.content").value(comment.getContent()))
.andExpect(jsonPath("$.authorId").value(comment.getAuthorId()))
.andExpect(jsonPath("$.author").value(userProfile.username()))
.andExpect(jsonPath("$.authorImageUrl").value(bucketUrl + userProfile.profileImageUrl()))
.andExpect(jsonPath("$.authorImageUrl").value(userProfile.profileImageUrl()))
.andExpect(jsonPath("$.createdDate").value("2024-01-01T00:00:00"))
.andExpect(jsonPath("$.lastModifiedDate").value("2024-01-01T00:00:00"))
.andExpect(jsonPath("$.isPrivate").value(comment.isPrivate()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ class PostControllerTest {
.andExpect(jsonPath("$.content").value(post.getContent()))
.andExpect(jsonPath("$.authorId").value(post.getAuthorId()))
.andExpect(jsonPath("$.author").value(userProfile.username()))
.andExpect(jsonPath("$.authorImageUrl").value(bucketUrl + userProfile.profileImageUrl()))
.andExpect(jsonPath("$.authorImageUrl").value(userProfile.profileImageUrl()))
.andExpect(jsonPath("$.postImageUrl").value(bucketUrl + post.getPostImageUrl()))
.andExpect(jsonPath("$.createdDate").value("2024-01-01T00:00:00"))
.andExpect(jsonPath("$.lastModifiedDate").value("2024-01-01T00:00:00"))
Expand Down
Loading