Documentation Index
Fetch the complete documentation index at: https://mintlify.com/luisllatas-dev/Proyecto_Pasteleria_DonMamino/llms.txt
Use this file to discover all available pages before exploring further.
The Don Mamino API is built on a relational MySQL database that models a multi-location bakery operation. Eight entities cover everything from physical locations and staff to customer orders and per-location inventory. Foreign keys enforce referential integrity throughout, so most records are anchored to a specific sede (branch).
The entire data model is designed around the concept of sedes (physical locations). Nearly every entity—users, products, orders, inventory, and sales reports—carries an id_sede foreign key so data can be scoped and reported per branch.
Entities
Sedes
A sede represents a physical bakery location. All other entities ultimately trace back to a sede.
| Field | Type | Notes |
|---|
id_sede | INT | Primary key, auto-increment |
nombre_sede | VARCHAR(255) | Display name of the branch |
direccion | VARCHAR(255) | Physical street address |
telefono | VARCHAR(15) | Contact phone number |
email | VARCHAR(100) | Contact email address (unique) |
Usuarios
Usuarios are the staff accounts that authenticate with the API. Each user is assigned to one sede and carries a role that determines their level of access.
| Field | Type | Notes |
|---|
id_usuario | INT | Primary key, auto-increment |
nombre_usuario | VARCHAR(255) | Full name |
email | VARCHAR(100) | Login email (unique) |
rol | VARCHAR(50) | Role string (e.g., administrador, vendedor) |
contraseña | VARCHAR(255) | bcrypt-hashed password |
id_sede | INT | Foreign key → Sedes |
Clientes
Clientes are the bakery’s customers. They are not system users and do not authenticate; their records exist to attach shipping details and order history to a named person.
| Field | Type | Notes |
|---|
id_cliente | INT | Primary key, auto-increment |
nombre_cliente | VARCHAR(255) | Full name |
email | VARCHAR(100) | Contact email (unique) |
telefono | VARCHAR(15) | Contact phone number |
direccion_envio | VARCHAR(255) | Default shipping address |
Productos
Productos represent anything the bakery tracks — both items sold to customers and raw ingredients used internally.
| Field | Type | Notes |
|---|
id_producto | INT | Primary key, auto-increment |
nombre_producto | VARCHAR(255) | Product name |
descripcion | TEXT | Full description |
precio | DECIMAL(10,2) | Unit price |
stock | INT | Current available quantity (default 0) |
imagen_url | VARCHAR(255) | URL to the product image |
estado | ENUM | See values below |
tipo_producto | ENUM | See values below |
id_sede | INT | Foreign key → Sedes |
estado values
| Value | Meaning |
|---|
activo | Product is visible and available (default) |
inactivo | Product is hidden or discontinued |
tipo_producto values
| Value | Meaning |
|---|
vendible | Sold directly to customers (default) |
insumo | Internal ingredient or supply, not sold directly |
Pedidos
A pedido is a customer order managed by a staff member at a specific sede.
| Field | Type | Notes |
|---|
id_pedido | INT | Primary key, auto-increment |
fecha_pedido | DATETIME | Order timestamp (default: current time) |
estado | ENUM | See values below |
id_cliente | INT | Foreign key → Clientes |
id_usuario | INT | Foreign key → Usuarios (the staff member who handled it) |
id_sede | INT | Foreign key → Sedes |
estado values
| Value | Meaning |
|---|
procesando | Order received and being confirmed (default) |
en preparación | Order is being prepared in the kitchen |
enviado | Order has been dispatched for delivery |
entregado | Order has been delivered to the customer |
Detalle_Pedido
Each row in Detalle_Pedido is a line item inside a pedido. A single order can reference multiple products.
| Field | Type | Notes |
|---|
id_detalle | INT | Primary key, auto-increment |
id_pedido | INT | Foreign key → Pedidos |
id_producto | INT | Foreign key → Productos |
cantidad | INT | Quantity of the product ordered |
precio_unitario | DECIMAL(10,2) | Unit price captured at time of purchase |
Inventario
Inventario tracks stock levels for a product at a specific sede and provides a minimum threshold for restocking alerts.
| Field | Type | Notes |
|---|
id_inventario | INT | Primary key, auto-increment |
id_producto | INT | Foreign key → Productos |
id_sede | INT | Foreign key → Sedes |
cantidad_actual | INT | Current stock count |
cantidad_minima | INT | Minimum stock before a restock alert is triggered |
Reportes_Ventas
Reportes_Ventas stores aggregated sales totals per sede for a given reporting period.
| Field | Type | Notes |
|---|
id_reporte | INT | Primary key, auto-increment |
fecha_reporte | DATETIME | When the report was generated (default: current time) |
total_ventas | DECIMAL(10,2) | Total sales amount for the period |
id_sede | INT | Foreign key → Sedes |
Relationships
The diagram below describes how the entities connect via foreign keys.
- Usuarios → Sedes: each user belongs to one sede. If a sede is deleted, the user’s
id_sede is set to NULL.
- Productos → Sedes: each product belongs to one sede. Deleting a sede cascades to its products.
- Pedidos → Clientes, Usuarios, Sedes: an order links a customer, the staff member who managed it, and the branch that fulfilled it. Deleting a cliente or sede cascades to associated pedidos; deleting the managing usuario sets
id_usuario to NULL on existing orders.
- Detalle_Pedido → Pedidos, Productos: line items belong to one order and reference one product. Deleting either the parent order or the product cascades to its line items.
- Inventario → Productos, Sedes: stock records track a specific product at a specific sede. Deleting either cascades to the inventory record.
- Reportes_Ventas → Sedes: sales reports are scoped to a sede. Deleting a sede cascades to its reports.