Skip to content

Commit

Permalink
[feat] Swagger API 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
wnd01jun committed Aug 1, 2024
1 parent 4aed8c3 commit 1b95fcc
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.bbteam.budgetbuddies.domain.comment.dto.CommentRequestDto;
import com.bbteam.budgetbuddies.domain.comment.dto.CommentResponseDto;
import com.bbteam.budgetbuddies.domain.comment.service.CommentService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
Expand All @@ -12,7 +11,7 @@
import org.springframework.web.bind.annotation.*;

@RestController
public class CommentControllerV2 implements CommentControllerApi {
public class CommentController implements CommentControllerApi {

@Qualifier("discountCommentService")
private final CommentService<CommentRequestDto.DiscountInfoCommentDto,
Expand All @@ -22,9 +21,9 @@ public class CommentControllerV2 implements CommentControllerApi {
private final CommentService<CommentRequestDto.SupportInfoCommentDto,
CommentResponseDto.SupportInfoCommentDto> supportCommentService;

public CommentControllerV2(CommentService<CommentRequestDto.DiscountInfoCommentDto,
public CommentController(CommentService<CommentRequestDto.DiscountInfoCommentDto,
CommentResponseDto.DiscountInfoCommentDto> discountCommentService,
CommentService<CommentRequestDto.SupportInfoCommentDto,
CommentService<CommentRequestDto.SupportInfoCommentDto,
CommentResponseDto.SupportInfoCommentDto> supportCommentService) {
this.discountCommentService = discountCommentService;
this.supportCommentService = supportCommentService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
import org.springframework.data.domain.Pageable;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

public interface CommentControllerApi {
@Operation(summary = "[User] 특정 할인 정보 게시글에 댓글달기", description = "특정 할인 정보 게시글에 댓글을 다는 API입니다.")
Expand Down Expand Up @@ -75,6 +78,49 @@ ResponseEntity<Page<CommentResponseDto.SupportInfoCommentDto>> findAllBySupportI
@Parameters({
@Parameter(name = "commentId", description = "삭제할 댓글 id 입니다. parameter")
})
@GetMapping("/comments/delete")
ResponseEntity<String> deleteComment(Long commentId);

@Operation(summary = "[User] SupportInfo의 댓글 요청 API ", description = "특정 댓글을 요청하는 API입니다.")
@ApiResponses({
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "COMMON200", description = "OK, 성공"),
})
@Parameters({
@Parameter(name = "commentId", description = "조회할 댓글 id 입니다. parameter")
})
ResponseEntity<CommentResponseDto.SupportInfoCommentDto> findSupportOne(@RequestParam("commentId")Long commentId);

@Operation(summary = "[User] SupprotInfo의 댓글 변경 API", description = "특정 댓글을 변경하는 API입니다.")
@ApiResponses({
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "COMMON200", description = "OK, 성공"),
})
@Parameters({
@Parameter(name = "commentId", description = "변경할 댓글 id 입니다. requestbody"),
@Parameter(name = "comment", description = "변경할 댓글 내용입니다.. requestbody")

})
ResponseEntity<CommentResponseDto.SupportInfoCommentDto> modifySupportOne(
@RequestBody CommentRequestDto.CommentModifyDto dto);


@Operation(summary = "[User] DiscountInfo의 댓글 요청 API ", description = "특정 댓글을 요청하는 API입니다.")
@ApiResponses({
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "COMMON200", description = "OK, 성공"),
})
@Parameters({
@Parameter(name = "commentId", description = "조회할 댓글 id 입니다. parameter")
})
ResponseEntity<CommentResponseDto.DiscountInfoCommentDto> findDiscountOne(@RequestParam("commentId")Long commentId);

@Operation(summary = "[User] DiscountInfo의 댓글 변경 API", description = "특정 댓글을 변경하는 API입니다.")
@ApiResponses({
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "COMMON200", description = "OK, 성공"),
})
@Parameters({
@Parameter(name = "commentId", description = "변경할 댓글 id 입니다. requestbody"),
@Parameter(name = "comment", description = "변경할 댓글 내용입니다.. requestbody")

})
ResponseEntity<CommentResponseDto.DiscountInfoCommentDto> modifyDiscountOne(
@RequestBody CommentRequestDto.CommentModifyDto dto);

}

0 comments on commit 1b95fcc

Please sign in to comment.