From d7496569c0a39d0e443f72e18a3c754c23f4f5c3 Mon Sep 17 00:00:00 2001 From: ymahtat-dev <71645850+ymahtat-dev@users.noreply.github.com> Date: Wed, 22 Jan 2025 14:00:22 +0100 Subject: [PATCH] MOSIP-36852 - fix scenario3 (Prereg_BookAppointmentByPRID_blank_preRegistrationId) (#800) * MOSIP-36852 - fix scenario3 (Prereg_BookAppointmentByPRID_blank_preRegistrationId) (#754) Signed-off-by: ymahtat-dev Signed-off-by: Youssef MAHTAT * MOSIP-36852 - github actions fix - update actions/upload-artifact to version 4 Signed-off-by: Youssef MAHTAT --------- Signed-off-by: ymahtat-dev Signed-off-by: Youssef MAHTAT --- .github/workflows/push-trigger.yml | 2 +- .../application/service/AppointmentServiceImpl.java | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/push-trigger.yml b/.github/workflows/push-trigger.yml index c9d2903a55..b1ec6b6230 100644 --- a/.github/workflows/push-trigger.yml +++ b/.github/workflows/push-trigger.yml @@ -153,7 +153,7 @@ jobs: find ${{ env.SERVICE_LOCATION }} -path '*/target/*' -exec zip ${{ env.BUILD_ARTIFACT }}.zip {} + - name: Upload the springboot jars if: ${{ !contains(github.ref, 'master') || !contains(github.ref, 'main') }} - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ env.BUILD_ARTIFACT }} path: ${{ env.BUILD_ARTIFACT }}.zip diff --git a/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/AppointmentServiceImpl.java b/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/AppointmentServiceImpl.java index 069a8553b7..921bf7167b 100644 --- a/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/AppointmentServiceImpl.java +++ b/pre-registration/pre-registration-application-service/src/main/java/io/mosip/preregistration/application/service/AppointmentServiceImpl.java @@ -147,6 +147,7 @@ public MainResponseDTO getAppointmentDetails(String preR } private void userValidation(String applicationId) { + this.applicationIdValidation(applicationId); String authUserId = authUserDetails().getUserId(); List list = listAuth(authUserDetails().getAuthorities()); if (list.contains("ROLE_INDIVIDUAL")) { @@ -155,7 +156,7 @@ private void userValidation(String applicationId) { + " and userID " + authUserId); ApplicationEntity applicationEntity = null; try { - applicationEntity = applicationRepostiory.findByApplicationId(applicationId); + applicationEntity = applicationRepostiory.findById(applicationId).orElseThrow(); } catch (Exception ex) { log.error(LOGGER_SESSIONID, LOGGER_IDTYPE, LOGGER_ID, "Invaid applicationId/Not Record Found for the ID : " + applicationId); @@ -169,6 +170,15 @@ private void userValidation(String applicationId) { } } + private void applicationIdValidation(String applicationId) { + if (applicationId == null || applicationId.trim().isEmpty()) { + throw new AppointmentExecption( + ApplicationErrorCodes.PRG_APP_013.getCode(), + "preRegistrationId cannot be empty." + ); + } + } + /** * This method is used to get the list of authorization role *