11package com .pinback .api .article .controller ;
22
3+ import java .time .LocalDateTime ;
4+
5+ import org .springframework .web .bind .annotation .GetMapping ;
6+ import org .springframework .web .bind .annotation .PathVariable ;
37import org .springframework .web .bind .annotation .PostMapping ;
48import org .springframework .web .bind .annotation .RequestBody ;
59import org .springframework .web .bind .annotation .RequestMapping ;
10+ import org .springframework .web .bind .annotation .RequestParam ;
611import org .springframework .web .bind .annotation .RestController ;
712
813import com .pinback .api .article .dto .request .ArticleCreateRequest ;
14+ import com .pinback .application .article .dto .query .PageQuery ;
15+ import com .pinback .application .article .dto .response .ArticleCountInfoResponse ;
16+ import com .pinback .application .article .dto .response .ArticleDetailResponseV3 ;
17+ import com .pinback .application .article .dto .response .ArticlesPageResponseV3 ;
18+ import com .pinback .application .article .dto .response .GetAllArticlesResponseV3 ;
19+ import com .pinback .application .article .dto .response .TodayRemindResponseV3 ;
920import com .pinback .application .article .port .in .CreateArticlePort ;
21+ import com .pinback .application .article .port .in .GetArticlePort ;
1022import com .pinback .domain .user .entity .User ;
1123import com .pinback .infrastructure .article .service .ArticleUpdateService ;
1224import com .pinback .shared .annotation .CurrentUser ;
2638@ Tag (name = "ArticleV3" , description = "아티클 관리 API V3" )
2739public class ArticleControllerV3 {
2840 private final CreateArticlePort createArticlePort ;
41+ private final GetArticlePort getArticlePort ;
2942 private final ArticleUpdateService articleMetadataUpdateService ;
3043
3144 @ Operation (summary = "아티클 생성v3" , description = "url에서 썸네일과 제목을 추출하여 새로운 아티클을 생성합니다" )
@@ -38,6 +51,89 @@ public ResponseDto<Void> createArticle(
3851 return ResponseDto .ok ();
3952 }
4053
54+ @ Operation (summary = "아티클 상세 조회 V3" , description = "아티클의 상세 정보를 조회합니다" )
55+ @ GetMapping ("/{articleId}" )
56+ public ResponseDto <ArticleDetailResponseV3 > getArticleDetail (
57+ @ Parameter (hidden = true ) @ CurrentUser User user ,
58+ @ Parameter (description = "아티클 ID" ) @ PathVariable Long articleId
59+ ) {
60+ ArticleDetailResponseV3 response = getArticlePort .getArticleDetailWithMetadata (user , articleId );
61+ return ResponseDto .ok (response );
62+ }
63+
64+ @ Operation (summary = "리마인드 아티클 조회 v3" , description = "오늘 리마인드할 아티클을 읽음/안읽음 상태별로 조회합니다." )
65+ @ GetMapping ("/remind" )
66+ public ResponseDto <TodayRemindResponseV3 > getRemindArticlesV3 (
67+ @ Parameter (hidden = true ) @ CurrentUser User user ,
68+ @ Parameter (description = "현재 시간" , example = "2026-02-13T10:00:00" ) @ RequestParam LocalDateTime now ,
69+ @ Parameter (description = "읽음 상태 (true: 읽음, false: 안읽음)" , example = "true" ) @ RequestParam (name = "read-status" ) boolean readStatus ,
70+ @ Parameter (description = "페이지 번호 (0부터 시작)" ) @ RequestParam (defaultValue = "0" ) int page ,
71+ @ Parameter (description = "페이지 크기" ) @ RequestParam (defaultValue = "8" ) int size
72+ ) {
73+ PageQuery query = new PageQuery (page , size );
74+ TodayRemindResponseV3 response = getArticlePort .getRemindArticlesV3 (user , now , readStatus , query );
75+ return ResponseDto .ok (response );
76+ }
77+
78+ @ Operation (summary = "리마인드 아티클 읽음/안읽음 개수 조회 v3" , description = "오늘 리마인드할 아티클의 읽음/안읽음 개수를 반환합니다." )
79+ @ GetMapping ("/remind/count" )
80+ public ResponseDto <ArticleCountInfoResponse > getRemindArticlesInfo (
81+ @ Parameter (hidden = true ) @ CurrentUser User user ,
82+ @ Parameter (description = "현재 시간" , example = "2026-02-13T10:00:00" ) @ RequestParam LocalDateTime now
83+ ) {
84+ ArticleCountInfoResponse response = getArticlePort .getRemindArticlesInfo (user , now );
85+ return ResponseDto .ok (response );
86+ }
87+
88+ @ Operation (summary = "나의 북마크 전체 아티클 조회 V3" , description = "사용자의 모든 아티클을 페이징으로 조회합니다." )
89+ @ GetMapping
90+ public ResponseDto <GetAllArticlesResponseV3 > getAllArticles (
91+ @ Parameter (hidden = true ) @ CurrentUser User user ,
92+ @ Parameter (description = "읽음 상태 (생략: 전체보기, false: 안읽음)" , example = "false" ) @ RequestParam (name = "read-status" , required = false ) Boolean readStatus ,
93+ @ Parameter (description = "페이지 번호 (0부터 시작)" ) @ RequestParam (defaultValue = "0" ) int page ,
94+ @ Parameter (description = "페이지 크기" ) @ RequestParam (defaultValue = "8" ) int size
95+ ) {
96+ PageQuery query = new PageQuery (page , size );
97+ GetAllArticlesResponseV3 response = getArticlePort .getAllArticlesV3 (user , readStatus , query );
98+ return ResponseDto .ok (response );
99+ }
100+
101+ @ Operation (summary = "나의 북마크 아티클 전체보기/안읽음 개수 조회 v3" , description = "나의 북마크 아티클의 전체보기/안읽음 개수를 반환합니다." )
102+ @ GetMapping ("/count" )
103+ public ResponseDto <ArticleCountInfoResponse > getArticlesInfo (
104+ @ Parameter (hidden = true ) @ CurrentUser User user
105+ ) {
106+ ArticleCountInfoResponse response = getArticlePort .getAllArticlesInfo (user );
107+ return ResponseDto .ok (response );
108+ }
109+
110+ @ Operation (summary = "나의 북마크 카테고리별 아티클 조회 V3" , description = "특정 카테고리의 아티클 전체 목록을 조회합니다." )
111+ @ GetMapping ("/category" )
112+ public ResponseDto <ArticlesPageResponseV3 > getAllArticlesByCategory (
113+ @ Parameter (hidden = true ) @ CurrentUser User user ,
114+ @ Parameter (description = "카테고리 ID" ) @ RequestParam (name = "category-id" ) Long categoryId ,
115+ @ Parameter (description = "읽음 상태 (생략시: 전체보기, false: 안읽음)" , example = "false" ) @ RequestParam (name = "read-status" , required = false ) Boolean readStatus ,
116+ @ Parameter (description = "페이지 번호 (0부터 시작)" ) @ RequestParam (defaultValue = "0" ) int page ,
117+ @ Parameter (description = "페이지 크기" ) @ RequestParam (defaultValue = "8" ) int size
118+ ) {
119+ PageQuery query = new PageQuery (page , size );
120+ ArticlesPageResponseV3 response = getArticlePort .getAllArticlesByCategoryV3 (user , categoryId , readStatus ,
121+ query );
122+ return ResponseDto .ok (response );
123+ }
124+
125+ @ Operation (summary = "나의 북마크 카테고리별 아티클 전체보기/안읽음 개수 조회 v3" , description = "나의 북마크에서 특정 카테고리 아티클의 전체보기/안읽음 개수를 반환합니다." )
126+ @ GetMapping ("/category/count" )
127+ public ResponseDto <ArticleCountInfoResponse > getArticlesInfoByCategory (
128+ @ Parameter (hidden = true ) @ CurrentUser User user ,
129+ @ Parameter (description = "카테고리 ID" ) @ RequestParam (name = "category-id" ) Long categoryId
130+
131+ ) {
132+ ArticleCountInfoResponse response = getArticlePort .getAllArticlesInfoByCategoryV3 (user , categoryId );
133+ return ResponseDto .ok (response );
134+ }
135+
136+ // 기존 아티클 메타데이터 처리 후 삭제 예정
41137 @ PostMapping ("/metadata" )
42138 public ResponseDto <Void > migrateMetadata () {
43139 articleMetadataUpdateService .migrateMissingMetadata ();
0 commit comments