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(){
}
}

View File

@@ -26,6 +26,7 @@ public class ClientController {
ResponseBody<String> result = ResponseBody.createEmpty();
try{
String clientId = service.create(dto.getCompanyName(), dto.getUsername(), dto.getKey());
result.setSuccess(true);
result.setData(clientId);
return ResponseEntity.
status(HttpStatus.OK)
@@ -37,4 +38,7 @@ public class ClientController {
.body(result);
}
}
}

View File

@@ -0,0 +1,33 @@
package be.naaturel.boardmateapi.controllers.dtos;
public class MessagePostRequestDto {
private String content;
private String clientId;
private int timeStamp;
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getClientId() {
return clientId;
}
public void setClientId(String clientId) {
this.clientId = clientId;
}
public int getTimeStamp() {
return timeStamp;
}
public void setTimeStamp(int timeStamp) {
this.timeStamp = timeStamp;
}
}