This project is a Web API for managing a product catalog and user reviews, developed in C# using .NET Web API. It follows best practices of RESTful API development to ensure scalability and maintainability.
- CRUD Operations: Manage products and reviews.
- Authentication & Authorization: Secure API endpoints with JWT authentication and role-based access control.
- Swagger Documentation: Automatically generated API documentation.
- Logging & Monitoring: Detailed logging for monitoring and debugging.
- Pagination: Efficient handling of large datasets.
- Update the connection string in
ProjectDbContextto match your SQL Server configuration:optionsBuilder .UseSqlServer("Server=your_server;Database=Project;User Id=your_user;Password=your_password;TrustServerCertificate=True") .LogTo(Console.WriteLine);
- Build the project:
dotnet build
- Run the project:
dotnet run
-
Get All Products:
- URL:
/api/produs/get-products - Method:
POST - Description: Endpoint to retrieve a list of all products.
- Request Body:
GetProduseRequest - Response:
GetProduseResponse
- URL:
-
Get Product by ID (Special):
- URL:
/api/produs/{produsId}/get-details - Method:
GET - Description: Endpoint to retrieve details of a specific product.
- Parameters:
produsId(required) - Authorization: Requires role
Admin. - Response:
GetProdusResponse
- URL:
-
Get Reviews by Product ID:
- URL:
/api/review/produs/{produsId}/reviews - Method:
GET - Description: Endpoint to retrieve reviews for a specific product.
- Parameters:
produsId(required) - Response: List of reviews
- URL:
-
Add Review:
- URL:
/api/review/add - Method:
POST - Description: Endpoint to add a new review.
- Request Body:
AddReviewRequest - Authorization: Requires role
User. - Response: Success message
- URL:
-
Update Review:
- URL:
/api/review/{reviewId}/edit-review - Method:
PUT - Description: Endpoint to update an existing review.
- Parameters:
reviewId(required) - Request Body:
UpdateReviewRequest - Authorization: Requires role
User. - Response: Success message
- URL:
-
Delete Review:
- URL:
/api/review/delete-review - Method:
DELETE - Description: Endpoint to delete an existing review.
- Parameters:
reviewId(required) - Authorization: Requires role
User. - Response: Success message
- URL:
-
Register:
- URL:
/register - Method:
POST - Description: Endpoint to register a new user.
- Request Body:
RegisterRequest - Authorization: Public (No authentication required).
- Response: Success message
- URL:
-
Login:
- URL:
/login - Method:
POST - Description: Endpoint to authenticate a user and generate a JWT token.
- Request Body:
LoginRequest - Authorization: Public (No authentication required).
- Response: JWT token
- URL:
- .NET 6
- Entity Framework Core
- SQL Server
- Swagger for API documentation
- JWT Authentication
- Fork the repository
- Create a new branch (
git checkout -b feature-branch) - Make your changes
- Commit your changes (
git commit -m 'Add some feature') - Push to the branch (
git push origin feature-branch) - Open a Pull Request
✍️ by Teulea Ioan Octavian
