Added user action and versioning for Flow get api
This commit is contained in:
@@ -106,6 +106,10 @@ public enum UserActionContextEnum {
|
|||||||
UPDATE_IMAGES("UPDATE_IMAGES"),
|
UPDATE_IMAGES("UPDATE_IMAGES"),
|
||||||
GET_DOCUMENT("GET_DOCUMENT"),
|
GET_DOCUMENT("GET_DOCUMENT"),
|
||||||
|
|
||||||
|
/** Assigned flow context **/
|
||||||
|
CREATE_UPDATE_FLOW("CREATE_UPDATE_FLOW"),
|
||||||
|
GET_FLOW("GET_FLOW"),
|
||||||
|
|
||||||
/** Login attempt action context **/
|
/** Login attempt action context **/
|
||||||
GET_LOGIN_ATTEMPT_LIST("GET_LOGIN_ATTEMPT_LIST"),
|
GET_LOGIN_ATTEMPT_LIST("GET_LOGIN_ATTEMPT_LIST"),
|
||||||
ADD_LOGIN_ATTEMPT("ADD_LOGIN_ATTEMPT");
|
ADD_LOGIN_ATTEMPT("ADD_LOGIN_ATTEMPT");
|
||||||
|
|||||||
@@ -3,10 +3,14 @@ package net.gepafin.tendermanagement.web.rest.api.impl;
|
|||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import net.gepafin.tendermanagement.config.Translator;
|
import net.gepafin.tendermanagement.config.Translator;
|
||||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||||
|
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
||||||
|
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
||||||
import net.gepafin.tendermanagement.model.request.FlowRequestBean;
|
import net.gepafin.tendermanagement.model.request.FlowRequestBean;
|
||||||
|
import net.gepafin.tendermanagement.model.request.UserActionRequest;
|
||||||
import net.gepafin.tendermanagement.model.response.FlowResponseBean;
|
import net.gepafin.tendermanagement.model.response.FlowResponseBean;
|
||||||
import net.gepafin.tendermanagement.model.util.Response;
|
import net.gepafin.tendermanagement.model.util.Response;
|
||||||
import net.gepafin.tendermanagement.service.FlowService;
|
import net.gepafin.tendermanagement.service.FlowService;
|
||||||
|
import net.gepafin.tendermanagement.util.LoggingUtil;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.FlowApi;
|
import net.gepafin.tendermanagement.web.rest.api.FlowApi;
|
||||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -23,15 +27,28 @@ public class FlowApiController implements FlowApi {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private FlowService flowService;
|
private FlowService flowService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private LoggingUtil loggingUtil;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Response<FlowResponseBean>> createOrUpdateFlow(HttpServletRequest httpServletRequest, FlowRequestBean flowRequestBean, Long callId) {
|
public ResponseEntity<Response<FlowResponseBean>> createOrUpdateFlow(HttpServletRequest request, FlowRequestBean flowRequestBean, Long callId) {
|
||||||
FlowResponseBean flowResponseBean=flowService.createOrUpdateFlow(httpServletRequest,flowRequestBean,callId);
|
|
||||||
|
/** This code is responsible for creating user action logs for the "Create or update Flow" operation. **/
|
||||||
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.INSERT)
|
||||||
|
.actionContext(UserActionContextEnum.CREATE_UPDATE_FLOW).build());
|
||||||
|
|
||||||
|
FlowResponseBean flowResponseBean=flowService.createOrUpdateFlow(request,flowRequestBean,callId);
|
||||||
return ResponseEntity.status(HttpStatus.CREATED)
|
return ResponseEntity.status(HttpStatus.CREATED)
|
||||||
.body(new Response<>(flowResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.FLOW_CREATED_SUCCESSFULLY)));
|
.body(new Response<>(flowResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.FLOW_CREATED_SUCCESSFULLY)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity<Response<FlowResponseBean>> getFlowByCallId(HttpServletRequest request, Long callId) {
|
public ResponseEntity<Response<FlowResponseBean>> getFlowByCallId(HttpServletRequest request, Long callId) {
|
||||||
|
|
||||||
|
/** This code is responsible for creating user action logs for the "Create or update Flow" operation. **/
|
||||||
|
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW)
|
||||||
|
.actionContext(UserActionContextEnum.GET_FLOW).build());
|
||||||
|
|
||||||
FlowResponseBean flowResponseBean=flowService.getFlowByCallId(request,callId);
|
FlowResponseBean flowResponseBean=flowService.getFlowByCallId(request,callId);
|
||||||
return ResponseEntity.status(HttpStatus.OK)
|
return ResponseEntity.status(HttpStatus.OK)
|
||||||
.body(new Response<>(flowResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.FLOW_FETCHED_SUCCESSFULLY)));
|
.body(new Response<>(flowResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.FLOW_FETCHED_SUCCESSFULLY)));
|
||||||
|
|||||||
Reference in New Issue
Block a user