-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from Domitory-CheckMate/feature/13-post
[feat] 키워드 게시물 조회 api 구현
- Loading branch information
Showing
5 changed files
with
112 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
...main/java/org/gachon/checkmate/domain/post/dto/response/PostSearchElementResponseDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.gachon.checkmate.domain.post.dto.response; | ||
|
||
import lombok.Builder; | ||
import org.gachon.checkmate.domain.post.dto.support.PostSearchDto; | ||
|
||
@Builder | ||
public record PostSearchElementResponseDto( | ||
String title, | ||
String content, | ||
String importantKey, | ||
String similarityKey, | ||
int scrapCount, | ||
int remainDate, | ||
int accuracy | ||
) { | ||
public static PostSearchElementResponseDto of(PostSearchDto postSearchDto, | ||
int remainDate, | ||
int accuracy) { | ||
return PostSearchElementResponseDto.builder() | ||
.title(postSearchDto.title()) | ||
.content(postSearchDto.content()) | ||
.importantKey(postSearchDto.importantKey().getDesc()) | ||
.similarityKey(postSearchDto.similarityKey().getDesc()) | ||
.scrapCount(postSearchDto.scrapCount()) | ||
.remainDate(remainDate) | ||
.accuracy(accuracy) | ||
.build(); | ||
} | ||
} |
28 changes: 9 additions & 19 deletions
28
src/main/java/org/gachon/checkmate/domain/post/dto/response/PostSearchResponseDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,19 @@ | ||
package org.gachon.checkmate.domain.post.dto.response; | ||
|
||
import lombok.Builder; | ||
import org.gachon.checkmate.domain.post.dto.support.PostSearchDto; | ||
|
||
import java.util.List; | ||
|
||
@Builder | ||
public record PostSearchResponseDto( | ||
String title, | ||
String content, | ||
String importantKey, | ||
String similarityKey, | ||
int scrapCount, | ||
int remainDate, | ||
int accuracy | ||
) { | ||
public static PostSearchResponseDto of(PostSearchDto postSearchDto, | ||
int remainDate, | ||
int accuracy) { | ||
List<PostSearchElementResponseDto> results, | ||
int totalPages, | ||
long totalElements) { | ||
public static PostSearchResponseDto of(List<PostSearchElementResponseDto> results, int totalPages, long totalElements) { | ||
return PostSearchResponseDto.builder() | ||
.title(postSearchDto.title()) | ||
.content(postSearchDto.content()) | ||
.importantKey(postSearchDto.importantKey().getDesc()) | ||
.similarityKey(postSearchDto.similarityKey().getDesc()) | ||
.scrapCount(postSearchDto.scrapCount()) | ||
.remainDate(remainDate) | ||
.accuracy(accuracy) | ||
.results(results) | ||
.totalPages(totalPages) | ||
.totalElements(totalElements) | ||
.build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters