- User Management Web API
This repository contains a simple User Management Web API built with ASP.NET Core. The API provides CRUD operations for managing user data, including creating, retrieving, updating, and deleting users. The project uses Entity Framework Core with SQLite as the database provider and includes comprehensive unit tests for the controllers, services, and repository layers.
You can explore and test the functionality of our Project Web API through our Swagger interface. Follow these steps to get started:
Access the Swagger UI: Open your web browser and navigate to the Swagger UI by clicking on this link.
Explore the Endpoints: Browse through the available API endpoints listed in the Swagger interface. Each endpoint represents a different operation you can perform with the API.
Test the API: To test an endpoint, select it from the list, and then click the "Try it out" button. Fill in any required parameters and click "Execute" to send a request to the API.
View Responses: After executing a request, you can view the response details, including the status code, response body, and any headers returned by the API.
The Swagger UI provides an intuitive way to interact with the API and understand its capabilities without writing any code. Feel free to explore and experiment with different endpoints to get a better understanding of how the API works.
Refer to the coding-challenge-requirements.pdf for detailed requirements.
The project follows a layered architecture with the following components:
- Controllers: Handle HTTP requests and responses.
- Services: Contain business logic and interact with repositories.
- Repositories: Handle data access and database operations.
- Models: Define the data structures and validation rules.
- Middleware: Custom middleware for logging HTTP requests and responses.
UserManagementWebApiDemo/
├── .dockerignore
├── .gitattributes
├── .gitignore
├── UserManagement/
│ ├── Controllers/
│ ├── Data/
│ ├── Middleware/
│ ├── Migrations/
│ ├── Models/
│ ├── Properties/
│ ├── Services/
│ ├── appsettings.Development.json
│ ├── appsettings.json
│ ├── Dockerfile
│ ├── Program.cs
│ ├── UserManagement.csproj
├── UserManagement.Tests/
│ ├── Controllers/
│ ├── Services/
│ ├── UserManagement.Tests.csproj
├── WebApiClient/
│ ├── Program.cs
│ ├── WebApiClient.csproj
├── UserManagement.sln
├── requirements/
│ ├── coding-challenge-requirements.pdf
└── demo/
├── sample-data.txt
The demo video showcases the User Management Web API and demonstrates the CRUD operations for managing user data.
Link to Unique E-mail Validation Demo Video
TODO: Add Production Runtime Demo, Create Professional Demo video with voice over. (weekend project)
- .NET 8.0 SDK
- Docker (optional, for containerized deployment)
- TODO: Due to time constraints I was not yet able to test and verify Docker deployment.
-
Clone the repository:
git clone https://github.com/kathleenwest/UserManagementWebApiDemo.git
-
Restore the dependencies and build the solution:
dotnet restore dotnet build
-
Run the application:
dotnet run --project UserManagement
-
The API will be available at
https://localhost:7048andhttp://localhost:5108.
-
Add a new migration:
dotnet ef migrations add <MigrationName> --project UserManagement --startup-project UserManagement
-
Apply the migration to the database:
dotnet ef database update --project UserManagement --startup-project UserManagement
-
Ensure the connection string in
appsettings.jsonpoints to the SQLite database file:{ "ConnectionStrings": { "UserDb": "Data Source=UserDb.db" } } -
Run the application to create and apply the migrations:
dotnet run --project UserManagement
The project includes unit tests for controllers, services, and repository layers using xUnit and Moq.
-
Navigate to the test project directory:
cd UserManagement.Tests -
Run the tests:
dotnet test
The unit tests cover various scenarios, including:
- Creating, retrieving, updating, and deleting users.
- Validating email uniqueness.
- Handling errors and logging.
- TODO: Due to time constraints I added ideas for additional tests in the UserManagement.Tests project.
This project is licensed under the MIT License.
