Skip to content

Commit

Permalink
Merge pull request #85 from kimh7537/develop
Browse files Browse the repository at this point in the history
Feat: article 모든 기사 조회(요약x)
  • Loading branch information
kimh7537 authored Aug 23, 2024
2 parents 286f214 + 55f5a91 commit 3743a12
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package com.cotato.squadus.api.article.controller;

import com.cotato.squadus.api.article.dto.ArticleListResponse;
import com.cotato.squadus.api.article.dto.ArticleRequest;
import com.cotato.squadus.api.article.dto.ArticleResponse;
import com.cotato.squadus.api.article.dto.ArticleSummaryResponse;
import com.cotato.squadus.api.article.dto.*;
import com.cotato.squadus.api.post.dto.ClubPostCreateRequest;
import com.cotato.squadus.domain.club.article.service.ArticleService;
import io.swagger.v3.oas.annotations.Operation;
Expand Down Expand Up @@ -78,4 +75,15 @@ public ResponseEntity<ArticleListResponse> getAllArticles() {
log.info("모든 기사 요약 조회");
return ResponseEntity.ok(ArticleListResponse.from(articles));
}

@GetMapping("/allData")
@Operation(summary = "아티클 요약x 전체 조회(페이징 없음)", description = "모든 아티클을 요약 없이 조회합니다.")
public ResponseEntity<ArticleResponseListWrapper> getAllArticlesWithAllData() {
List<ArticleResponse> articles = articleService.getAllArticlesWithAllData();
log.info("모든 기사 요약 조회");
return ResponseEntity.ok(ArticleResponseListWrapper.from(articles));
}



}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.cotato.squadus.api.article.dto;

import java.util.List;

public record ArticleResponseListWrapper(List<ArticleResponse> articles) {

public static ArticleResponseListWrapper from(List<ArticleResponse> articles) {
return new ArticleResponseListWrapper(articles);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,10 @@ public List<ArticleSummaryResponse> getAllArticles() {
.map(article -> new ArticleSummaryResponse(article.getArticleIdx(), article.getTitle(), article.getSubtitle()))
.collect(Collectors.toList());
}

public List<ArticleResponse> getAllArticlesWithAllData() {
return articleRepository.findAll().stream()
.map(ArticleResponse::from)
.collect(Collectors.toList());
}
}

0 comments on commit 3743a12

Please sign in to comment.