How ignaciohernandez/pp3-api-pedidos works
Pedidos is an independently deployed HTTP service for authenticated order lifecycle management. Its principal workflow accepts an idempotent purchase request, persists orders and items, then supports authorized listing/detail, confirmation with coordinator-authorized amounts, simulated payment and receipt retrieval, cancellation states, and shipping/delivery transitions. The README also documents stock coordination as Gateway-owned; this service exposes internal order queues but does not itself call Catalog. Routes and DB behavior are only partly sampled, so omitted implementation details are not inferred.
Main entry points: app.js Order API · db.js Connection Pool · migrate.js Migration Runner · server.js HTTP Server
Components 16
HTTP API
- Order API
src/app.js - Service Token Auth
src/auth.js
Order Lifecycle
- Idempotent Creation
src/app.js - Order Queries
src/app.js - Authorized Confirmation
src/app.js - Payment and Receipt
src/app.js - Cancellation Flow
src/app.js - Shipping and Delivery
src/app.js
Persistence
- MySQL Database
- Connection Pool
src/db.js
Service Operations
- Schema Migrations
migrations - Migration Runner
src/migrate.js - HTTP Server
src/server.js
Other components
- Client
- Gateway
- Administrator
Connections 23
- Client → Gateway: sends requests
README.md - Gateway → Order API: forwards identity
README.md - Administrator → Order API: manages orders
README.md - HTTP Server → Order API: creates app
src/server.js - HTTP Server → Connection Pool: creates pool
src/server.js - Order API → Service Token Auth: registers middleware
src/app.js - Order API → Idempotent Creation: routes creation
src/app.js - Order API → Order Queries: routes queries
src/app.js - Order API → Authorized Confirmation: routes confirmation
src/app.js - Order API → Payment and Receipt: routes payment
src/app.js - Order API → Cancellation Flow: routes cancellation
src/app.js - Order API → Shipping and Delivery: routes fulfillment
src/app.js - Idempotent Creation → Connection Pool: writes orders
- Order Queries → Connection Pool: reads orders
src/app.js - Authorized Confirmation → Connection Pool: updates amounts
src/app.js - Payment and Receipt → Connection Pool: reads receipts
src/app.js - Cancellation Flow → Connection Pool: updates status
- Shipping and Delivery → Connection Pool: updates status
- Connection Pool → MySQL Database: queries
src/db.js - Migration Runner → Connection Pool: creates pool
src/migrate.js - Migration Runner → Schema Migrations: applies SQL
src/migrate.js - Migration Runner → MySQL Database: records schema
src/migrate.js - HTTP Server → MySQL Database: warms connection
src/server.js