🚀 ASP.NET Core Web API for managing sales using Clean Architecture (DDD, MediatR).
- .NET 8
- PostgreSQL (via Docker)
- MediatR
- Entity Framework Core
- xUnit + NSubstitute
- Docker + Docker Compose
- Swagger (OpenAPI)
docker compose up --build- API: http://localhost:8080/swagger
- DB: connect via PgAdmin on port
5050
cd src/DeveloperStore.API
# If using local Postgres
export ConnectionStrings__DefaultConnection="Host=localhost;Port=5432;Database=DeveloperStore;Username=postgres;Password=dev123"
# Then run
dotnet runBase URL: http://localhost:8080/api/sales
GET /api/sales
POST /api/sales
Content-Type: application/json
{
"date": "2025-05-23T00:00:00Z",
"customerName": "Cliente X",
"branch": "Filial A",
"isCancelled": false,
"items": [
{
"productName": "Camisa Polo",
"quantity": 6,
"unitPrice": 90.0
}
]
}- Automatically applied if database is empty.
- Example: 1 initial sale with
Sample Product
cd tests/DeveloperStore.Tests
dotnet test- URL: http://localhost:5050
- Email:
admin@devstore.com - Password:
admin123
- Open PgAdmin at
http://localhost:5050 - Log in with credentials above
- Right-click on Servers > Create > Server...
- General Tab:
- Name:
DeveloperStore
- Name:
- Connection Tab:
- Host name/address:
db - Port:
5432 - Username:
postgres - Password:
dev123
- Host name/address:
- Click Save
You can now view tables, run queries, and manage the database.
- DbContext retry logic: 15 attempts on startup
- UTC enforced for all DateTime sent to PostgreSQL