- Use
docker-compose.migrate.yml
to update the database. - Then use
docker-compose.yml
to run the application.
- Import
postman_colleciton
to postman to test all working endpoints. - First use
Auth/Login
to get JWT, then replace{{current_token}}
variable to apply it to all endpoints. - Or use swagger documentations.
- Use .NET Core 5.0+
- Do one task at a time.
- Use Asynchronous methods in LINQ.
- Follow GIT best practices.
You must use Git for version control and host your project on GitHub. Commit and push your changes to GitHub at the end of each phase, with meaningful commit messages describing what you have implemented in each commit.
Before we dive into the task at hand, let's first explore the Database Schema. By meticulously examining the tables, deciphering their relationships, and grasping the significance of each, we will lay a strong foundation for addressing the subsequent question.
- Create a DB named
RestaurantReservationCore
(using SSMS). - Create a console application project named
RestaurantReservation
. - Create a library project named
RestaurantReservation.Db
and reference it fromRestaurantReservation
project. - Create
RestaurantReservationDbContext
and add it toRestaurantReservation.Db
. - Create the data models for the above tables with all necessary keys, relationships, constraints, and navigations.
These models should exist in
RestaurantReservation.Db
- Write migrations to create the previous tables. Migrations should exist in
RestaurantReservation.Db
. - Seed the tables with at least 5 records in each.
- In the
RestaurantReservation
console application, demonstrate the functionality of all the methods you will create by calling them with sample data for testing purposes. - Write
Create/Update/Delete
methods for each entity. - Write methods to:
ListManagers()
: This method retrieves all employees who hold the position of "Manager."GetReservationsByCustomer(CustomerId)
: This method takes a customer identifier as a parameter and returns a list of reservations made by that particular customer.ListOrdersAndMenuItems(ReservationId)
: This method takes a reservation identifier as a parameter and lists the orders placed on that specific reservation along with the associated menu items.ListOrderedMenuItems(ReservationId)
: This method takes a reservation identifier as a parameter and finds the menu items ordered in that specific reservation.CalculateAverageOrderAmount(EmployeeId)
: This method takes an employee identifier as a parameter and calculates the average order amount for that specific employee.
- Views:
- Use EF Core to query a database view that lists all the reservations with their associated customer and restaurant information.
- Generate a query that retrieves employees with their respective restaurant details from a database view.
- Database Functions:
- Create a database function to
Calculate the total revenue generated by a specific restaurant
using Entity Framework Core migrations. - Implement the function call in your
RestaurantReservation.Db
project, making it accessible from your application.
- Create a database function to
- Stored Procedures:
- Design a stored procedure for
Finding all customers who have made reservations with a party size greater than a certain value
using Entity Framework Core migrations. - Develop a method in your RestaurantReservation.Db project to execute the stored procedure.
- Design a stored procedure for
- Create a repository class for each entity and call it:
{EntityName}Repository.cs
, and move related methods from the previous requirements to the right repository. These repositories should exist inRepositories
folderRestaurantReservation.Db
- Create a new ASP.NET Core Web API project named
RestaurantReservation.API
.
- Add a reference to the
RestaurantReservation.Db
project.
- Create API controllers for each entity and implement CRUD operations.
- Include CRUD and other specific endpoints for reservations.
- Create endpoints for additional methods, including those related to reservations.
- GET
/api/employees/managers
- List all managers. - GET
/api/reservations/customer/{customerId}
- Retrieve reservations by customer ID. - GET
/api/reservations/{reservationId}/orders
- List orders and menu items for a reservation. - GET
/api/reservations/{reservationId}/menu-items
- List ordered menu items for a reservation. - GET
/api/employees/{employeeId}/average-order-amount
- Calculate average order amount for an employee.
- GET
- Secure the APIs using JWT or another authorization mechanism.
- Implement input validation and provide user-friendly error messages.
- Integrate Swagger to auto-generate API documentation. Ensure that the documentation is comprehensive, including parameters, expected responses, and possible error codes.
- Manually test all endpoints using tools like Postman or the Swagger UI to ensure they're working as expected.
- Write a comprehensive Postman test suite to automatically test all the API endpoints.
- Include tests for successful operations and error handling.
- Share the Postman collection file.