sivalabs-bookstore / catalog-service-java-springboot

Catalog Service using Java + SpringBoot
MIT License
1 stars 6 forks source link

API for delete product #4

Open sivaprasadreddy opened 1 year ago

sivaprasadreddy commented 1 year ago

Story: Delete or disable a Product

As there could be orders placed with the product, we should soft delete the product, may be using a "disabled" property.

Note: As security approach is not yet decided for now we can proceed without Authentication and later add security support (most likely OAuth security)

Endpoint : DELETE /api/products/{code} Security: N/A

Success Response: Status Code: 200

Error Response - Not Found Reasons: Book with ISBN not exist etc. Status Code: 404 Body:

  {
      "message": "Product with ISBN not exist"
  } 
ahmedmq commented 1 year ago

I can work on this one too and this completes most CRUD functionality

mohanraok commented 1 year ago

@sivaprasadreddy - I'm interested to work on this, please assign it to me.

sivaprasadreddy commented 1 year ago

Assigned to you @mohanraok

rajadilipkolli commented 1 year ago

Story: Delete or disable a Product

As there could be orders placed with the product, we should soft delete the product, may be using a "disabled" property.

Note: As security approach is not yet decided for now we can proceed without Authentication and later add security support (most likely OAuth security)

Endpoint : DELETE /api/products/{code} Security: N/A

Success Response: Status Code: 200

Error Response - Not Found Reasons: Book with ISBN not exist etc. Status Code: 404 Body:

  {
      "message": "Product with ISBN not exist"
  } 

Hi @sivaprasadreddy , should we use ProblemDetails as standard response type for all negative scenarios to be consistent?

sivaprasadreddy commented 1 year ago

@rajadilipkolli That's a good point and yes, we should agree upon some standard error response format and use ProblemDetails.

Could you own coming up with response structure and update it in https://github.com/sivalabs-bookstore/bookstore?

mohanraok commented 1 year ago

@sivaprasadreddy I've completed code changes for delete API, will create PR. Sample Responses:

image image image
rajadilipkolli commented 1 year ago

Looks promising, I would like to add type of error as well to the response so that it can be filtered in future.

On Thu, 5 Jan, 2023, 18:56 mohanraok, @.***> wrote:

I've completed code changes for delete API, will create PR. Sample Responses: [image: image] https://user-images.githubusercontent.com/10477183/210790263-2a6fa14a-2625-4a8e-a6b1-a68a8ec6b6d7.png [image: image] https://user-images.githubusercontent.com/10477183/210790430-e705d80a-01c2-450b-9d66-c1edb2a514ec.png [image: image] https://user-images.githubusercontent.com/10477183/210790540-c8fab934-353a-4d4b-91e5-45e187f47adb.png

— Reply to this email directly, view it on GitHub https://github.com/sivalabs-bookstore/catalog-service-java-springboot/issues/4#issuecomment-1372214667, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF45J3CSI2BZ42FTPLNIPO3WQ3DZ7ANCNFSM6AAAAAAS2KNRI4 . You are receiving this because you were mentioned.Message ID: <sivalabs-bookstore/catalog-service-java-springboot/issues/4/1372214667@ github.com>

praveenkumar7255 commented 1 year ago

Hello @rajadilipkolli Please help me to run this project locally. I'm getting Authentication failed while trying to connect with Mongodb and the next thing regarding to delete product API , we need to introduce new field in Product entity and some places .I wrote an API that I need to test .If possible Please help me brother @rajadilipkolli .

rajadilipkolli commented 1 year ago

Hi @praveenkumar7255 , did you tried to bring mongodb up by using the docker compose file present in the root of this project??

Incase of your using software installed in your local please update the username and password as well as database in the application.properties

rajadilipkolli commented 1 year ago

@rajadilipkolli That's a good point and yes, we should agree upon some standard error response format and use ProblemDetails.

Could you own coming up with response structure and update it in https://github.com/sivalabs-bookstore/bookstore?

Hi @sivaprasadreddy, Created PR, can you please review.