aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/www/api/Post.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2023-01-13 17:38:06 +0300
committerGravatar Vitaly Takmazov2023-01-13 18:11:56 +0300
commit35d25bbc9d261e7b5585d0fd1d398dff3ab4a176 (patch)
tree68a4d0b0190635615438343f6f6c52cacc213179 /src/main/java/com/juick/www/api/Post.java
parent8b70eded6c9cc3b9cf634356239701fe65779791 (diff)
Fix OpenAPI generation
* Use HandlerMethodArgumentResolver to pass visitor * Hide visitor from OpenAPI definitions * Drop unused AsciiDoc template
Diffstat (limited to 'src/main/java/com/juick/www/api/Post.java')
-rw-r--r--src/main/java/com/juick/www/api/Post.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/main/java/com/juick/www/api/Post.java b/src/main/java/com/juick/www/api/Post.java
index 2dba6e07..97311c21 100644
--- a/src/main/java/com/juick/www/api/Post.java
+++ b/src/main/java/com/juick/www/api/Post.java
@@ -25,6 +25,7 @@ import java.util.Optional;
import javax.inject.Inject;
import com.juick.www.api.activity.helpers.ProfileUriBuilder;
+import io.swagger.v3.oas.annotations.Parameter;
import jakarta.validation.constraints.NotNull;
import com.juick.CommandsManager;
@@ -74,7 +75,7 @@ public class Post {
@RequestMapping(value = "/api/post", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(value = HttpStatus.OK)
public CommandResult doPostMessage(
- @ModelAttribute User visitor,
+ @Parameter(hidden = true) User visitor,
@RequestParam(required = false, defaultValue = StringUtils.EMPTY) String body,
@RequestParam(required = false) String img,
@RequestParam(required = false) MultipartFile attach) throws Exception {
@@ -105,7 +106,7 @@ public class Post {
@RequestMapping(value = "/api/comment", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public CommandResult doPostComment(
- @ModelAttribute User visitor,
+ @Parameter(hidden = true) User visitor,
@RequestParam(defaultValue = "0") int mid,
@RequestParam(defaultValue = "0") int rid,
@RequestParam(required = false, defaultValue = StringUtils.EMPTY) final String body,
@@ -157,7 +158,7 @@ public class Post {
@PostMapping("/api/like")
@ResponseStatus(value = HttpStatus.OK)
- public Status doPostRecommendation(@ModelAttribute User visitor, @RequestParam Integer mid) throws Exception {
+ public Status doPostRecommendation(@Parameter(hidden = true) User visitor, @RequestParam Integer mid) throws Exception {
Optional<Message> message = messagesService.getMessage(mid);
if (message.isEmpty()) {
throw new HttpNotFoundException();
@@ -173,7 +174,7 @@ public class Post {
@PostMapping("/api/subscribe")
@ResponseStatus(value = HttpStatus.OK)
- public Status doPostSubscribe(@ModelAttribute User visitor,
+ public Status doPostSubscribe(@Parameter(hidden = true) User visitor,
@RequestParam Integer mid) throws Exception {
Optional<Message> message = messagesService.getMessage(mid);
if (message.isEmpty()) {
@@ -197,7 +198,7 @@ public class Post {
@PostMapping("/api/react")
@ResponseStatus(value = HttpStatus.OK)
public Status doPostReact(
- @ModelAttribute User visitor,
+ @Parameter(hidden = true) User visitor,
@RequestParam Integer mid, @RequestParam @NotNull int reactionId,
@RequestParam(required = false, defaultValue = "1") int count) {
@@ -219,7 +220,7 @@ public class Post {
}
@PostMapping("/api/update")
- public CommandResult updateMessage(@ModelAttribute User visitor,
+ public CommandResult updateMessage(@Parameter(hidden = true) User visitor,
@RequestParam Integer mid,
@RequestParam(required = false, defaultValue = "0") Integer rid,
@RequestParam String body) {