File tree Expand file tree Collapse file tree
src/main/java/com/example/whiplash/article/original/web/controller Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package com .example .whiplash .article .original .web .controller ;
22
33import com .example .whiplash .apiPayload .ApiResponse ;
4+ import com .example .whiplash .apiPayload .ErrorStatus ;
5+ import com .example .whiplash .apiPayload .exception .WhiplashException ;
46import com .example .whiplash .article .original .domain .document .SummaryStatus ;
57import com .example .whiplash .article .original .service .ArticleQueryService ;
68import com .example .whiplash .article .original .web .dto .response .ArticleListItemResponse ;
@@ -74,10 +76,10 @@ public ResponseEntity<ApiResponse<ArticleListResponse>> searchArticles(
7476
7577 @ GetMapping ("/recently-viewed" )
7678 public ResponseEntity <ApiResponse <List <RecentlyViewedArticleResponse >>> getRecentlyViewedArticles (
77- @ AuthenticationPrincipal UserPrincipal principal ,
7879 @ RequestParam @ DateTimeFormat (pattern = "yyyy-MM-dd" ) LocalDate date ) {
7980
80- Long userId = principal .getUserId ();
81+ Long userId = SecurityContextUtils .getCurrentUserId ()
82+ .orElseThrow (() -> new WhiplashException (ErrorStatus .UNAUTHORIZED ));
8183
8284 List <RecentlyViewedArticleResponse > articles = articleQueryService .getRecentlyViewedArticles (userId , date );
8385
You can’t perform that action at this time.
0 commit comments