Created director user and get API for email log
This commit is contained in:
@@ -631,6 +631,8 @@ public class GepafinConstant {
|
||||
public static final String APPLICATION_CONTRACT_ALREADY_EXIST="application.contract.already.exist";
|
||||
public static final String APPLICATION_NOT_APPROVED="application.not.approved";
|
||||
public static final String SUBJECT_AND_BODY_REQUIRED="subject.body.required";
|
||||
public static final String MAIL_SENT_SUCCESSFULLY="mail.send.successfully";
|
||||
public static final String EMAIL_LOG_FETCHED="email.log.fetched";
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3,10 +3,7 @@ package net.gepafin.tendermanagement.dao;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||
import net.gepafin.tendermanagement.entities.EmailLogEntity;
|
||||
import net.gepafin.tendermanagement.enums.EmailScenarioTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.EmailEntityTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.RecipientTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.VersionActionTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.*;
|
||||
import net.gepafin.tendermanagement.model.request.EmailLogRequest;
|
||||
import net.gepafin.tendermanagement.model.request.VersionHistoryRequest;
|
||||
import net.gepafin.tendermanagement.repositories.EmailLogRepository;
|
||||
|
||||
142
src/main/java/net/gepafin/tendermanagement/dao/PecMailDao.java
Normal file
142
src/main/java/net/gepafin/tendermanagement/dao/PecMailDao.java
Normal file
@@ -0,0 +1,142 @@
|
||||
package net.gepafin.tendermanagement.dao;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import liquibase.util.Validate;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import net.gepafin.tendermanagement.config.Translator;
|
||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||
import net.gepafin.tendermanagement.entities.*;
|
||||
import net.gepafin.tendermanagement.enums.EmailServiceTypeEnum;
|
||||
import net.gepafin.tendermanagement.enums.StatusTypeEnum;
|
||||
import net.gepafin.tendermanagement.model.response.EmailLogResponse;
|
||||
import net.gepafin.tendermanagement.model.response.PecEmailLogResponse;
|
||||
import net.gepafin.tendermanagement.model.response.PecMailResponse;
|
||||
import net.gepafin.tendermanagement.repositories.EmailLogRepository;
|
||||
import net.gepafin.tendermanagement.repositories.UserActionsRepository;
|
||||
import net.gepafin.tendermanagement.service.ApplicationService;
|
||||
import net.gepafin.tendermanagement.service.CallService;
|
||||
import net.gepafin.tendermanagement.util.Utils;
|
||||
import net.gepafin.tendermanagement.util.Validator;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.ResourceNotFoundException;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@Log4j2
|
||||
public class PecMailDao {
|
||||
|
||||
@Autowired
|
||||
private Validator validator;
|
||||
|
||||
@Autowired
|
||||
private UserActionsRepository userActionsRepository;
|
||||
|
||||
@Autowired
|
||||
private EmailLogRepository emailLogRepository;
|
||||
|
||||
@Autowired
|
||||
private CallService callService;
|
||||
|
||||
@Autowired
|
||||
private EmailNotificationDao emailNotificationDao;
|
||||
|
||||
@Autowired
|
||||
private ApplicationService applicationService;
|
||||
|
||||
|
||||
public PecMailResponse sendPecMail(HttpServletRequest request, List<Long> userActionIds) {
|
||||
|
||||
for (Long userActionId: userActionIds) {
|
||||
List<EmailLogEntity> emailLogs = getEmailLogEntities(request, userActionId);
|
||||
for (EmailLogEntity log : emailLogs) {
|
||||
List<String> recipients = Utils.commaSeparatedStringToList(log.getRecipientEmails());
|
||||
CallEntity call = callService.validateCall(log.getCallId());
|
||||
emailNotificationDao.sendMail(
|
||||
call.getHub().getId(),
|
||||
log.getEmailSubject(),
|
||||
log.getEmailBody(),
|
||||
recipients,
|
||||
null
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<EmailLogEntity> getEmailLogEntities(HttpServletRequest request, Long userActionId) {
|
||||
UserActionEntity userActionEntity = userActionsRepository.findUserActionByIdAndIsDeletedFalse(userActionId);
|
||||
if (userActionEntity == null) {
|
||||
throw new ResourceNotFoundException(Status.NOT_FOUND, Translator.toLocale(GepafinConstant.USER_ACTION_ID_NOT_FOUND));
|
||||
}
|
||||
validator.validateHubId(request, userActionEntity.getHubId());
|
||||
|
||||
List<EmailLogEntity> emailLogs = emailLogRepository.findByUserActionIdAndEmailServiceTypeAndSendStatus(userActionId, EmailServiceTypeEnum.PEC_SERVICE.getValue(), StatusTypeEnum.PENDING.getValue());
|
||||
|
||||
if (emailLogs.isEmpty()) {
|
||||
log.info("No emails found for given userActionId: {}", userActionId);
|
||||
throw new CustomValidationException(Status.VALIDATION_ERROR, Translator.toLocale(GepafinConstant.NO_EMAIL_LOG_FOUND));
|
||||
}
|
||||
return emailLogs;
|
||||
}
|
||||
|
||||
public List<PecEmailLogResponse> getEmailLogByUserActionId(HttpServletRequest request,Long userActionId){
|
||||
List<EmailLogEntity> emailLogs = getEmailLogEntities(request, userActionId);
|
||||
ApplicationEntity applicationEntity=applicationService.validateApplication(emailLogs.get(0).getApplicationId());
|
||||
String callName=applicationEntity.getCall().getName();
|
||||
List<PecEmailLogResponse> pecEmailLogResponses=new ArrayList<>();
|
||||
for(EmailLogEntity emailLogEntity:emailLogs) {
|
||||
PecEmailLogResponse pecEmailLogResponse = createPecEmailLogResponse(userActionId, emailLogEntity, callName);
|
||||
pecEmailLogResponses.add(pecEmailLogResponse);
|
||||
}
|
||||
return pecEmailLogResponses;
|
||||
}
|
||||
|
||||
private PecEmailLogResponse createPecEmailLogResponse(Long userActionId, EmailLogEntity emailLogEntity, String callName) {
|
||||
PecEmailLogResponse pecEmailLogResponse = new PecEmailLogResponse();
|
||||
pecEmailLogResponse.setId(emailLogEntity.getId());
|
||||
pecEmailLogResponse.setUserActionId(userActionId);
|
||||
pecEmailLogResponse.setUserId(emailLogEntity.getUserId());
|
||||
pecEmailLogResponse.setApplicationId(emailLogEntity.getApplicationId());
|
||||
pecEmailLogResponse.setCallName(callName);
|
||||
EmailLogResponse emailLogResponse=new EmailLogResponse();
|
||||
emailLogResponse.setRecipientId(emailLogEntity.getRecipientId());
|
||||
emailLogResponse.setRecipientType(emailLogEntity.getRecipientType());
|
||||
pecEmailLogResponse.setEmailLogs(emailLogResponse);
|
||||
pecEmailLogResponse.setType(emailLogEntity.getEmailType());
|
||||
pecEmailLogResponse.setSubject(emailLogEntity.getEmailSubject());
|
||||
pecEmailLogResponse.setHtmlContent(emailLogEntity.getEmailBody());
|
||||
pecEmailLogResponse.setCallId(emailLogEntity.getCallId());
|
||||
return pecEmailLogResponse;
|
||||
}
|
||||
private PecMailResponse createPecMailResponse(Long userActionId, EmailLogEntity emailLogEntity, String callName) {
|
||||
PecMailResponse pecMailResponse = new PecMailResponse();
|
||||
pecMailResponse.setId(emailLogEntity.getId());
|
||||
pecMailResponse.setUserActionId(userActionId);
|
||||
pecMailResponse.setUserId(emailLogEntity.getUserId());
|
||||
pecMailResponse.setApplicationId(emailLogEntity.getApplicationId());
|
||||
pecMailResponse.setCallName(callName);
|
||||
pecMailResponse.setType(emailLogEntity.getEmailType());
|
||||
pecMailResponse.setSubject(emailLogEntity.getEmailSubject());
|
||||
pecMailResponse.setHtmlContent(emailLogEntity.getEmailBody());
|
||||
pecMailResponse.setCallId(emailLogEntity.getCallId());
|
||||
return pecMailResponse;
|
||||
}
|
||||
public List<PecMailResponse> getAllEmailLogs(HttpServletRequest request) {
|
||||
List<EmailLogEntity> emailLogs=emailLogRepository.findPendingPECEmailLogs();
|
||||
List<PecMailResponse> pecMailResponses=new ArrayList<>();
|
||||
for (EmailLogEntity emailLogEntity: emailLogs){
|
||||
ApplicationEntity applicationEntity=applicationService.validateApplication(emailLogEntity.getApplicationId());
|
||||
String callName=applicationEntity.getCall().getName();
|
||||
PecMailResponse pecMailResponse=createPecMailResponse(emailLogEntity.getUserAction().getId(),emailLogEntity,callName);
|
||||
pecMailResponses.add(pecMailResponse);
|
||||
}
|
||||
return pecMailResponses;
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ package net.gepafin.tendermanagement.enums;
|
||||
import com.fasterxml.jackson.annotation.JsonValue;
|
||||
|
||||
public enum StatusTypeEnum {
|
||||
|
||||
PENDING ("PENDING"),
|
||||
SUCCESS ("SUCCESS"),
|
||||
FAILED("FAILED");
|
||||
|
||||
|
||||
@@ -229,7 +229,10 @@ public enum UserActionContextEnum {
|
||||
UPDATE_APPLICATION_CONTRACT("UPDATE_APPLICATION_CONTRACT"),
|
||||
FETCH_APPLICATION_CONTRACT("FETCH_APPLICATION_CONTRACT"),
|
||||
FETCH_APPLICATION_CONTRACT_BY_APPLICATION_ID("FETCH_APPLICATION_CONTRACT_BY_APPLICATION_ID"),
|
||||
FETCH_APPLICATION_CONTRACT_BY_BENEFICIARY_USER_ID("FETCH_APPLICATION_CONTRACT_BY_BENEFICIARY_USER_ID");
|
||||
FETCH_APPLICATION_CONTRACT_BY_BENEFICIARY_USER_ID("FETCH_APPLICATION_CONTRACT_BY_BENEFICIARY_USER_ID"),
|
||||
SEND_PEC_MAIL("SEND_PEC_MAIL"),
|
||||
FETCH_EMAIL_LOG("FETCH_EMAIL_LOG"),
|
||||
FETCH_ALL_EMAIL_LOG("FETCH_ALL_EMAIL_LOG");
|
||||
|
||||
|
||||
private final String value;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package net.gepafin.tendermanagement.model.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class EmailLogResponse {
|
||||
|
||||
private String recipientType;
|
||||
|
||||
private Long recipientId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package net.gepafin.tendermanagement.model.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class PecEmailLogResponse {
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long userActionId;
|
||||
|
||||
private Long userId;
|
||||
|
||||
private Long applicationId;
|
||||
|
||||
private String callName;
|
||||
|
||||
private EmailLogResponse emailLogs;
|
||||
|
||||
private String type;
|
||||
|
||||
private String subject;
|
||||
|
||||
private String htmlContent;
|
||||
|
||||
private Long callId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package net.gepafin.tendermanagement.model.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class PecMailResponse {
|
||||
|
||||
private Long id;
|
||||
|
||||
private Long userActionId;
|
||||
|
||||
private Long userId;
|
||||
|
||||
private Long applicationId;
|
||||
|
||||
private String callName;
|
||||
|
||||
private String type;
|
||||
|
||||
private String subject;
|
||||
|
||||
private String htmlContent;
|
||||
|
||||
private Long callId;
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package net.gepafin.tendermanagement.repositories;
|
||||
import net.gepafin.tendermanagement.entities.EmailLogEntity;
|
||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@@ -23,6 +24,10 @@ public interface EmailLogRepository extends JpaRepository<EmailLogEntity,Long> {
|
||||
String sendStatus
|
||||
);
|
||||
|
||||
@Query(value = """
|
||||
SELECT DISTINCT ON (user_action_id) * FROM email_log WHERE send_status = 'PENDING' AND is_deleted = false AND email_service_type = 'PEC_SERVICE' """, nativeQuery = true)
|
||||
List<EmailLogEntity> findPendingPECEmailLogs();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package net.gepafin.tendermanagement.service;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.model.response.PecEmailLogResponse;
|
||||
import net.gepafin.tendermanagement.model.response.PecMailResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface PecMailService {
|
||||
|
||||
public PecMailResponse sendPecMail(HttpServletRequest request, List<Long> userActionIds);
|
||||
|
||||
public List<PecEmailLogResponse> getEmailLogByUserActionId(HttpServletRequest request, Long userActionId);
|
||||
|
||||
public List<PecMailResponse> getAllEmailLogs(HttpServletRequest request);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package net.gepafin.tendermanagement.service.impl;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.dao.PecMailDao;
|
||||
import net.gepafin.tendermanagement.model.response.PecEmailLogResponse;
|
||||
import net.gepafin.tendermanagement.model.response.PecMailResponse;
|
||||
import net.gepafin.tendermanagement.service.PecMailService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class PecMailSerivceImpl implements PecMailService {
|
||||
|
||||
@Autowired
|
||||
private PecMailDao pecMailDao;
|
||||
|
||||
@Override
|
||||
public PecMailResponse sendPecMail(HttpServletRequest request, List<Long> userActionIds) {
|
||||
return pecMailDao.sendPecMail(request,userActionIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PecEmailLogResponse> getEmailLogByUserActionId(HttpServletRequest request, Long userActionId) {
|
||||
return pecMailDao.getEmailLogByUserActionId(request,userActionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PecMailResponse> getAllEmailLogs(HttpServletRequest request) {
|
||||
return pecMailDao.getAllEmailLogs(request);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package net.gepafin.tendermanagement.web.rest.api;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
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 net.gepafin.tendermanagement.model.request.NotificationReq;
|
||||
import net.gepafin.tendermanagement.model.response.NotificationResponse;
|
||||
import net.gepafin.tendermanagement.model.response.PecEmailLogResponse;
|
||||
import net.gepafin.tendermanagement.model.response.PecMailResponse;
|
||||
import net.gepafin.tendermanagement.model.util.Response;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.ErrorConstants;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface PecMailApi {
|
||||
|
||||
@Operation(summary = "Api to send mail from pec.", responses = { @ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = @ExampleObject(value =
|
||||
ErrorConstants.NOTFOUND_ERROR_EXAMPLE))),
|
||||
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = @ExampleObject(value =
|
||||
ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE))),
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = @ExampleObject(value =
|
||||
ErrorConstants.BADREQUEST_ERROR_EXAMPLE))) })
|
||||
@PostMapping(value = "/userAction", produces = "application/json")
|
||||
ResponseEntity<Response<PecMailResponse>> sendPecMail(HttpServletRequest request,
|
||||
@Parameter(description = "The user action id", required = true) @RequestParam("userActionIds") List<Long> userActionIds);
|
||||
|
||||
|
||||
@Operation(summary = "Api to get email log by user action id", responses = { @ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = @ExampleObject(value =
|
||||
ErrorConstants.NOTFOUND_ERROR_EXAMPLE))),
|
||||
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = @ExampleObject(value =
|
||||
ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE))),
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = @ExampleObject(value =
|
||||
ErrorConstants.BADREQUEST_ERROR_EXAMPLE))) })
|
||||
@GetMapping(value = "/userAction/{userActionId}", produces = "application/json")
|
||||
ResponseEntity<Response<List<PecEmailLogResponse>>> getEmailLogByUserActionId(HttpServletRequest request,
|
||||
@Parameter(description = "The user action id", required = true) @PathVariable("userActionId") Long userActionId);
|
||||
|
||||
@Operation(summary = "Api to get all email logs", responses = { @ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = @ExampleObject(value =
|
||||
ErrorConstants.NOTFOUND_ERROR_EXAMPLE))),
|
||||
@ApiResponse(responseCode = "401", description = "Unauthorized", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = @ExampleObject(value =
|
||||
ErrorConstants.UNAUTHORIZED_ERROR_EXAMPLE))),
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = @ExampleObject(value =
|
||||
ErrorConstants.BADREQUEST_ERROR_EXAMPLE))) })
|
||||
@GetMapping(value = "",produces = "application/json")
|
||||
ResponseEntity<Response<List<PecMailResponse>>> getAllEmailLogs(HttpServletRequest request);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package net.gepafin.tendermanagement.web.rest.api.impl;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import net.gepafin.tendermanagement.config.Translator;
|
||||
import net.gepafin.tendermanagement.constants.GepafinConstant;
|
||||
import net.gepafin.tendermanagement.enums.UserActionContextEnum;
|
||||
import net.gepafin.tendermanagement.enums.UserActionLogsEnum;
|
||||
import net.gepafin.tendermanagement.model.request.UserActionRequest;
|
||||
import net.gepafin.tendermanagement.model.response.ApplicationAmendmentRequestResponse;
|
||||
import net.gepafin.tendermanagement.model.response.PecEmailLogResponse;
|
||||
import net.gepafin.tendermanagement.model.response.PecMailResponse;
|
||||
import net.gepafin.tendermanagement.model.util.Response;
|
||||
import net.gepafin.tendermanagement.service.PecMailService;
|
||||
import net.gepafin.tendermanagement.util.LoggingUtil;
|
||||
import net.gepafin.tendermanagement.web.rest.api.PecMailApi;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.Status;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("${openapi.gepafin.base-path:/v1/pecMail}")
|
||||
public class PecMailController implements PecMailApi {
|
||||
|
||||
@Autowired
|
||||
private LoggingUtil loggingUtil;
|
||||
|
||||
@Autowired
|
||||
private PecMailService pecMailService;
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<PecMailResponse>> sendPecMail(HttpServletRequest request,List<Long> userActionIds) {
|
||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.EMAIL)
|
||||
.actionContext(UserActionContextEnum.SEND_PEC_MAIL).build());
|
||||
|
||||
// PecMailResponse pecMailResponse=pecMailService.sendPecMail(request,userActionId);
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.MAIL_SENT_SUCCESSFULLY)));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<List<PecEmailLogResponse>>> getEmailLogByUserActionId(HttpServletRequest request, Long userActionId) {
|
||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.EMAIL)
|
||||
.actionContext(UserActionContextEnum.FETCH_EMAIL_LOG).build());
|
||||
|
||||
List<PecEmailLogResponse> pecEmailLogResponse=pecMailService.getEmailLogByUserActionId(request,userActionId);
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(pecEmailLogResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.EMAIL_LOG_FETCHED)));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<List<PecMailResponse>>> getAllEmailLogs(HttpServletRequest request) {
|
||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.EMAIL)
|
||||
.actionContext(UserActionContextEnum.FETCH_ALL_EMAIL_LOG).build());
|
||||
|
||||
List<PecMailResponse> pecMailResponses=pecMailService.getAllEmailLogs(request);
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(pecMailResponses, Status.SUCCESS, Translator.toLocale(GepafinConstant.EMAIL_LOG_FETCHED)));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user