How todocodeacademy/pruebatecnicasupermercado works
1. Overall shape
- This is a single Spring Boot backend application for a supermarket domain.
- It follows a classic layered architecture: HTTP API → service layer → persistence layer → domain model, with DTOs used at the API boundary.
2. Main functional bounded contexts
- The domain is split around three core business areas:
- Productos: catalog and product management.
- Sucursales: store/branch management.
- Ventas: sales transactions, including sale details.
- These are reflected consistently in controllers, services, repositories, models, and DTOs.
3. API layer
- The controller package contains three REST controllers:
- ProductoController
- SucursalController
- VentaController
- These are the entry points for client requests and are the main external interface for the system.
- The included Postman collection in #otros archivos suggests the repository is intended to be exercised as a REST API.
4. Service layer
- The service package contains both interfaces and implementations:
- IProductoService / ProductoService
- ISucursalService / SucursalService
- IVentaService / VentaService
- This layer holds the business rules and orchestrates operations across repositories and mappers.
- Controllers should not access persistence directly; they depend on these services instead.
5. Persistence layer
- The repository package contains:
- ProductoRepository
- SucursalRepository
- VentaRepository
- These are the persistence abstractions, likely Spring Data repositories backed by a database configured through application.properties.
- This layer is the boundary to storage and is isolated from HTTP concerns.
6. Domain model
- The model package defines the persistent business objects:
- Producto
- Sucursal
- Venta
- DetalleVenta
- Venta and DetalleVenta indicate that a sale is composed of one or more line items, so the sales flow is more than a flat CRUD resource.
- The model layer represents the internal state used by the service and repository layers.
7. DTO boundary
- The dto package defines transport objects:
- ProductoDTO
- SucursalDTO
- VentaDTO
- DetalleVentaDTO
- These DTOs separate the API contract from the persistence model, which helps control what data is exposed and accepted over the wire.
- In an architecture diagram, this is an important anti-corruption boundary between clients and the internal model.
8. Mapping and transformation
- The mapper package contains a Mapper utility/class.
- This is the translation boundary between DTOs and domain entities.
- It prevents controllers and services from duplicating object conversion logic and keeps API shapes decoupled from entity shapes.
9. Error handling
- The exception package contains NotFoundException.
- This indicates the app has explicit handling for missing resources, likely used when a requested product, branch, or sale does not exist.
- Architecturally, this is part of the service/API contract for error responses.
10. Runtime and deployment
- The presence of Dockerfile, docker-compose.yml, and Maven wrapper files (mvnw, .mvn) indicates the app is designed to be buildable and runnable in a containerized local environment as well as via Maven.
- application.properties centralizes runtime configuration, likely including server and datasource settings.
11. Application bootstrap and tests
- PruebaTecSupermercadoApplication.java is the Spring Boot entry point.
- The test folder contains a basic application test class, suggesting repository-level automated testing exists but is minimal from the tree alone.
12. Suggested architecture diagram boundaries
- Draw the system as one backend service with these layers:
- Clients → REST controllers → service interfaces/implementations → repositories → database
- Side boundaries for DTOs/mapping and exceptions
- Treat Producto, Sucursal, Venta, and DetalleVenta as the core domain objects flowing through the service and persistence layers.
Main entry points: VentaController.java Venta API · ProductoService.java Producto Service · SucursalService.java Sucursal Service · VentaService.java Venta Service
Components 21
External
API clients and test tooling
- Postman Collection · Sample API client collection for exercising the backend
PruebaTecSupermercado/#otros archivos/PruebaTécnicaSupermercado.postman_collection.json
API Layer
HTTP controllers and transport DTOs
- Producto API · REST entry point for product operations
PruebaTecSupermercado/src/main/java/com/todocodeacademy/PruebaTecSupermercado/controller/ProductoController.java - Sucursal API · REST entry point for branch operations
PruebaTecSupermercado/src/main/java/com/todocodeacademy/PruebaTecSupermercado/controller/SucursalController.java - Venta API · REST entry point for sales operations
PruebaTecSupermercado/src/main/java/com/todocodeacademy/PruebaTecSupermercado/controller/VentaController.java - Producto DTO · Transport model for product requests and responses
PruebaTecSupermercado/src/main/java/com/todocodeacademy/PruebaTecSupermercado/dto/ProductoDTO.java - Sucursal DTO · Transport model for branch requests and responses
PruebaTecSupermercado/src/main/java/com/todocodeacademy/PruebaTecSupermercado/dto/SucursalDTO.java - Venta DTO · Transport model for sales requests and responses
PruebaTecSupermercado/src/main/java/com/todocodeacademy/PruebaTecSupermercado/dto/VentaDTO.java - Detalle DTO · Transport model for sale line items
PruebaTecSupermercado/src/main/java/com/todocodeacademy/PruebaTecSupermercado/dto/DetalleVentaDTO.java
Service Layer
Business services and orchestration
- Producto Service · Product business operations and orchestration
PruebaTecSupermercado/src/main/java/com/todocodeacademy/PruebaTecSupermercado/service/ProductoService.java - Sucursal Service · Branch business operations and orchestration
PruebaTecSupermercado/src/main/java/com/todocodeacademy/PruebaTecSupermercado/service/SucursalService.java - Venta Service · Sales workflow and transaction orchestration
PruebaTecSupermercado/src/main/java/com/todocodeacademy/PruebaTecSupermercado/service/VentaService.java
Persistence Layer
Repositories and stored domain objects
- Producto Repo · Persistence access for products
PruebaTecSupermercado/src/main/java/com/todocodeacademy/PruebaTecSupermercado/repository/ProductoRepository.java - Sucursal Repo · Persistence access for branches
PruebaTecSupermercado/src/main/java/com/todocodeacademy/PruebaTecSupermercado/repository/SucursalRepository.java - Venta Repo · Persistence access for sales
PruebaTecSupermercado/src/main/java/com/todocodeacademy/PruebaTecSupermercado/repository/VentaRepository.java
Core Domain
Shared domain model, mapping, and errors
- Producto · Persistent product domain object
PruebaTecSupermercado/src/main/java/com/todocodeacademy/PruebaTecSupermercado/model/Producto.java - Sucursal · Persistent branch domain object
PruebaTecSupermercado/src/main/java/com/todocodeacademy/PruebaTecSupermercado/model/Sucursal.java - Venta · Sale aggregate root
PruebaTecSupermercado/src/main/java/com/todocodeacademy/PruebaTecSupermercado/model/Venta.java - DetalleVenta · Sale line-item entity
PruebaTecSupermercado/src/main/java/com/todocodeacademy/PruebaTecSupermercado/model/DetalleVenta.java - Mapper · DTO-to-entity and entity-to-DTO transformation boundary
PruebaTecSupermercado/src/main/java/com/todocodeacademy/PruebaTecSupermercado/mapper/Mapper.java - Not Found · Explicit missing-resource error handling
PruebaTecSupermercado/src/main/java/com/todocodeacademy/PruebaTecSupermercado/exception/NotFoundException.java
Runtime
Application bootstrap and packaging
- Spring Boot App · Application entry point
PruebaTecSupermercado/src/main/java/com/todocodeacademy/PruebaTecSupermercado/PruebaTecSupermercadoApplication.java
Connections 26
- Postman Collection → Producto API: calls · Exercises the REST API
- Postman Collection → Sucursal API: calls · Exercises the REST API
- Postman Collection → Venta API: calls · Exercises the REST API
- Producto API → Producto DTO: uses · Reads and writes product payloads
- Sucursal API → Sucursal DTO: uses · Reads and writes branch payloads
- Venta API → Venta DTO: uses · Reads and writes sale payloads
- Venta API → Detalle DTO: uses · Handles sale line items
- Producto API → Producto Service: delegates · Routes product requests into business logic
- Sucursal API → Sucursal Service: delegates · Routes branch requests into business logic
- Venta API → Venta Service: delegates · Routes sales requests into business logic
- Producto Service → Mapper: maps · Converts between DTOs and entities
- Sucursal Service → Mapper: maps · Converts between DTOs and entities
- Venta Service → Mapper: maps · Converts between DTOs and entities
- Producto Service → Producto Repo: persists · Product storage access
- Sucursal Service → Sucursal Repo: persists · Branch storage access
- Venta Service → Venta Repo: persists · Sales storage access
- Producto Repo → Producto: stores · Persists product entities
- Sucursal Repo → Sucursal: stores · Persists branch entities
- Venta Repo → Venta: stores · Persists sale entities
- Venta → DetalleVenta: contains · Sale is composed of line items
- Producto Service → Not Found: raises · Signals missing product resources
- Sucursal Service → Not Found: raises · Signals missing branch resources
- Venta Service → Not Found: raises · Signals missing sale resources
- Spring Boot App → Producto API: starts · Bootstraps controller layer
- Spring Boot App → Sucursal API: starts · Bootstraps controller layer
- Spring Boot App → Venta API: starts · Bootstraps controller layer