Skip to content

Commit 0cbd4b8

Browse files
committed
fix(search) : 검색 결과 게시물 썸네일 수정
1 parent 5b307b0 commit 0cbd4b8

9 files changed

Lines changed: 37 additions & 32 deletions

File tree

src/main/java/com/example/FixLog/dto/main/MainPagePostResponseDto.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
@Getter
1010
@AllArgsConstructor
1111
public class MainPagePostResponseDto {
12+
private Long postId;
1213
private String postTitle;
1314
private String coverImage;
1415
private List<String> tags;

src/main/java/com/example/FixLog/dto/post/MyPostPageResponseDto.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class MyPostPageResponseDto {
2828
// 이미지 null일 때 default 사진으로 변경 - 프로필 사진
2929
public static String getDefaultProfile(String image){
3030
String imageUrl = (image == null || image.isBlank())
31-
? "https://fixlog-bucket.s3.ap-northeast-2.amazonaws.com/default/profile.png" : image;
31+
? "https://fixlogsmwubucket.s3.ap-northeast-2.amazonaws.com/default/DefaultImage.png" : image;
3232
System.out.println(imageUrl);
3333
return imageUrl;
3434
}

src/main/java/com/example/FixLog/dto/search/SearchPostDto.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public class SearchPostDto {
1212
private Long postId;
1313
private String title;
1414
private String content;
15+
private String coverImageUrl;
1516
private String writerNickname;
1617
private String writerProfileImage;
1718
private List<String> tags; // 예: [“spring-boot”, “jwt”, “java”]

src/main/java/com/example/FixLog/mock/PostMockDataInitializer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void run(String... args) {
6666
Post post = Post.builder()
6767
.userId(member)
6868
.postTitle("테스트 업그레이드 " + (i + 2))
69-
.coverImage("https://fixlog-bucket.s3.ap-northeast-2.amazonaws.com/default/profile.png" + (i + 2) + ".jpg")
69+
.coverImage("https://fixlogsmwubucket.s3.ap-northeast-2.amazonaws.com/default/DefaultImage.png" + (i + 2) + ".jpg")
7070
.problem("이 게시물은 문제 설명이 200자를 넘도록 작성되었습니다. 문제 발생 상황, 재현 과정, 로그, 화면 캡처 등 다양한 정보가 포함될 수 있습니다. 이 텍스트는 말줄임표가 잘 붙는지 확인하기 위한 용도로 작성되었으며, 검색 결과에서는 200자까지만 보여야 합니다. 이후 내용은 생략될 수 있습니다. 추가 텍스트를 더 붙입니다. 더 붙입니다. 더 붙입니다.")
7171
.errorMessage("이건 에러다 keyword 포함")
7272
.environment("환경 정보")

src/main/java/com/example/FixLog/repository/post/PostRepositoryImpl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public Page<SearchPostDto> searchByKeywordAndTags(String keyword, List<String> t
7171
.postId(p.getPostId())
7272
.title(p.getPostTitle())
7373
.content(p.getProblem().length() > 200 ? p.getProblem().substring(0, 200) + "…" : p.getProblem())
74+
.coverImageUrl(p.getCoverImage())
7475
.writerNickname(p.getUserId().getNickname())
7576
.writerProfileImage(p.getUserId().getProfileImageUrl())
7677
.tags(p.getPostTags().stream().map(pt -> pt.getTagId().getTagName()).toList())

src/main/java/com/example/FixLog/service/MainPageService.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public MainPageService(PostRepository postRepository, MemberService memberServic
3030
// 이미지 null일 때 default 사진으로 변경 - 프로필 사진
3131
public String getDefaultProfile(String image){
3232
String imageUrl = (image == null || image.isBlank())
33-
? "https://fixlog-bucket.s3.ap-northeast-2.amazonaws.com/default/profile.png" : image;
33+
? "https://fixlogsmwubucket.s3.ap-northeast-2.amazonaws.com/default/DefaultImage.png" : image;
3434
System.out.println(imageUrl);
3535
return imageUrl;
3636
}
@@ -53,7 +53,7 @@ public MainPageResponseDto mainPageView(int sort, int size){
5353
String imageUrl = member.getProfileImageUrl();
5454
profileImageUrl = getDefaultProfile(imageUrl);
5555
} else {
56-
profileImageUrl = "https://fixlog-bucket.s3.ap-northeast-2.amazonaws.com/default/profile.png"; // 비로그인 기본 이미지
56+
profileImageUrl = "https://fixlogsmwubucket.s3.ap-northeast-2.amazonaws.com/default/DefaultImage.png"; // 비로그인 기본 이미지
5757
}
5858

5959
// 페이지 (글 12개) 불러오기
@@ -73,6 +73,7 @@ public MainPageResponseDto mainPageView(int sort, int size){
7373

7474
List<MainPagePostResponseDto> postList = posts.stream()
7575
.map(post -> new MainPagePostResponseDto(
76+
post.getPostId(),
7677
post.getPostTitle(),
7778
getDefaultCover(post.getCoverImage()),
7879
post.getPostTags().stream()
@@ -99,7 +100,7 @@ public MainPageResponseDto mainPageFullView(int sort, int page, int size){
99100
String imageUrl = member.getProfileImageUrl();
100101
profileImageUrl = getDefaultProfile(imageUrl);
101102
} else {
102-
profileImageUrl = "https://fixlog-bucket.s3.ap-northeast-2.amazonaws.com/default/profile.png"; // 비로그인 기본 이미지
103+
profileImageUrl = "https://fixlogsmwubucket.s3.ap-northeast-2.amazonaws.com/default/DefaultImage.png"; // 비로그인 기본 이미지
103104
}
104105

105106
// 페이지 설정 (한 페이지당 12개)
@@ -115,6 +116,7 @@ public MainPageResponseDto mainPageFullView(int sort, int page, int size){
115116

116117
List<MainPagePostResponseDto> postList = postPage.stream()
117118
.map(post -> new MainPagePostResponseDto(
119+
post.getPostId(),
118120
post.getPostTitle(),
119121
getDefaultCover(post.getCoverImage()),
120122
post.getPostTags().stream()

src/main/java/com/example/FixLog/service/PostService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public PostService(PostRepository postRepository, PostLikeRepository postLikeRep
5757
// 이미지 null일 때 default 사진으로 변경 - 프로필 사진
5858
public String getDefaultProfile(String image){
5959
String imageUrl = (image == null || image.isBlank())
60-
? "https://fixlog-bucket.s3.ap-northeast-2.amazonaws.com/default/profile.png" : image;
60+
? "https://fixlogsmwubucket.s3.ap-northeast-2.amazonaws.com/default/DefaultImage.png" : image;
6161
System.out.println(imageUrl);
6262
return imageUrl;
6363
}
@@ -270,7 +270,7 @@ public PostResponseDto viewPost(Long postId){
270270
.anyMatch(bookmark -> bookmark.getFolderId().getUserId().equals(member));
271271
} else {
272272
nickname = "로그인하지 않았습니다.";
273-
profileImageUrl = "https://fixlog-bucket.s3.ap-northeast-2.amazonaws.com/default/profile.png"; // 비로그인 기본 이미지
273+
profileImageUrl = "https://fixlogsmwubucket.s3.ap-northeast-2.amazonaws.com/default/DefaultImage.png"; // 비로그인 기본 이미지
274274
isLiked = false;
275275
isMarked = false;
276276
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package com.example.FixLog.util;
22

33
public class DefaultImage {
4-
public static final String PROFILE = "https://fixlog-bucket.s3.ap-northeast-2.amazonaws.com/default/profile.png";
4+
public static final String PROFILE = "https://fixlogsmwubucket.s3.ap-northeast-2.amazonaws.com/default/DefaultImage.png";
55
}

src/main/resources/application.properties

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,27 @@ spring.application.name=FixLog
2828
## Spring Security
2929
#logging.level.org.springframework.security=DEBUG
3030

31-
##### [PROD] #####
32-
server.port=8083
33-
34-
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
35-
spring.datasource.url=${MYSQL_URL}
36-
spring.datasource.username=${MYSQL_USERNAME}
37-
spring.datasource.password=${MYSQL_PASSWORD}
38-
39-
spring.jpa.hibernate.ddl-auto=update
40-
spring.jpa.show-sql=true
41-
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
42-
spring.jpa.properties.hibernate.format_sql=true
43-
44-
cloud.aws.credentials.access-key=${AWS_ACCESS_KEY_ID}
45-
cloud.aws.credentials.secret-key=${AWS_SECRET_ACCESS_KEY}
46-
cloud.aws.region.static=${AWS_REGION}
47-
cloud.aws.s3.bucket=${AWS_S3_BUCKET}
48-
49-
jwt.secret=${JWT_KEY}
50-
51-
logging.level.root=INFO
52-
logging.level.com.example.FixLog=DEBUG
53-
logging.level.org.springframework.web.servlet.DispatcherServlet=DEBUG
54-
logging.file.name=logs/app.log
31+
###### [PROD] #####
32+
#server.port=8083
33+
#
34+
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
35+
#spring.datasource.url=${MYSQL_URL}
36+
#spring.datasource.username=${MYSQL_USERNAME}
37+
#spring.datasource.password=${MYSQL_PASSWORD}
38+
#
39+
#spring.jpa.hibernate.ddl-auto=update
40+
#spring.jpa.show-sql=true
41+
#spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
42+
#spring.jpa.properties.hibernate.format_sql=true
43+
#
44+
#cloud.aws.credentials.access-key=${AWS_ACCESS_KEY_ID}
45+
#cloud.aws.credentials.secret-key=${AWS_SECRET_ACCESS_KEY}
46+
#cloud.aws.region.static=${AWS_REGION}
47+
#cloud.aws.s3.bucket=${AWS_S3_BUCKET}
48+
#
49+
#jwt.secret=${JWT_KEY}
50+
#
51+
#logging.level.root=INFO
52+
#logging.level.com.example.FixLog=DEBUG
53+
#logging.level.org.springframework.web.servlet.DispatcherServlet=DEBUG
54+
#logging.file.name=logs/app.log

0 commit comments

Comments
 (0)