Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented CRUD operations for Product Module #45

Merged
merged 5 commits into from
Oct 19, 2024

Conversation

PALASH2201
Copy link
Contributor

Issue: #2
This PR introduces the following features to the project:

  1. RESTful APIs for Product Module:
  • Implemented CRUD (Create, Read, Update, Delete) operations for managing products.
  • Endpoints created:
    • POST /api/products Create a new product.
    • GET /api/product: Retrieve a list of all products.
    • GET /api/product/id/{id}: Retrieve a specific product by ID.
    • PUT /api/product/id/{id}: Update an existing product by ID.
    • DELETE /api/product/id/{id}: Delete a product by ID.
  • Utilized best practices for API design and ensured proper response codes and messages.
  1. Spring Security Integration:
    • Integrated Spring Security to provide a foundational layer of security for the application.
    • Currently, all endpoints are secured using a basic auth username (user) and a password generated in console.
    • Future iterations will include role-based access control and secure endpoints.

Testing:

  • Manual testing performed using Postman to verify API responses and status codes.

Notes:

Please review the code changes and provide feedback.
I look forward to suggestions for improvements, especially concerning the security configuration.
Thank you for considering this PR!

@PALASH2201
Copy link
Contributor Author

@khanhduzz Can you approve the further checks?

@codecov-commenter
Copy link

codecov-commenter commented Oct 7, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 0% with 20 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...n/java/com/fjb/product/service/ProductService.java 0.00% 20 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Files with missing lines Coverage Δ Complexity Δ
...n/java/com/fjb/product/service/ProductService.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)

... and 3 files with indirect coverage changes

@khanhduzz
Copy link
Owner

khanhduzz commented Oct 7, 2024

I’m swamped with deadlines at the company right now. I’m working on integrating Keycloak with Swagger and adding security to our services, so it might take me a bit longer to review your code. Please bear with me! Thank you @PALASH2201.

@PALASH2201
Copy link
Contributor Author

@khanhduzz I have pulled the latest changes, any configurations I have to make in my local machine to run the latest changes?

@khanhduzz
Copy link
Owner

@PALASH2201 I have already setup some container and we will be able to run with Swagger, I will up a guideline tomorrow! So, you can follow it and run the project

@PALASH2201
Copy link
Contributor Author

Ok, thanks!

@khanhduzz
Copy link
Owner

@PALASH2201 Hi Palash, I've updated the wiki with instructions on how to run the project. Please take a look!

@PALASH2201
Copy link
Contributor Author

@khanhduzz Ok, I'll look into it.

@PALASH2201
Copy link
Contributor Author

@khanhduzz I have tested it, working fine. Actually, I had a doubt about the try catch block in Controller , can you provide some sample as how do you want the exceptions to be handled?

@khanhduzz
Copy link
Owner

@PALASH2201

  • It's okay, but I think it will take some time to finish. I will implement the ExceptionHandler in the Product module soon!
  • Btw, If you have time and want to contribute, I think task Design product with attributes #18 would be a good fit for you. Since products on an e-commerce website usually have many attributes like name, slug, title, description, images, prices, brand, category, etc., a product may also have many variations. For example, a Dell laptop might come in different colors like black and white, and have varying RAM options like 4GB, 8GB, or 16GB, as well as different disk capacities. Designing a good product structure with all its attributes is always more challenging than it seems. If you're willing to help, you can write documentation in Markdown or create diagrams using draw.io, then push the code to the docs folder in the project. Thank you.

@PALASH2201
Copy link
Contributor Author

@khanhduzz I can do the Exception Handling, I just wanted to know how you want it to be implemented.
And about the Product structure I will look into it and get back to you with a draft

@HiddenCa
Copy link
Collaborator

Hi @PALASH2201, It seems there is an issue with a merge conflict. If you're unsure about how to resolve it, you might want to consider closing this PR, pulling the latest code from the main branch, and then creating a new PR. Thanks!

@PALASH2201
Copy link
Contributor Author

@khanhduzz I have added the exception handling as instructed.

docker/postgres/Dockerfile Show resolved Hide resolved
product/.gitignore Outdated Show resolved Hide resolved
product/pom.xml Show resolved Hide resolved
product/src/main/resources/.env.example Outdated Show resolved Hide resolved
docker-compose.yml Outdated Show resolved Hide resolved
@khanhduzz
Copy link
Owner

Hi @PALASH2201 , I already added some comments, please check it, thank you!
Could you explain to me why you move this file? Thanks.
image

@PALASH2201
Copy link
Contributor Author

@khanhduzz I added Sell-bff as a module, so maybe because of that it moved

@khanhduzz
Copy link
Owner

@PALASH2201 Omg, it's been a hectic day! I'll try to review everything tomorrow when I have more time. Thanks for your patience!

@PALASH2201
Copy link
Contributor Author

@khanhduzz No problem, just that its been many days this pr is open thats why wanted to wrap this up

@khanhduzz
Copy link
Owner

Hi @PALASH2201, I've added some comments—please review them. Thank you so much for your great effort in tackling this issue. I'm looking forward to approving your PR.

Copy link

@PALASH2201
Copy link
Contributor Author

@khanhduzz I have made the changes

Copy link
Owner

@khanhduzz khanhduzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @PALASH2201 I believe we can improve some parts of this code later, but we can address that in a future PR. The first step is always the hardest, so I'll go ahead and approve this PR.

You can merge when have 2 approve, remember using Squash and merge, thank you!

@PALASH2201
Copy link
Contributor Author

@khanhduzz can you merge and add hacktoberfest-accepted label ?

@khanhduzz
Copy link
Owner

@PALASH2201 Do not need to add label, this repo is already registered. You can merge it

@khanhduzz khanhduzz merged commit 5051dbf into khanhduzz:main Oct 19, 2024
32 checks passed
@PALASH2201 PALASH2201 deleted the product/crud-ops branch October 19, 2024 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants