How wendermata/salescodingtest works
Main Layers and Components
• Presentation Layer (Web API):
• Represented by the "src/WebApi" folder.
• Contains controllers (e.g., ProductController and SalesController) which serve as the entry points for client requests.
• It sets up routes, calls application use cases, and returns responses via RESTful endpoints.
• Application Layer:
• Located in "src/Application".
• Contains the use cases, input/output models, mapping, validation, and helper utilities.
• Divided into use case groups (e.g., Product – Create, List, Remove, Update; Sale – Create, List, Cancel).
• Implements boundaries to external services such as the ViaCEP service for address lookup.
• Domain Layer:
• Present in "src/Domain".
• Encodes the Entities, Aggregates (like SaleAggregate), and repository interfaces that embody business rules.
• Reflects core business logic independent of any technology.
• Infrastructure Layer:
• Found in "src/Infra.Mongo".
• Implements data persistence using MongoDB.
• Provides concrete implementations of the repository interfaces declared in the Domain.
• Contains configuration settings and connection management related to MongoDB.
• Testing:
• The "tests" directory contains unit tests for the Application logic, Domain entities, and Web API controllers, ensuring functionality and separation of concerns.
Relationships and Data Flow
• Client calls are received by the WebApi controllers.
• Controllers invoke corresponding use cases present in the Application layer.
• Use cases perform business logic potentially calling domain services or validating business entities.
• When data persistence is needed, the Application layer abstracts repository calls; the Domain defines the interface while Infra.Mongo provides the concrete implementation.
• The ViaCEP boundary within the Application layer is an external service integration which fetches address data (or related details) to support the use cases.
• All layers strictly follow dependency inversion: The higher-level modules (Application, Domain) are decoupled from lower-level details (Infra.Mongo).
Architectural Patterns and Technologies
• Clean Architecture Division: Separate boundaries between WebApi (UI), Application, Domain, and Infrastructure.
• DDD: Use of Aggregates, Entities, and repositories.
• Mediator Pattern: Likely used in orchestrating use case handling (even if not explicitly shown, it’s mentioned in the README).
• Repository Pattern: Abstracts data access to MongoDB.
• Docker is used for containerization (Dockerfile, docker-compose.yml).
• The project utilizes specific libraries such as the ViaCEP service client, which is integrated under the Application layer.
Final Details
• Use clear labels for each component (e.g., "ProductController", "CreateProductUseCase", "Product Entity", "ProductRepository").
• Ovals for domain entities, and
• Optionally, mark the Docker container boundary to indicate the deployment environment.