Skip to content

Commit c735ab7

Browse files
committed
fix: 불필요한 응답값 제거
1 parent 4dda45d commit c735ab7

File tree

4 files changed

+6
-21
lines changed

4 files changed

+6
-21
lines changed
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
package eatda.controller.article;
22

3-
import java.time.LocalDateTime;
4-
53
public record ArticleResponse(
6-
Long id,
74
String title,
85
String subtitle,
96
String articleUrl,
10-
String imageUrl,
11-
LocalDateTime createdAt
7+
String imageUrl
128
) {
139
}

src/main/java/eatda/service/article/ArticleService.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,10 @@ public ArticlesResponse getAllArticles(int size) {
2121
List<ArticleResponse> articles = articleRepository.findAllByOrderByCreatedAtDesc(pageRequest)
2222
.stream()
2323
.map(article -> new ArticleResponse(
24-
article.getId(),
2524
article.getTitle(),
2625
article.getSubtitle(),
2726
article.getArticleUrl(),
28-
imageService.getPresignedUrl(article.getImageKey()),
29-
article.getCreatedAt()
27+
imageService.getPresignedUrl(article.getImageKey())
3028
))
3129
.toList();
3230

src/test/java/eatda/document/article/ArticleDocumentTest.java

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import eatda.document.RestDocsResponse;
1212
import eatda.document.Tag;
1313
import io.restassured.response.Response;
14-
import java.time.LocalDateTime;
1514
import java.util.List;
1615
import org.junit.jupiter.api.Nested;
1716
import org.junit.jupiter.api.Test;
@@ -31,32 +30,26 @@ class GetArticles {
3130
RestDocsResponse responseDocument = response()
3231
.responseBodyField(
3332
fieldWithPath("articles").description("게시글 응답 리스트"),
34-
fieldWithPath("articles[].id").description("게시글 ID"),
3533
fieldWithPath("articles[].title").description("게시글 제목"),
3634
fieldWithPath("articles[].subtitle").description("게시글 소제목"),
3735
fieldWithPath("articles[].articleUrl").description("게시글 링크 URL"),
38-
fieldWithPath("articles[].imageUrl").description("게시글 이미지 URL"),
39-
fieldWithPath("articles[].createdAt").description("작성 시각")
36+
fieldWithPath("articles[].imageUrl").description("게시글 이미지 URL")
4037
);
4138

4239
@Test
4340
void 가게의_담긴_이야기_목록_조회_성공() {
4441
ArticlesResponse mockResponse = new ArticlesResponse(List.of(
4542
new ArticleResponse(
46-
1L,
4743
"국밥의 모든 것",
4844
"뜨끈한 국물의 세계",
4945
"https://eatda.com/article/1",
50-
"https://s3.bucket.com/article/1.jpg",
51-
LocalDateTime.now()
46+
"https://s3.bucket.com/article/1.jpg"
5247
),
5348
new ArticleResponse(
54-
2L,
5549
"순대국의 진실",
5650
"돼지부속의 미학",
5751
"https://eatda.com/article/2",
58-
"https://s3.bucket.com/article/2.jpg",
59-
LocalDateTime.now()
52+
"https://s3.bucket.com/article/2.jpg"
6053
)
6154
));
6255

src/test/java/eatda/fixture/ArticleGenerator.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,10 @@ public Article generate(String title, String subtitle, String articleUrl, String
4242

4343
public ArticleResponse toResponse(Article article) {
4444
return new ArticleResponse(
45-
article.getId(),
4645
article.getTitle(),
4746
article.getSubtitle(),
4847
article.getArticleUrl(),
49-
"https://s3.bucket.com/" + article.getImageKey(),
50-
article.getCreatedAt()
48+
"https://s3.bucket.com/" + article.getImageKey()
5149
);
5250
}
5351
}

0 commit comments

Comments
 (0)