User Management Web API

User Management Web Api Artistic Rendering

Summary

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.

Requirements

Refer to theΒ coding-challenge-requirements.pdfΒ for detailed requirements.

Architecture

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.

Project Structure

Demo Video

The demo video showcases the User Management Web API and demonstrates the CRUD operations for managing user data.

Link to General Demo Video

Link to Unique E-mail Validation Demo Video

Building and Running the Solution

Prerequisites

  • .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.

Building the Solution

  1. Clone the repository:

  2. Restore the dependencies and build the solution:

Running the Solution

  1. Run the application:

  2. The API will be available atΒ https://localhost:7048Β andΒ http://localhost:5108.

Database Migrations

Creating Migrations

  1. Add a new migration:

  2. Apply the migration to the database:

Deploying the SQLite Database

  1. Ensure the connection string inΒ appsettings.jsonΒ points to the SQLite database file:

  2. Run the application to create and apply the migrations:

Unit Tests

The project includes unit tests for controllers, services, and repository layers using xUnit and Moq.

Running Unit Tests

  1. Navigate to the test project directory:

  2. Run the tests:

Test Coverage

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.

Why Did You Make This?

 

Code

View the Code on GitHub here.

License

This project is licensed under the MIT License.

Kathleen has 15 yrs. of experience analyzing business IT needs and engineering solutions in payments, electric utilities, pharmaceutical, financial, virtual reality, and internet industries with a variety of technologies. Kathleen's project experience has been diverse ranging from executing the business analysis β€œdesign phase” to hands-on development, implementation, and testing of the IT solutions. Kathleen and her husband reside in Indiana with no children, instead living along with their fur babies.