Add webex message posting

This commit is contained in:
2026-01-02 00:03:46 +01:00
parent a0e974d511
commit 08afaa19ee
20 changed files with 34360 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
package be.naaturel.boardmateapi.controllers;
import be.naaturel.boardmateapi.common.models.Message;
import be.naaturel.boardmateapi.controllers.dtos.MessagePostRequestDto;
import be.naaturel.boardmateapi.controllers.dtos.ResponseBody;
import be.naaturel.boardmateapi.services.MessageService;
import be.naaturel.boardmateapi.services.WebexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
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.RestController;
@RestController
public class ChatController {
private final MessageService messageService;
private final WebexService webexService;
@Autowired
public ChatController(MessageService messageService, WebexService webexService){
this.messageService = messageService;
this.webexService = webexService;
}
@PostMapping("/message/send")
public ResponseEntity<ResponseBody<String>> postMessage(@RequestBody MessagePostRequestDto messagePostRequest) {
ResponseBody<String> result = ResponseBody.createEmpty();
try {
Message model = new Message(
null,
messagePostRequest.getContent(),
messagePostRequest.getClientId(),
messagePostRequest.getTimeStamp());
this.webexService.post(model);
String id = this.messageService.save(model);
result.setSuccess(true);
result.setData(id);
return ResponseEntity.
status(HttpStatus.OK)
.body(result);
} catch (Exception e){
result.setMessage(e.getMessage());
return ResponseEntity
.status(HttpStatus.INTERNAL_SERVER_ERROR)
.body(result);
}
}
@GetMapping("/message/history")
public void history(){
}
}