A comprehensive user management service built with .NET 9, providing APIs for user creation, retrieval, updating, and deletion, along with password management capabilities.
- .NET 9
- ASP.NET Core
- Entity Framework Core with SQL Server
- AutoMapper for object mapping
- FluentValidation for request validation
- OpenTelemetry for observability
- Prometheus for metrics collection
- xUnit, FluentAssertions, and Moq for testing
- .NET 9 SDK
- SQL Server (or SQL Server Express)
- Visual Studio 2022 or any compatible IDE
- Update the connection string in
appsettings.json:
{
"ConnectionStrings": {
"DefaultConnection": "Server=(localdb)\\mssqllocaldb;Database=JuntoUserManagement;Trusted_Connection=True;MultipleActiveResultSets=true"
}
}- Run
CreateUsersTable.dml.sqlin your SQL Server database.
- Set
Junto.UserManagement.APIas the startup project - Press F5 or click the Run button
cd Junto.UserManagement.API
dotnet runThe API will be available at https://localhost:5001 (or https://localhost:7xxx depending on your environment).
- GET /users - Get all users
- GET /users/{id} - Get user by ID
- POST /users - Create a new user
- PUT /users/{id} - Update an existing user
- DELETE /users/{id} - Delete a user
- POST /users/{id}/change-password - Change user password
- POST /forgot-password - Initiate password reset
- POST /reset-password - Complete password reset
- Health checks:
/health,/health/ready, and/health/live - Prometheus metrics:
/metrics
- Open Test Explorer
- Run all tests or select specific tests to run
dotnet test Junto.UserManagement.Tests- First, generate the code coverage .xml file
dotnet test Junto.UserManagement.Tests /p:CollectCoverage=true /p:CoverletOutputFormat=opencover --collect:"XPlat Code Coverage"- To generate the visual report, install
reportgenerator
dotnet tool install -g dotnet-reportgenerator-globaltool- Then, run
reportgeneratortool to create the coverage report
reportgenerator -reports:.\Junto.UserManagement.Tests\TestResults\{test-result-folder}\coverage.cobertura.xml -targetdir:C:\Users\{your-user-folder}\TesteJuntoSegurosReport -reporttypes:Html- Junto.UserManagement.API: API controllers and middleware
- Junto.UserManagement.Application: Service implementations and AutoMapper profiles
- Junto.UserManagement.Domain: Entities, DTOs, and interfaces
- Junto.UserManagement.Infrastructure: Data access, repositories, and external integrations
- Junto.UserManagement.Tests: Unit and integration tests
This project is licensed under the MIT License.