Skip to content

joaoprds/dotNetWithDockerDDD

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DeveloperStore API

🚀 ASP.NET Core Web API for managing sales using Clean Architecture (DDD, MediatR).


🧰 Stack

  • .NET 8
  • PostgreSQL (via Docker)
  • MediatR
  • Entity Framework Core
  • xUnit + NSubstitute
  • Docker + Docker Compose
  • Swagger (OpenAPI)

▶️ How to Run

1. ✅ Build and Run via Docker Compose

docker compose up --build

2. 🔄 Local Development (API only)

cd src/DeveloperStore.API

# If using local Postgres
export ConnectionStrings__DefaultConnection="Host=localhost;Port=5432;Database=DeveloperStore;Username=postgres;Password=dev123"

# Then run
 dotnet run

📄 API Endpoints

Base URL: http://localhost:8080/api/sales

🔽 GET all sales

GET /api/sales

➕ POST new sale

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
    }
  ]
}

💾 Seed Data

  • Automatically applied if database is empty.
  • Example: 1 initial sale with Sample Product

🧪 Run Tests

cd tests/DeveloperStore.Tests
 dotnet test

🐘 PgAdmin Login

➕ Create New Server in PgAdmin

  1. Open PgAdmin at http://localhost:5050
  2. Log in with credentials above
  3. Right-click on Servers > Create > Server...
  4. General Tab:
    • Name: DeveloperStore
  5. Connection Tab:
    • Host name/address: db
    • Port: 5432
    • Username: postgres
    • Password: dev123
  6. Click Save

You can now view tables, run queries, and manage the database.


🛠 Dev Notes

  • DbContext retry logic: 15 attempts on startup
  • UTC enforced for all DateTime sent to PostgreSQL

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors