The Despachos API is a Spring Boot REST microservice that manages all dispatch (despacho) operations for the Tienda de Perritos platform. It exposes a JSON API underDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/DevOpsDuoc/Evaluacion02_Devop_Innovatech/llms.txt
Use this file to discover all available pages before exploring further.
api/v1/despachos, links every dispatch to a sale through the idCompra foreign key, and publishes interactive docs at /swagger-ui.html through Springdoc OpenAPI.
REST endpoints
Full endpoint reference with request and response schemas
Ventas API
The sales service that dispatch records reference via idCompra
Overview
Port
3002Base path
api/v1/despachosFramework
Spring Boot + JPA/Hibernate
Database
MySQL 8.0 (shared
tienda schema)The Despacho entity
Each dispatch record maps to a single Despacho row in MySQL. The idCompra field acts as a soft foreign key referencing the idVenta of a sale in the Ventas API.
Despacho.java
| Field | Type | Notes |
|---|---|---|
idDespacho | Long | Auto-generated PK |
fechaDespacho | LocalDate | Dispatch date, ISO format YYYY-MM-DD |
patenteCamion | String | Truck license plate |
intento | int | Delivery attempt number (1, 2, 3…) |
idCompra | Long | References idVenta in the Ventas API |
direccionCompra | String | Delivery address copied from the sale |
valorCompra | Long | Purchase value copied from the sale |
despachado | boolean | true once the item is delivered, default false |
REST endpoints
All endpoints are served athttp://localhost:3002/api/v1/despachos. The controller uses @CrossOrigin(origins = "*") to allow cross-origin requests from the React frontend.
| Method | Path | Description |
|---|---|---|
POST | /api/v1/despachos | Create a new dispatch record |
GET | /api/v1/despachos | List all dispatch records |
GET | /api/v1/despachos/{idDespacho} | Get a single dispatch by ID |
PUT | /api/v1/despachos/{idDespacho} | Update an existing dispatch |
DELETE | /api/v1/despachos/{idDespacho} | Delete a dispatch record |
PUT requests require @Valid on the request body. A 404 Not Found is returned when the given idDespacho does not exist (thrown as DespachoNotFoundException).Docker build
The Despachos API uses the same two-stage Maven → JRE build pattern as the Ventas API.Dockerfile
Builder stage
maven:3.9.9 resolves dependencies and runs mvn -B -DskipTests package, producing a fat JAR under target/.Runtime stage
eclipse-temurin:17-jre provides a minimal JRE. A dedicated non-root appuser owns the JAR file.Environment variables
These variables are injected by Docker Compose at runtime. Spring Boot maps them to the correspondingapplication.properties keys via relaxed binding.
| Variable | Example value | Description |
|---|---|---|
SPRING_DATASOURCE_URL | jdbc:mysql://db:3306/tienda | JDBC connection string for the MySQL database |
SPRING_DATASOURCE_USERNAME | tienda | Database username |
SPRING_DATASOURCE_PASSWORD | tienda123 | Database password |
SPRING_JPA_HIBERNATE_DDL_AUTO | update | Hibernate schema strategy (update, create, validate, or none) |
docker-compose.yml (backend-despachos service)