Resolved conflicts
This commit is contained in:
@@ -33,7 +33,7 @@ public interface CommunicationApi {
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||
@PostMapping(value = "/{amendmentId}", produces = { "application/json" })
|
||||
@PreAuthorize("hasRole('ROLE_PRE_INSTRUCTOR') || hasRole('ROLE_BENEFICIARY')")
|
||||
@PreAuthorize("hasRole('ROLE_PRE_INSTRUCTOR') || hasRole('ROLE_BENEFICIARY') || hasRole('ROLE_INSTRUCTOR_MANAGER')")
|
||||
ResponseEntity<Response<CommunicationResponseBean>> addCommentToAmendmentRequest(HttpServletRequest request,
|
||||
@RequestBody @Parameter CommunicationRequestBean communicationResponseBean, @PathVariable(value = "amendmentId") Long amendmentId);
|
||||
|
||||
@@ -55,7 +55,7 @@ public interface CommunicationApi {
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||
@PutMapping(value = "/{amendmentId}/{commentId}", produces = { "application/json" })
|
||||
@PreAuthorize("hasRole('ROLE_PRE_INSTRUCTOR') || hasRole('ROLE_BENEFICIARY')")
|
||||
@PreAuthorize("hasRole('ROLE_PRE_INSTRUCTOR') || hasRole('ROLE_BENEFICIARY') || hasRole('ROLE_INSTRUCTOR_MANAGER')")
|
||||
ResponseEntity<Response<CommunicationResponseBean>> updateCommunicationAmendment(HttpServletRequest request,
|
||||
@RequestBody @Parameter CommunicationRequestBean communicationResponseBean, @PathVariable(value = "amendmentId") Long amendmentId, @PathVariable(value = "commentId") Long commentId);
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package net.gepafin.tendermanagement.web.rest.api;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.gepafin.tendermanagement.model.response.VatCheckResponseBean;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
@@ -94,8 +95,8 @@ public interface CompanyApi {
|
||||
@ApiResponse(responseCode = "400", description = "Bad Request", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
@ExampleObject(value = ErrorConstants.BADREQUEST_ERROR_EXAMPLE) })) })
|
||||
@GetMapping(value = "/vatNumber", produces = { "application/json" })
|
||||
ResponseEntity<Response<Map<String,Object>>> checkVatNumber(HttpServletRequest request,
|
||||
@Parameter(description = "The vatNumber of company", required = true) @RequestParam("vatNumber") String vatNumber);
|
||||
ResponseEntity<Response<VatCheckResponseBean>> checkVatNumber(HttpServletRequest request,
|
||||
@Parameter(description = "The vatNumber of company", required = true) @RequestParam("vatNumber") String vatNumber);
|
||||
|
||||
@Operation(summary = "Api to download company delegation template", responses = { @ApiResponse(responseCode = "200", description = "OK"),
|
||||
@ApiResponse(responseCode = "404", description = "Not Found", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE, examples = {
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
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.enums.NotificationEnum;
|
||||
import net.gepafin.tendermanagement.model.request.NotificationReq;
|
||||
import net.gepafin.tendermanagement.model.response.NotificationResponse;
|
||||
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.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface NotificationApi {
|
||||
@Operation(summary = "Api to send notification.", 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 = "/user/{userId}/sent", consumes = "application/json", produces = "application/json")
|
||||
ResponseEntity<Response<NotificationResponse>> sendNotification(HttpServletRequest request, @RequestBody NotificationReq notificationReq,
|
||||
@Parameter(description = "The user id", required = true) @PathVariable("userId") Long userId,
|
||||
@Parameter(description = "The company id", required = false) @RequestParam(value = "companyId", required = false) Long companyId);
|
||||
|
||||
@Operation(summary = "Api to get notification by 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 = "/{id}", produces = "application/json")
|
||||
ResponseEntity<Response<NotificationResponse>> getNotificationById(HttpServletRequest request,
|
||||
@Parameter(description = "The notification id", required = true) @PathVariable(value = "id", required = true) Long id);
|
||||
|
||||
@Operation(summary = "Api to get notification by user 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 = "/user/{userId}", produces = "application/json")
|
||||
ResponseEntity<Response<List<NotificationResponse>>> getNotificationByUserId(HttpServletRequest request,
|
||||
@Parameter(description = "The user id", required = true) @PathVariable(value = "userId", required = true) Long userId,
|
||||
@Parameter(description = "The company id", required = false) @RequestParam(value = "companyId", required = false) Long companyId,
|
||||
@Parameter(description = "The notification status", required = false) @RequestParam(value = "status", required = false) List<NotificationEnum> statuses);
|
||||
|
||||
@Operation(summary = "Api to update notification status", 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) })) })
|
||||
@PutMapping(value = "/{id}", produces = "application/json")
|
||||
ResponseEntity<Response<NotificationResponse>> updateNotificationStatus(HttpServletRequest request,
|
||||
@Parameter(description = "The notification id", required = true) @PathVariable(value = "id", required = true) Long id,
|
||||
@Parameter(description = "The notification status", required = true) @RequestParam(value = "status", required = true) NotificationEnum status);
|
||||
|
||||
@Operation(summary = "Api to delete notification", 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) })) })
|
||||
@DeleteMapping(value = "/{id}", produces = "application/json")
|
||||
ResponseEntity<Response<Void>> deleteNotification(HttpServletRequest request,
|
||||
@Parameter(description = "The notification id", required = true) @PathVariable(value = "id", required = true) Long id);
|
||||
|
||||
@Operation(summary = "API to get notifications by user ID and company 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 = "/user/{userId}/company/{companyId}/notifications", produces = "application/json")
|
||||
ResponseEntity<Response<List<NotificationResponse>>> getNotificationsByUserIdAndCompanyId(HttpServletRequest request,
|
||||
@Parameter(description = "The user id", required = true) @PathVariable(value = "userId") Long userId,
|
||||
@Parameter(description = "The company ID", required = true) @PathVariable(value = "companyId") Long companyId,
|
||||
@Parameter(description = "The notification status", required = false) @RequestParam(value = "status", required = false) List<NotificationEnum> statuses);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ public interface UserApi {
|
||||
@RequestMapping(value = "/{userId}",
|
||||
produces = {"application/json"},
|
||||
method = RequestMethod.PUT)
|
||||
@PreAuthorize("hasRole('ROLE_SUPER_ADMIN')")
|
||||
default ResponseEntity<Response<UserResponseBean>> updateUser(HttpServletRequest request,
|
||||
@Parameter(description = "The user id", required = true) @PathVariable("userId") Long userId,
|
||||
@Parameter(description = "User request object", required = true) @Valid @RequestBody UpdateUserReq userReq) {
|
||||
@@ -118,7 +119,7 @@ public interface UserApi {
|
||||
@RequestMapping(value = "/reset-password/initiate",
|
||||
produces = {"application/json"},
|
||||
method = RequestMethod.POST)
|
||||
ResponseEntity<Response<String>> initiatePasswordReset(
|
||||
ResponseEntity<Response<Void>> initiatePasswordReset(HttpServletRequest request,
|
||||
@Parameter(description = "Initiate password reset request object", required = true) @Valid @RequestBody InitiatePasswordResetReq initiatePasswordResetReq);
|
||||
|
||||
@Operation(summary = "Api to reset password",
|
||||
@@ -131,7 +132,7 @@ public interface UserApi {
|
||||
@RequestMapping(value = "/reset-password",
|
||||
produces = {"application/json"},
|
||||
method = RequestMethod.POST)
|
||||
ResponseEntity<Response<Boolean>> resetPassword(
|
||||
ResponseEntity<Response<Boolean>> resetPassword(HttpServletRequest request,
|
||||
@Parameter(description = "Reset password request object", required = true) @Valid @RequestBody ResetPasswordReq resetPasswordReq);
|
||||
@Operation(summary = "Api to change user password",
|
||||
responses = {
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.Map;
|
||||
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.VatCheckResponseBean;
|
||||
import net.gepafin.tendermanagement.util.LoggingUtil;
|
||||
import net.gepafin.tendermanagement.web.rest.api.errors.CustomValidationException;
|
||||
import org.slf4j.Logger;
|
||||
@@ -112,15 +113,15 @@ public class CompanyApiController implements CompanyApi{
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<Map<String,Object>>> checkVatNumber(HttpServletRequest request, String vatNumber) {
|
||||
public ResponseEntity<Response<VatCheckResponseBean>> checkVatNumber(HttpServletRequest request, String vatNumber) {
|
||||
log.info("check VatNumber with: {}", vatNumber);
|
||||
|
||||
/** This code is responsible for creating user action logs for the "Check vat number" operation. **/
|
||||
loggingUtil.logUserAction(UserActionRequest.builder().request(request).actionType(UserActionLogsEnum.VIEW).actionContext(UserActionContextEnum.CHECK_COMPANY_VAT_NUMBER).build());
|
||||
|
||||
Map<String,Object> data = companyService.checkVatNumber(request, vatNumber);
|
||||
VatCheckResponseBean vatCheckResponseBean = companyService.checkVatNumber(request, vatNumber);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(data, Status.SUCCESS, Translator.toLocale(GepafinConstant.CHECK_VATNUMBER_SUCCESS_MSG)));
|
||||
.body(new Response<>(vatCheckResponseBean, Status.SUCCESS, Translator.toLocale(GepafinConstant.CHECK_VATNUMBER_SUCCESS_MSG)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.gepafin.tendermanagement.web.rest.api.impl;
|
||||
|
||||
import net.gepafin.tendermanagement.entities.RoleEntity;
|
||||
import net.gepafin.tendermanagement.entities.UserEntity;
|
||||
import net.gepafin.tendermanagement.enums.RoleStatusEnum;
|
||||
import net.gepafin.tendermanagement.repositories.UserRepository;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
@@ -35,7 +36,10 @@ public class CustomUserDetailsService implements UserDetailsService {
|
||||
String email = loginParts[0];
|
||||
String hubId = loginParts[1];
|
||||
|
||||
UserEntity user = userRepository.findByEmailIgnoreCaseAndHubUniqueUuid(email, hubId)
|
||||
UserEntity user = userRepository.findUserExcludingRoleType(
|
||||
email,
|
||||
hubId,
|
||||
RoleStatusEnum.ROLE_BENEFICIARY.getValue())
|
||||
.orElseThrow(
|
||||
() -> new UsernameNotFoundException("User " + email + " was not found in the database"));
|
||||
return createSpringSecurityUser(user);
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
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.NotificationEnum;
|
||||
import net.gepafin.tendermanagement.model.request.NotificationReq;
|
||||
import net.gepafin.tendermanagement.model.response.NotificationResponse;
|
||||
import net.gepafin.tendermanagement.model.util.Response;
|
||||
import net.gepafin.tendermanagement.service.NotificationService;
|
||||
import net.gepafin.tendermanagement.web.rest.api.NotificationApi;
|
||||
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/notification}")
|
||||
public class NotificationApiController implements NotificationApi {
|
||||
|
||||
@Autowired
|
||||
private NotificationService notificationService;
|
||||
|
||||
public ResponseEntity<Response<NotificationResponse>> sendNotification(HttpServletRequest request, NotificationReq notificationReq, Long userId, Long companyId) {
|
||||
|
||||
NotificationResponse notificationData = notificationService.sendNotification(userId, notificationReq, companyId);
|
||||
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new Response<>(notificationData, Status.SUCCESS, Translator.toLocale(GepafinConstant.NOTIFICATION_SENT_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<NotificationResponse>> getNotificationById(HttpServletRequest request, Long id) {
|
||||
|
||||
NotificationResponse notificationResponse = notificationService.getNotificationById(request, id);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(notificationResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.NOTIFICATION_FETCHED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<List<NotificationResponse>>> getNotificationByUserId(HttpServletRequest request, Long userId, Long companyId, List<NotificationEnum> statuses) {
|
||||
|
||||
List<NotificationResponse> notificationResponses = notificationService.getNotificationByUserId(request, userId, companyId, statuses);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<List<NotificationResponse>>(notificationResponses, Status.SUCCESS, Translator.toLocale(GepafinConstant.NOTIFICATION_FETCHED_SUCCESSFULLY)));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<NotificationResponse>> updateNotificationStatus(HttpServletRequest request, Long id, NotificationEnum notificationEnums) {
|
||||
|
||||
NotificationResponse notificationResponse = notificationService.updateNotificationStatus(request, id, notificationEnums);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(notificationResponse, Status.SUCCESS, Translator.toLocale(GepafinConstant.NOTIFICATION_UPDATED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<Void>> deleteNotification(HttpServletRequest request, Long id) {
|
||||
|
||||
notificationService.deleteNotification(request, id);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.NOTIFICATION_DELETED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<List<NotificationResponse>>> getNotificationsByUserIdAndCompanyId(HttpServletRequest request,Long userId, Long companyId, List<NotificationEnum> statuses) {
|
||||
List<NotificationResponse> notificationResponses = notificationService.getNotificationsByCompanyIdAndUserId(userId, companyId, statuses);
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(new Response<>(notificationResponses, Status.SUCCESS, Translator.toLocale(GepafinConstant.NOTIFICATION_FETCHED_SUCCESSFULLY)));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -125,20 +125,35 @@ public class UserApiController implements UserApi {
|
||||
@Override
|
||||
public ResponseEntity<Response<Boolean>> changePassword(HttpServletRequest httpServletRequest, @Valid @RequestBody ChangePasswordRequest request) {
|
||||
log.info("Change Password attempt for email: {}", request.getEmail());
|
||||
|
||||
/** This code is responsible for "Change user password" operation. **/
|
||||
loggingUtil.logUserAction(UserActionRequest.builder().request(httpServletRequest).actionType(UserActionLogsEnum.UPDATE)
|
||||
.actionContext(UserActionContextEnum.CHANGE_USER_PASSWORD).build());
|
||||
|
||||
userService.changePassword(httpServletRequest, request);
|
||||
return ResponseEntity.ok(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.SUCCESS_PASSWORD_CHANGED)));
|
||||
}
|
||||
@Override
|
||||
public ResponseEntity<Response<String>> initiatePasswordReset(InitiatePasswordResetReq request) {
|
||||
public ResponseEntity<Response<Void>> initiatePasswordReset(HttpServletRequest httpServletRequest,InitiatePasswordResetReq request) {
|
||||
log.info("Initiating password reset for email: {}", request.getEmail());
|
||||
String resetToken = userService.initiatePasswordReset(request);
|
||||
|
||||
/** This code is responsible for "Initiating Password Reset Request" operation. **/
|
||||
loggingUtil.logUserAction(UserActionRequest.builder().request(httpServletRequest).actionType(UserActionLogsEnum.UPDATE)
|
||||
.actionContext(UserActionContextEnum.INITIATE_PASSWORD_RESET_REQUEST).build());
|
||||
|
||||
userService.initiatePasswordReset(request);
|
||||
log.info("Password reset token generated for email: {}", request.getEmail());
|
||||
return ResponseEntity.ok(new Response<>(resetToken, Status.SUCCESS, Translator.toLocale(GepafinConstant.RESET_PASSWORD_INITIATED)));
|
||||
return ResponseEntity.ok(new Response<>(null, Status.SUCCESS, Translator.toLocale(GepafinConstant.RESET_PASSWORD_INITIATED)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseEntity<Response<Boolean>> resetPassword(ResetPasswordReq request) {
|
||||
public ResponseEntity<Response<Boolean>> resetPassword(HttpServletRequest httpServletRequest,ResetPasswordReq request) {
|
||||
log.info("Resetting password for username: {}", request.getEmail());
|
||||
|
||||
/** This code is responsible for "Resest user password" operation. **/
|
||||
loggingUtil.logUserAction(UserActionRequest.builder().request(httpServletRequest).actionType(UserActionLogsEnum.UPDATE)
|
||||
.actionContext(UserActionContextEnum.RESET_USER_PASSWORD).build());
|
||||
|
||||
Boolean success = userService.resetPassword(request);
|
||||
if (success) {
|
||||
log.info("Password reset successfully for username: {}", request.getEmail());
|
||||
|
||||
Reference in New Issue
Block a user