Sales management system developed in .NET 8 following Clean Architecture and DDD principles.
- .NET 8.0
- PostgreSQL 13
- Entity Framework Core
- MediatR
- AutoMapper
- FluentValidation
- BCrypt.NET
- Rebus (Message Bus)
- xUnit
- Docker & Docker Compose
src/
├── Ambev.DeveloperEvaluation.Application # Application layer (use cases)
├── Ambev.DeveloperEvaluation.Common # Shared components
├── Ambev.DeveloperEvaluation.Domain # Domain layer
├── Ambev.DeveloperEvaluation.IoC # Dependency injection configuration
├── Ambev.DeveloperEvaluation.ORM # Persistence layer
├── Ambev.DeveloperEvaluation.Services # Integration services and message handlers
└── Ambev.DeveloperEvaluation.WebApi # REST API
tests/
├── Ambev.DeveloperEvaluation.Unit # Unit tests
├── Ambev.DeveloperEvaluation.Integration # Integration tests
└── Ambev.DeveloperEvaluation.Functional # Functional tests
The project follows Clean Architecture and Domain-Driven Design (DDD) principles:
- Domain Layer: Contains entities, business rules, and repository interfaces
- Application Layer: Implements application use cases using CQRS pattern with MediatR
- Infrastructure Layer: Repository implementation and data access using Entity Framework Core
- Services Layer: Handles integration services and message bus operations with Rebus
- WebApi Layer: REST Controllers and API configuration
- Admin:
- Id: 7c9e6679-7425-40de-944b-e07fc1f90ae1
- Email: admin@ambev.com.br
- Password: Admin@123
- Role: Admin
- Customer:
- Id: 7c9e6679-7425-40de-944b-e07fc1f90ae2
- Email: customer@email.com
- Password: Admin@123
- Role: Customer
- Brahma Duplo Malte 350ml (Id: 1, Code: BEER-001, $4.99)
- Skol Puro Malte 350ml (Id: 2, Code: BEER-002, $4.49)
- Original 600ml (Id: 3, Code: BEER-003, $8.99)
- Corona Extra 330ml (Id: 4, Code: BEER-004, $7.99)
- São Paulo Headquarters (Id: 7c9e6679-7425-40de-944b-e07fc1f90ae7, Code: MATRIX-001)
- Rio de Janeiro Branch (Id: 9c9e6679-7425-40de-944b-e07fc1f90ae8, Code: BRANCH-RJ-001)
- Belo Horizonte Branch (Id: 5c9e6679-7425-40de-944b-e07fc1f90ae9, Code: BRANCH-BH-001)
- Curitiba Branch (Id: 3c9e6679-7425-40de-944b-e07fc1f90ae0, Code: BRANCH-CWB-001)
- Quantity-based discounts:
- 4-9 items: 10% discount
- 10-20 items: 20% discount
- Restrictions:
- Maximum of 20 identical items per sale
- No discount for less than 4 items
- Docker
- Docker Compose
- .NET 8 SDK (for development)
- Clone the repository:
git clone <repository-url>
cd sales_records- Run the project using Docker Compose:
docker-compose up -dThe API will be available at: http://localhost:8080 Swagger UI: http://localhost:8080/swagger
- Restore packages:
dotnet restore Ambev.DeveloperEvaluation.sln- Run tests:
dotnet test Ambev.DeveloperEvaluation.sln- Run the project:
cd src/Ambev.DeveloperEvaluation.WebApi
dotnet runA Postman collection is available in the Ambev.DeveloperEvaluation.postman_collection.json file with examples of all requests.
POST /api/auth/login- AuthenticationGET /api/sales- List salesPOST /api/sales- Create saleGET /api/sales/{id}- Sale detailsPUT /api/sales/{id}/cancel- Cancel salePUT /api/sales/{id}/items/{itemId}/cancel- Cancel sale item
Complete API documentation is available through Swagger UI at:
- Development: http://localhost:8080/swagger
- Production: https://your-domain/swagger
- JWT Authentication
- Passwords encrypted using BCrypt
- HTTPS enabled
- Input validation using FluentValidation
- PostgreSQL 13
- Automatic migrations
- Initial data (seeds) for testing
- Optimized indexes for frequent queries
The project includes:
- 144 unit tests
Run the tests with:
dotnet test Ambev.DeveloperEvaluation.slnThis project is under the MIT license.