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

ID retrieve issue in create cashier endpoint #92

Closed TheTharz closed 6 months ago

TheTharz commented 6 months ago

Issue Description

Problem

When creating a new cashier using the API endpoint /employers/save-without-image, the response always returns an ID of 0 instead of the expected unique ID for the newly created cashier.

Steps to Reproduce

  1. Send a POST request to the /employers/save-without-image endpoint with valid data for creating a new cashier.
  2. Receive the response from the server.
  3. Check the ID field in the response.

Expected Behavior

The response should include a unique ID for the newly created cashier, allowing us to identify and work with this cashier in subsequent operations.

Actual Behavior

The ID in the response is consistently returning as 0, which does not match the expected behavior.

{
    "code": 201,
    "message": "successfully saved",
    "data": {
        "employerId": 0,
        "branchId": 3,
        "employerNicName": "mfwefgewgwegwegama",
        "employerFirstName": "John",
        "employerLastName": "Doe",
        "employerPassword": "secretpassword",
        "employerEmail": "john@,mm,,mdnfkjfnewefewfwefwewjkfwke.com",
        "employerPhone": "+1234567890",
        "employerAddress": "123 Main Street",
        "employerSalary": 50000.0,
        "employerNic": "ABCD1234",
        "gender": "MALE",
        "dateOfBirth": "1990-01-01T00:00:00.000+00:00",
        "role": "OWNER",
        "pin": 1234,
        "activeStatus": true
    }
}

For a different cashier creation


{
    "code": 201,
    "message": "successfully saved",
    "data": {
        "employerId": 0,
        "branchId": 3,
        "employerNicName": "mama",
        "employerFirstName": "John",
        "employerLastName": "Doe",
        "employerPassword": "secretpassword",
        "employerEmail": "john@,mm,,mdnfkjfnewjkfwke.com",
        "employerPhone": "+1234567890",
        "employerAddress": "123 Main Street",
        "employerSalary": 50000.0,
        "employerNic": "ABCD1234",
        "gender": "MALE",
        "dateOfBirth": "1990-01-01T00:00:00.000+00:00",
        "role": "OWNER",
        "pin": 1234,
        "activeStatus": true
    }
}
PramithaMJ commented 6 months ago

Pull Request to Close Issue #93 Fix Issue with Employer ID in Response

Issue Description

Problem: When creating a new cashier using the API endpoint /employers/save-without-image, the response always returns an ID of 0 instead of the expected unique ID for the newly created cashier.

Steps to Reproduce:

  1. Send a POST request to the /employers/save-without-image endpoint with valid data for creating a new cashier.
  2. Receive the response from the server.
  3. Check the ID field in the response.

Expected Behavior: The response should include a unique ID for the newly created cashier, allowing us to identify and work with this cashier in subsequent operations.

Actual Behavior: The ID in the response is consistently returning as 0, which does not match the expected behavior.

Resolution

The issue was fixed in PR #93.

Changes Implemented

Verification

After merging PR #93, the response for creating a new cashier now correctly includes a unique ID. Below are sample responses for verification:

Previous Response:

{
    "code": 201,
    "message": "successfully saved",
    "data": {
        "employerId": 0,
        "branchId": 3,
        "employerNicName": "mfwefgewgwegwegama",
        "employerFirstName": "John",
        "employerLastName": "Doe",
        "employerPassword": "secretpassword",
        "employerEmail": "john@,mm,,mdnfkjfnewefewfwefwewjkfwke.com",
        "employerPhone": "+1234567890",
        "employerAddress": "123 Main Street",
        "employerSalary": 50000.0,
        "employerNic": "ABCD1234",
        "gender": "MALE",
        "dateOfBirth": "1990-01-01T00:00:00.000+00:00",
        "role": "OWNER",
        "pin": 1234,
        "activeStatus": true
    }
}

Updated Response:

{
    "code": 201,
    "message": "successfully saved",
    "data": {
        "employerId": 1,
        "branchId": 3,
        "employerNicName": "mfwefgewgwegwegama",
        "employerFirstName": "John",
        "employerLastName": "Doe",
        "employerPassword": "secretpassword",
        "employerEmail": "john@,mm,,mdnfkjfnewefewfwefwewjkfwke.com",
        "employerPhone": "+1234567890",
        "employerAddress": "123 Main Street",
        "employerSalary": 50000.0,
        "employerNic": "ABCD1234",
        "gender": "MALE",
        "dateOfBirth": "1990-01-01T00:00:00.000+00:00",
        "role": "OWNER",
        "pin": 1234,
        "activeStatus": true
    }
}

The issue has been successfully resolved with the merge of PR #93. The response now correctly includes the unique ID for the newly created cashier.

Comment for Closing the Issue:

The issue with creating a new cashier and receiving an ID of 0 in the response has been resolved. The fix has been implemented and merged in PR #93. The response now correctly includes a unique ID for the newly created cashier. This issue can be closed.

Thanks to everyone involved for their contributions!

Please use the above comment to close the issue on your repository.

Best regards, Pramitha Jayasooriya Backend Developer at LifePill https://pramithamj@gmail.com