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

feat(#14):이슈 검색 API #44

Merged
merged 1 commit into from
Nov 23, 2023
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 @@ -13,7 +13,7 @@
public interface ContentsRepository extends JpaRepository<Contents, Integer>,ContentsCustomRepository{

List<Contents> findByType(ApiType type);
List<Contents> findByIssueTitleLike(String issue);
List<Contents> findByIssueTitleLikeAndType(String issue,ApiType type);
List<Contents> findByKeywordLikeAndTypeOrderByPubDateDesc(String issueTitle, ApiType type);

@Query(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
public interface ContentsService {
public Mono<Void> saveYoutubeContent(String[] search);
public List<ContentsRes> getContents(ApiType type);
List<ContentsRes> getContentsTitle(String issue);
List<ContentsRes> getContentsTitle(String issue, ApiType type);
List<ContentsRes> getKeywordAndType(String Keyword, ApiType apiType);
ContentsRes getContentsById(Integer contentsId);
List<ContentsRes> getContentLikeCount();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ public List<ContentsRes> getContents(ApiType type) {
.collect(Collectors.toList());
}

public List<ContentsRes> getContentsTitle(String issue) {
List<Contents> contents = contentsRepository.findByIssueTitleLike("%" + issue + "%");
public List<ContentsRes> getContentsTitle(String issue, ApiType type) {
List<Contents> contents = contentsRepository.findByIssueTitleLikeAndType("%" + issue + "%", type);
return contents.stream()
.map(contentsMapper::toDto)
.collect(Collectors.toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ public ResponseEntity<SuccessResponse<List<ContentsRes>>> getYoutubeContents(@P
return ResponseEntity.ok(SuccessResponse.create(GET_CONTENTS_SUCCESS.getMessage(),this.contentsService.getContents(type)));
}

@GetMapping("/issueTitle/{issue}")
public ResponseEntity<SuccessResponse<List<ContentsRes>>> getContentsTitle(@PathVariable String issue) {
return ResponseEntity.ok(SuccessResponse.create(GET_CONTENTS_SUCCESS.getMessage(),this.contentsService.getContentsTitle(issue)));
@GetMapping("/issueTitle/{issue}/{type}")
public ResponseEntity<SuccessResponse<List<ContentsRes>>> getContentsTitleAndType(@PathVariable String issue, @PathVariable ApiType type) {
return ResponseEntity.ok(SuccessResponse.create(GET_CONTENTS_SUCCESS.getMessage(),this.contentsService.getContentsTitle(issue,type)));
}

@GetMapping("/keyword/{keyword}/{type}")
Expand Down
Loading