Skip to content

Commit 8bec8c7

Browse files
authored
Merge pull request #107 from FixLog/develop
Develop
2 parents feb5ef4 + 3770f04 commit 8bec8c7

File tree

7 files changed

+27
-16
lines changed

7 files changed

+27
-16
lines changed

src/main/java/com/example/FixLog/domain/post/Post.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,32 +33,35 @@ public class Post {
3333
private String coverImage;
3434

3535
@Lob // 텍스트가 길어질 수 있는 필드에 사용
36-
@Column(nullable = false)
36+
@Column(columnDefinition = "TEXT", nullable = false)
3737
private String problem;
3838

3939
@Lob
40-
@Column(nullable = false)
40+
@Column(columnDefinition = "TEXT", nullable = false)
4141
private String errorMessage;
4242

4343
@Lob
44-
@Column(nullable = false)
44+
@Column(columnDefinition = "TEXT", nullable = false)
4545
private String environment;
4646

4747
@Lob
48-
@Column(nullable = false)
48+
@Column(columnDefinition = "TEXT", nullable = false)
4949
private String reproduceCode;
5050

5151
@Lob
52-
@Column(nullable = false)
52+
@Column(columnDefinition = "TEXT", nullable = false)
5353
private String solutionCode;
5454

5555
@Lob
56+
@Column(columnDefinition = "TEXT")
5657
private String causeAnalysis;
5758

5859
@Lob
60+
@Column(columnDefinition = "TEXT")
5961
private String referenceLink;
6062

6163
@Lob
64+
@Column(columnDefinition = "TEXT")
6265
private String extraContent;
6366

6467
@Column(nullable = false)

src/main/java/com/example/FixLog/domain/tag/Tag.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class Tag {
1818
@Enumerated(EnumType.STRING)
1919
private TagCategory tagCategory;
2020

21-
@Column(length = 20, nullable = false)
21+
@Column(length = 50, nullable = false)
2222
private String tagName;
2323

2424
private String tagInfo;

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/mock/PostMockDataInitializer.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,20 @@ public void run(String... args) {
5353
.collect(Collectors.toMap(Tag::getTagName, tag -> tag));
5454

5555
List<String[]> config = List.of(
56-
new String[]{"백엔드", "스프링부트", "자바", "NullPointerException", "500 Internal Server Error"},
57-
new String[]{"프론트엔드", "리액트", "자바스크립트", "Cannot read property of undefined", "상태(state) 업데이트 누락"},
58-
new String[]{"머신러닝", "케라스", "파이썬", "OutOfMemoryError", "HTTP 에러"},
59-
new String[]{"백엔드", "노드", "JSON", "CORS 정책 오류", "404 Not Found"},
60-
new String[]{"프론트엔드", "넥스트", "CSS", "스타일 깨짐", "렌더링 무한 루프"},
61-
new String[]{"머신러닝", "사이킷런", "R", "ClassNotFoundException", "Permission Error"}
56+
new String[]{"backend", "spring-boot", "java", "null-pointer-exception", "500-error"},
57+
new String[]{"frontend", "react", "javascript", "undefined-property", "state-missing"},
58+
new String[]{"machine-learning", "keras", "python", "out-of-memory", "http-error"},
59+
new String[]{"backend", "node.js", "json", "cors-error", "404-error"},
60+
new String[]{"frontend", "next.js", "css", "style-break", "render-loop"},
61+
new String[]{"machine-learning", "scikit-learn", "r", "class-not-found", "permission-error"}
6262
);
6363

6464
for (int i = 0; i < config.size(); i++) {
6565
String[] tags = config.get(i);
6666
Post post = Post.builder()
6767
.userId(member)
6868
.postTitle("테스트 업그레이드 " + (i + 2))
69-
.coverImage("https://cdn.example.com/images/test" + (i + 2) + ".jpg")
69+
.coverImage("https://fixlog-bucket.s3.ap-northeast-2.amazonaws.com/default/profile.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: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,19 @@ public Page<SearchPostDto> searchByKeywordAndTags(String keyword, List<String> t
3939

4040
// 2. 태그 조건 (AND 조건)
4141
if (tags != null && !tags.isEmpty()) {
42+
List<String> sanitizedTags = tags.stream()
43+
.filter(tag -> tag != null && !tag.trim().isEmpty()) // null/빈값 제거
44+
.map(String::trim) // 공백 제거
45+
.toList();
46+
4247
NumberExpression<Long> count = postTag.tagId.tagId.count();
4348

4449
JPQLQuery<Long> subQuery = queryFactory
4550
.select(postTag.postId.postId)
4651
.from(postTag)
47-
.where(postTag.tagId.tagName.in(tags))
52+
.where(postTag.tagId.tagName.in(sanitizedTags)) // 이미 소문자면 lower() 생략 가능
4853
.groupBy(postTag.postId.postId)
49-
.having(count.eq((long) tags.size()));
54+
.having(count.eq((long) sanitizedTags.size()));
5055

5156
builder.and(post.postId.in(subQuery));
5257
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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()
@@ -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/resources/application.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ spring.application.name=FixLog
2525
## JWT
2626
#jwt.secret=${JWT_KEY}
2727
#
28-
## Spring Security 디버깅 로그
28+
## Spring Security
2929
#logging.level.org.springframework.security=DEBUG
3030

3131
##### [PROD] #####

0 commit comments

Comments
 (0)