Order Management System REST API
This project was intended to develop a simplified Order Management System to demonstrate my abilities in C#, .NET, Microsoft SQL Server, Entity Framework, T-SQL, and stored procedures.
The system has REST API endpoints that read, create, update, and delete entities:
- General
- Customers
- Security
- Users
- Stock
- Orders
- Products
This project implements SOLID principles, along with the following design patterns:
- Dependency Injection (DI)
- Repository Pattern
- Unit of work
- Product: Products have an ID, name, and price.
- Order: Orders have an ID, a customer ID, a product ID, the quantity of the product, and the total cost.
- At least validate that product ID exists when creating an order and that the quantity is positive.
- Product: A GET endpoint to read a product by its ID.
- Order: A POST endpoint to create a new order and a GET endpoint to read an order by its ID.
- Microsoft SQL Server and Entity Framework to interact with the database.
Defined the DbContext and the DbSet for each entity and wrote LINQ queries to perform the read operations. - T-SQL will be used to create the tables and pre-populate them with some initial data.
- Wrote a stored procedure to calculate the total cost and create a new order.
- Call this stored procedure from your C# code using Entity Framework when the POST endpoint for creating a new order is hit.
- All POST endpoints require authentication;
- Using ASP.NET Identity with JWT.
🔶 TODO: Optional: role-based authorization (no specifications for roles)
- Critical unit tests to validate the functionality of the API endpoints and the stored procedure.
- Tests created using xUnit and MOQ.
Here are some extra features added to this project to highlight my work.
- ✅ Added the
Customers
entity
- ✅ Mocked database operations
- 🔲 TODO: Integration testing to test the stored procedure
- ✅ Use JWT authentication for the POST endpoint
- ✅ Paginate and sort all GET endpoints
- 🔲 TODO: Implement logging with Serilog or NLog
- ✅ Dockerized the application
- ✅ TODO: API documentation using Swagger
- 🔲 TODO: Create a basic web client using TypeScript