Updated Code
This commit is contained in:
@@ -11,7 +11,8 @@ public enum UserActionLogsEnum {
|
||||
INSERT("INSERT"),
|
||||
DOWNLOAD("DOWNLOAD"),
|
||||
UPLOAD("UPLOAD"),
|
||||
SCHEDULER("SCHEDULER");
|
||||
SCHEDULER("SCHEDULER"),
|
||||
SCRIPT("SCRIPT");
|
||||
|
||||
private final String value;
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.ExampleObject;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants;
|
||||
|
||||
import org.springframework.http.MediaType;
|
||||
@@ -24,5 +25,5 @@ public interface S3MigrationApi {
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||
@PutMapping(value = "/{key}", produces = { "application/json" })
|
||||
String reUploadAndMigrateDocuments(@Parameter(description = "The secret key", required = true) @PathVariable("key") String key);
|
||||
String reUploadAndMigrateDocuments(HttpServletRequest request, @Parameter(description = "The secret key", required = true) @PathVariable("key") String key);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Content;
|
||||
import io.swagger.v3.oas.annotations.media.ExampleObject;
|
||||
import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.Valid;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
@@ -24,7 +25,7 @@ public interface UserSignedAndDelegationApi {
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||
@GetMapping(value = "/{key}", produces = { "application/json" })
|
||||
String migrateUserDelegatedDocuments(@Parameter(description = "The secret key", required = true) @PathVariable("key") String key);
|
||||
String migrateUserDelegatedDocuments(HttpServletRequest request, @Parameter(description = "The secret key", required = true) @PathVariable("key") String key);
|
||||
|
||||
@Operation(summary = "Api to migrate S3 doc to user-signed.", responses = { @ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
package net.gepafin.tendermanagement.web.rest.api.impl;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
||||
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
||||
import net.gepafin.tendermanagement.model.request.UserActionRequest;
|
||||
import net.gepafin.tendermanagement.service.impl.S3ReUploadMigrationService;
|
||||
import net.gepafin.tendermanagement.util.LoggingUtil;
|
||||
import net.gepafin.tendermanagement.web.rest.api.S3MigrationApi;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -12,8 +17,16 @@ public class S3MigrationApiController implements S3MigrationApi {
|
||||
|
||||
@Autowired
|
||||
S3ReUploadMigrationService s3MigrationService;
|
||||
|
||||
@Autowired
|
||||
LoggingUtil loggingUtil;
|
||||
|
||||
@Override
|
||||
public String reUploadAndMigrateDocuments(String providedKey) {
|
||||
public String reUploadAndMigrateDocuments(HttpServletRequest request,String providedKey) {
|
||||
|
||||
/** This code is responsible for creating user action logs for the "upload document for call or application" operation. **/
|
||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.SCRIPT).actionContext(UserActionContextEnum.GET_DOCUMENT).build());
|
||||
|
||||
return s3MigrationService.reUploadAndMigrateDocuments(providedKey);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
package net.gepafin.tendermanagement.web.rest.api.impl;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
||||
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
||||
import net.gepafin.tendermanagement.model.request.UserActionRequest;
|
||||
import net.gepafin.tendermanagement.service.impl.UserSignedAndDelegationServiceImpl;
|
||||
import net.gepafin.tendermanagement.util.LoggingUtil;
|
||||
import net.gepafin.tendermanagement.web.rest.api.UserSignedAndDelegationApi;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -13,8 +18,15 @@ public class S3UserSignedAndDelegationMigrationController implements UserSignedA
|
||||
@Autowired
|
||||
UserSignedAndDelegationServiceImpl userSignedAndDelegationService;
|
||||
|
||||
@Autowired
|
||||
LoggingUtil loggingUtil;
|
||||
|
||||
@Override
|
||||
public String migrateUserDelegatedDocuments(String providedKey) {
|
||||
public String migrateUserDelegatedDocuments(HttpServletRequest request,String providedKey) {
|
||||
|
||||
/** This code is responsible for creating user action logs for the "upload document for call or application" operation. **/
|
||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.SCRIPT).actionContext(UserActionContextEnum.GET_DOCUMENT).build());
|
||||
|
||||
return userSignedAndDelegationService.migrateUserDelegatedDocuments(providedKey);
|
||||
}
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user