From ecd88737e537c5008351b24b90d854ec7fbf4748 Mon Sep 17 00:00:00 2001 From: gsd Date: Sat, 4 Nov 2023 22:36:15 +0300 Subject: [PATCH] new db update 2 fix 4 --- .../app/controllers/user/MessagesController.java | 15 +++------------ src/main/java/app/controllers/user/Payload.java | 12 ++++++++++++ 2 files changed, 15 insertions(+), 12 deletions(-) create mode 100644 src/main/java/app/controllers/user/Payload.java diff --git a/src/main/java/app/controllers/user/MessagesController.java b/src/main/java/app/controllers/user/MessagesController.java index 21c9643..333f4ea 100644 --- a/src/main/java/app/controllers/user/MessagesController.java +++ b/src/main/java/app/controllers/user/MessagesController.java @@ -7,9 +7,9 @@ import app.entities.other.SteamID; import app.services.db.MessageService; import app.utils.SteamIDConverter; import jakarta.servlet.http.HttpServletRequest; -import lombok.Data; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; @@ -23,7 +23,7 @@ public class MessagesController { this.messageService = messageService; } - @PostMapping + @PostMapping(consumes = {MediaType.APPLICATION_JSON_VALUE}) @CheckWebAccess(auth_method = AuthMethod.STEAM64) @WaitAfterNext(order = "messages") public ResponseEntity getMessages(HttpServletRequest request, @@ -35,7 +35,7 @@ public class MessagesController { return new ResponseEntity(messageService.getAllMessages(srv, filter==null?null:filter.getMessage(), offset, limit), HttpStatus.OK); } - @PostMapping("/account") + @PostMapping(value = "/account", consumes = {MediaType.APPLICATION_JSON_VALUE}) @CheckWebAccess(auth_method = AuthMethod.STEAM64) @WaitAfterNext(order = "messages") public ResponseEntity getAccountMessages(HttpServletRequest request, @@ -50,13 +50,4 @@ public class MessagesController { if (limit > 20) return new ResponseEntity(HttpStatus.NOT_ACCEPTABLE); return new ResponseEntity(messageService.getAccountMessages(steamID, srv, filter==null?null: filter.getMessage(), offset, limit), HttpStatus.OK); } - - @Data - public class Payload { - public String message; - Payload() {} - public String getMessage() { - return message==null||message.isEmpty()?null:message; - } - } } diff --git a/src/main/java/app/controllers/user/Payload.java b/src/main/java/app/controllers/user/Payload.java new file mode 100644 index 0000000..5a50d80 --- /dev/null +++ b/src/main/java/app/controllers/user/Payload.java @@ -0,0 +1,12 @@ +package app.controllers.user; + +import lombok.Data; + +@Data +public class Payload { + public String message; + Payload() {} + public String getMessage() { + return message==null||message.isEmpty()?null:message; + } +} \ No newline at end of file