Life-Pill / pharmacy-pos-main-backend

The Pharmacy POS System Backend is the server-side component of our comprehensive pharmacy management software. It is developed using Spring Boot, Java, Spring Security ,and Microservices Architecture
Apache License 2.0
5 stars 3 forks source link

Fix branchId always returning zero in endpoint /lifepill/v1/employers/get-by-id and bug FIxed #111

Closed PramithaMJ closed 5 months ago

PramithaMJ commented 5 months ago

Pull Request Title:

Fix branchId always returning zero in endpoint /lifepill/v1/employers/get-by-id

Issue

110 branchId always returns zero in endpoint /lifepill/v1/employers/get-by-id

Description: This PR addresses the issue where the branchId field was consistently returning zero when accessing the endpoint /lifepill/v1/employers/get-by-id. The root cause of the issue was identified and a fix has been implemented to ensure that the branchId field now correctly returns the assigned branch ID for the employer.

Changes Made:

  1. Updated the Employer entity to ensure that the branchId field is correctly mapped and serialized.
  2. Adjusted the EmployerService to correctly fetch and assign the branchId during data retrieval.
  3. Added additional checks in the EmployerController to validate the branchId before returning the response.

How to Test:

  1. Pull the changes from this PR and build the project.
  2. Make a request to the /lifepill/v1/employers/get-by-id endpoint with an employer ID.
  3. Verify that the branchId field in the response now correctly returns the assigned branch ID for the employer.

This fix should resolve the issue and ensure the accuracy of employer data retrieval.

Best regards,
Pramitha Jayasooriya, Backend Developer at LifePill, https://pramithamj.me

sonarcloud[bot] commented 5 months ago

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)
D Reliability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint