From 820d3fac701e5e655fa52cda86e5aec1c6789c48 Mon Sep 17 00:00:00 2001 From: Tim <135014430+nagisa77@users.noreply.github.com> Date: Mon, 30 Jun 2025 19:58:52 +0800 Subject: [PATCH] docs: add curl examples for comment and reaction controllers --- .../openisle/controller/CommentController.java | 15 +++++++++++++++ .../openisle/controller/ReactionController.java | 12 ++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/main/java/com/openisle/controller/CommentController.java b/src/main/java/com/openisle/controller/CommentController.java index a2d59f7fd..92521d864 100644 --- a/src/main/java/com/openisle/controller/CommentController.java +++ b/src/main/java/com/openisle/controller/CommentController.java @@ -12,6 +12,21 @@ import java.time.LocalDateTime; import java.util.List; import java.util.stream.Collectors; +/* +curl -X POST http://localhost:8080/api/posts/1/comments \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer " \ + -d '{ "content": "Nice post" }' + +curl -X POST http://localhost:8080/api/comments/1/replies \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer " \ + -d '{ "content": "Thanks!" }' + +curl http://localhost:8080/api/posts/1/comments \ + -H "Authorization: Bearer " + */ + @RestController @RequestMapping("/api") @RequiredArgsConstructor diff --git a/src/main/java/com/openisle/controller/ReactionController.java b/src/main/java/com/openisle/controller/ReactionController.java index 607b1cfff..cfe9e8946 100644 --- a/src/main/java/com/openisle/controller/ReactionController.java +++ b/src/main/java/com/openisle/controller/ReactionController.java @@ -9,6 +9,18 @@ import org.springframework.http.ResponseEntity; import org.springframework.security.core.Authentication; import org.springframework.web.bind.annotation.*; +/* +curl -X POST http://localhost:8080/api/posts/1/reactions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer " \ + -d '{ "type": "LIKE" }' + +curl -X POST http://localhost:8080/api/comments/1/reactions \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer " \ + -d '{ "type": "LIKE" }' + */ + @RestController @RequestMapping("/api") @RequiredArgsConstructor