Skip to content

Commit

Permalink
docs: 꿀팁공유해요 게시글 좋아요 추가 및 취소 명세서 (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
toychip committed Feb 10, 2024
1 parent 387d97a commit d31a1c2
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,26 @@ public class HoneyTipResponseConstant {
}
}
""";
public static final String REGISTER_LIKE = """
{
"time": "2024-02-10T12:55:35.127794",
"status": 200,
"code": "200",
"message": "요청에 성공하였습니다.",
"result": {
"message": "HoneyTip Type의 3번째 좋아요을(를) 생성했습니다."
}
}
""";
public static final String CANCEL = """
{
"time": "2024-02-10T13:01:49.26421",
"status": 200,
"code": "200",
"message": "요청에 성공하였습니다.",
"result": {
"message": "HoneyTip Type의 3번째 좋아요을(를) 삭제했습니다."
}
}
""";
}
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,34 @@ public SuccessResponse<Message> report(final @PathVariable Long postId,
return new SuccessResponse<>(message);
}

@Operation(summary = "꿀팁공유해요 도움이되었어요 추가", description = "꿀팁 ID에 해당하는 게시글을 도움이되었어요를 추가합니다.")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "도움이되었어요 추가 성공",
content = @Content(
mediaType = MediaType.APPLICATION_JSON_VALUE,
schema = @Schema(implementation = SuccessResponse.class),
examples = @ExampleObject(
name = "SuccessResponse",
value = HoneyTipResponseConstant.REGISTER_LIKE,
description = "꿀팁을 도움이 되었어요를 추가했습니다."
)))})
@PostMapping("/like/{postId}")
public SuccessResponse<Message> registerLike(final @PathVariable Long postId) {
Message message = honeytipPostService.registerLike(postId);
return new SuccessResponse<>(message);
}

@Operation(summary = "꿀팁공유해요 도움이되었어요 취소", description = "꿀팁 ID에 해당하는 게시글을 도움이되었어요를 취소합니다.")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "도움이되었어요 취소 성공",
content = @Content(
mediaType = MediaType.APPLICATION_JSON_VALUE,
schema = @Schema(implementation = SuccessResponse.class),
examples = @ExampleObject(
name = "SuccessResponse",
value = HoneyTipResponseConstant.CANCEL,
description = "꿀팁을 도움이 되었어요를 취소했습니다."
)))})
@DeleteMapping("/like/{postId}")
public SuccessResponse<Message> cancelLike(final @PathVariable Long postId) {
Message message = honeytipPostService.cancelLike(postId);
Expand Down

0 comments on commit d31a1c2

Please sign in to comment.