diff --git a/project/src/main/java/com/edison/project/domain/artletter/controller/ArtletterController.java b/project/src/main/java/com/edison/project/domain/artletter/controller/ArtletterController.java index 960cab0f..da157f62 100644 --- a/project/src/main/java/com/edison/project/domain/artletter/controller/ArtletterController.java +++ b/project/src/main/java/com/edison/project/domain/artletter/controller/ArtletterController.java @@ -7,6 +7,8 @@ import com.edison.project.domain.artletter.entity.ArtletterCategory; import com.edison.project.domain.artletter.service.ArtletterService; import com.edison.project.global.security.CustomUserPrincipal; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -20,6 +22,10 @@ import java.util.List; +@Tag( + name = "Artletter", + description = "아트레터 관련 API - 아트레터 생성, 조회, 검색, 좋아요, 스크랩, 추천바 등" +) @RestController @RequestMapping("/artletters") @RequiredArgsConstructor @@ -31,6 +37,9 @@ public class ArtletterController { // 아트레터 등록 @PostMapping @PreAuthorize("isAuthenticated()") + @Operation( + summary = "아트레터 등록" + ) public ResponseEntity createArtletter( @AuthenticationPrincipal CustomUserPrincipal userPrincipal, @Valid @RequestBody ArtletterDTO.CreateRequestDto requestDto) { @@ -41,6 +50,9 @@ public ResponseEntity createArtletter( // 전체 아트레터 조회 @GetMapping + @Operation( + summary = "전체 아트레터 조회" + ) public ResponseEntity getAllArtletters( @AuthenticationPrincipal CustomUserPrincipal userPrincipal, @RequestParam(defaultValue = "0") int page, @@ -61,6 +73,10 @@ public ResponseEntity getAllArtletters( // 아트레터 검색 @GetMapping("/search") + @Operation( + summary = "아트레터 검색", + description = "입력한 키워드를 기준으로 아트레터를 검색합니다. 태그, 제목, 내용에 대한 full text search를 하고, 검색어와의 관련도를 기준으로 결과를 정렬합니다." + ) public ResponseEntity searchArtletters( @AuthenticationPrincipal CustomUserPrincipal userPrincipal, @RequestParam(value = "keyword", required = false) String keyword, @@ -85,6 +101,9 @@ public ResponseEntity searchArtletters( @GetMapping("/editor-pick") + @Operation( + summary = "에디터 픽 아트레터 조회" + ) public ResponseEntity getEditorArtletters( @AuthenticationPrincipal CustomUserPrincipal userPrincipal) { List response = artletterService.getEditorArtletters(userPrincipal); @@ -95,6 +114,9 @@ public ResponseEntity getEditorArtletters( // 좋아요 기능 @PostMapping("/{letterId}/like") @PreAuthorize("isAuthenticated()") + @Operation( + summary = "아트레터 좋아요 토글" + ) public ResponseEntity likeArtletter(@PathVariable Long letterId, @AuthenticationPrincipal CustomUserPrincipal userPrincipal) { ArtletterDTO.LikeResponseDto response = artletterService.likeToggleArtletter(userPrincipal, letterId); @@ -104,6 +126,9 @@ public ResponseEntity likeArtletter(@PathVariable Long letterId, @A // 스크랩 기능 @PostMapping("/{letterId}/scrap") @PreAuthorize("isAuthenticated()") + @Operation( + summary = "아트레터 스크랩 토글" + ) public ResponseEntity scrapArtletter(@PathVariable Long letterId, @AuthenticationPrincipal CustomUserPrincipal userPrincipal) { ArtletterDTO.ScrapResponseDto response = artletterService.scrapToggleArtletter(userPrincipal, letterId); return ApiResponse.onSuccess(SuccessStatus._OK, response); @@ -111,6 +136,9 @@ public ResponseEntity scrapArtletter(@PathVariable Long letterId, @ // 아트레터 상세 조회 @GetMapping("/{letterId}") + @Operation( + summary = "아트레터 상세내용 조회" + ) public ResponseEntity getArtletterInfo( @AuthenticationPrincipal CustomUserPrincipal userPrincipal, @PathVariable("letterId") Long letterId) { @@ -119,12 +147,20 @@ public ResponseEntity getArtletterInfo( } @GetMapping("/recommend-bar/category") + @Operation( + summary = "추천바 카테고리 조회", + description = "아트레터 추천바에 들어갈 3개의 카테고리값을 반환합니다." + ) public ResponseEntity getRecommendCategory() { List categories = artletterService.getRecommendCategory(); return ApiResponse.onSuccess(SuccessStatus._OK, new ArtletterDTO.RecommendCategoryResponse(categories)); } @GetMapping("/recommend-bar/keyword") + @Operation( + summary = "추천바 키워드 조회", + description = "아트레터 추천바에 들어갈 3개의 키워드값을 반환합니다." + ) public ResponseEntity getRecommendKeywords( @RequestParam List artletterIds) { List response = artletterService.getRecommendKeyword(artletterIds); @@ -132,6 +168,10 @@ public ResponseEntity getRecommendKeywords( } @GetMapping("/more/{currentId}") + @Operation( + summary = "다른 아트레터 랜덤 조회", + description = "사용자가 현재 보고 있는 아트레터를 제외한 다른 아트레터 3개를 랜덤으로 조회합니다." + ) public ResponseEntity getRandomArtletters( @AuthenticationPrincipal CustomUserPrincipal userPrincipal, @PathVariable("currentId") Long currentId) { @@ -142,6 +182,9 @@ public ResponseEntity getRandomArtletters( @GetMapping("/scrap") @PreAuthorize("isAuthenticated()") + @Operation( + summary = "스크랩한 아트레터 조회" + ) public ResponseEntity getScrapArtletters( @AuthenticationPrincipal CustomUserPrincipal userPrincipal, @RequestParam(defaultValue = "0") int page, @@ -152,6 +195,9 @@ public ResponseEntity getScrapArtletters( @GetMapping("/scrap/{category}") @PreAuthorize("isAuthenticated()") + @Operation( + summary = "스크랩한 아트레터 카테고리별 조회" + ) public ResponseEntity getScrapCategoryArtletters( @AuthenticationPrincipal CustomUserPrincipal userPrincipal, @PathVariable ArtletterCategory category, @@ -163,6 +209,9 @@ public ResponseEntity getScrapCategoryArtletters( // 최근 검색어 조회 @GetMapping("/search-memory") + @Operation( + summary = "최근 검색어 조회" + ) public ResponseEntity getMemoryMemory( @AuthenticationPrincipal CustomUserPrincipal userPrincipal) { return artletterService.getMemoryKeyword(userPrincipal); @@ -170,6 +219,9 @@ public ResponseEntity getMemoryMemory( // 최근 검색어 삭제 @DeleteMapping("/search-memory") + @Operation( + summary = "최근 검색어 삭제" + ) public ResponseEntity deleteMemoryKeyword( @AuthenticationPrincipal CustomUserPrincipal userPrincipal, @RequestParam(value = "keyword", required = false) String keyword) { @@ -178,6 +230,9 @@ public ResponseEntity deleteMemoryKeyword( // 카테고리별 아트레터 조회 @GetMapping("/category") + @Operation( + summary = "아트레터 카테고리별 조회" + ) public ResponseEntity getArtlettersByCategory( @AuthenticationPrincipal CustomUserPrincipal userPrincipal, @RequestParam("category") ArtletterCategory category,