fix for history and allMessages table
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
package com.release11.klaus.controller;
|
||||
|
||||
|
||||
import com.release11.klaus.model.MockedMessageDto;
|
||||
import com.release11.klaus.utilis.BusinessKey;
|
||||
import com.release11.klaus.utilis.TrackingClient;
|
||||
import com.release11.klaus.model.MockedResponseDto;
|
||||
import com.release11.klaus.model.MockedMessage;
|
||||
import com.release11.klaus.service.KlausService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.RequestEntity;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
@@ -15,6 +17,7 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -25,6 +28,15 @@ public class KlausController {
|
||||
|
||||
private final KlausService klausService;
|
||||
|
||||
@RequestMapping(value = "klaus/v1/getAll/{clientUUID}")
|
||||
public ResponseEntity<String> getAllMockedResponses(@PathVariable UUID clientUUID){
|
||||
TrackingClient.setBusinessKeys(Map.of(BusinessKey.INTERFACE_NAME, "getMockedResponse",
|
||||
BusinessKey.CLIENT_UUID, String.valueOf(clientUUID),
|
||||
BusinessKey.MESSAGE_ID, "all"));
|
||||
List<MockedMessageDto> mockedMessages = klausService.getAllMockedResponses(clientUUID);
|
||||
return new ResponseEntity<>(mockedMessages.toString(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "klaus/v1/get/{clientUUID}/{mockedResponseId}")
|
||||
public ResponseEntity getMockedResponse(@PathVariable UUID clientUUID,
|
||||
@PathVariable int mockedResponseId){
|
||||
@@ -44,10 +56,10 @@ public class KlausController {
|
||||
BusinessKey.CLIENT_UUID, String.valueOf(clientUUID),
|
||||
BusinessKey.MESSAGE_ID, String.valueOf(mockedResponseId)));
|
||||
|
||||
MockedResponseDto mockedResponseDto = new MockedResponseDto(clientUUID, mockedResponseId,
|
||||
MockedMessageDto mockedMessageDto = new MockedMessageDto(clientUUID, mockedResponseId,
|
||||
requestEntity.getHeaders().getContentType().toString(), requestEntity.getBody(),
|
||||
requestEntity.getHeaders().toSingleValueMap(), httpStatus);
|
||||
return klausService.setMockedResponse(mockedResponseDto);
|
||||
return klausService.setMockedResponse(mockedMessageDto);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user