Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/teofilobetancourt/Tradiciones-y-Sabores/llms.txt

Use this file to discover all available pages before exploring further.

All persistence in Tradiciones y Sabores is handled by SQLAlchemy ORM models defined in models.py. On startup, Base.metadata.create_all(bind=engine, checkfirst=True) inspects the connected PostgreSQL database and creates any missing tables or enum types automatically — no manual migration step is needed for a fresh deployment. The models are split across two PostgreSQL schemas: the default public schema for the core restaurant tables and a dedicated Inventario schema for supply-chain tables.
The Inventario schema is created at startup via CREATE SCHEMA IF NOT EXISTS "Inventario" only when the active database dialect is PostgreSQL. When running SQLite (e.g., local dev without a Postgres instance), the schema qualifier is ignored.

Enumerations

The following Python enum.Enum classes are mapped to native PostgreSQL ENUM types. Each value shown is the exact string stored in the database column.

EstadoMesaEnum — Table status

disponible
string
The table is free and can accept new guests.
ocupada
string
The table is currently occupied.
reservada
string
The table has been reserved for an upcoming booking.
fuera_de_servicio
string
The table is temporarily out of service (maintenance, cleaning, etc.).

TipoPedidoEnum — Order type

mesa
string
Dine-in order associated with a specific table.
pickup
string
Take-away order; no table assignment required.
delivery
string
Home delivery order; requires a direccion_envio value.

EstadoOrdenEnum — Order lifecycle state

recibido
string
Order has been placed and is queued in the kitchen. This is the default value on creation.
preparando
string
Kitchen staff have started preparing the order.
listo
string
Order preparation is complete and is ready for pickup or delivery.
entregado
string
Order has been handed to the customer.

CategoriaPlatoEnum — Dish category

entrada
string
Starter or appetizer.
plato_principal
string
Main course.
postre
string
Dessert.
bebida
string
Beverage (alcoholic or non-alcoholic).
acompañante
string
Side dish or accompaniment. Stored in the database as acompañante (with tilde).

EstadoPagoEnum — Payment status

pendiente
string
Invoice has been generated but payment has not yet been collected. Default on invoice creation.
pagado
string
Payment has been received and confirmed.
anulado
string
The invoice or transaction has been voided.

Core Tables (schema: public)

These six tables form the transactional heart of the restaurant POS system.

mesa

Represents a physical dining table in the restaurant.
ColumnTypeConstraintsDescription
id_mesaINTEGERPK, autoincrementSurrogate primary key
capacidadINTEGERNOT NULLMaximum number of guests the table seats
estadoEstadoMesaEnumNOT NULL, default disponibleCurrent occupancy state
ubicacionVARCHAR(100)nullableHuman-readable location label (e.g. "Terraza - M1")

plato

Represents a single item on the restaurant’s menu.
ColumnTypeConstraintsDescription
id_platoINTEGERPK, autoincrementSurrogate primary key
nombreVARCHAR(100)NOT NULLDisplay name of the dish
descripcionVARCHAR(255)nullableShort description shown to customers
precioNUMERIC(8,2)NOT NULLUnit price in the restaurant’s base currency
categoriaCategoriaPlatoEnumNOT NULLMenu category

cliente

Stores customer identity information. The primary key is a Venezuelan-style ID (cedula).
ColumnTypeConstraintsDescription
cedula_clienteVARCHAR(20)PKNational ID or custom identifier (e.g. "V-12345678")
nombreVARCHAR(100)NOT NULLFull name of the customer
telefonoVARCHAR(20)NOT NULLContact phone number
emailVARCHAR(100)nullableEmail address
direccion_habitualVARCHAR(255)nullableStored home or default delivery address
A seed record with cedula_cliente = "V-00000000" named “Cliente General / Consumidor” is inserted automatically on first run. Use this record for walk-in or anonymous orders.

pedido

Central order record. One pedido corresponds to one customer transaction.
ColumnTypeConstraintsDescription
num_ticketINTEGERPK, autoincrementUnique ticket / order number
tipo_pedidoTipoPedidoEnumNOT NULLDine-in, pickup, or delivery
estado_ordenEstadoOrdenEnumNOT NULL, default recibidoCurrent lifecycle state of the order
id_mesaINTEGERFK → mesa.id_mesa, nullableTable assignment (null for pickup/delivery)
cedula_clienteVARCHAR(20)FK → cliente.cedula_cliente, NOT NULLOwning customer
direccion_envioVARCHAR(255)nullableDelivery address (populated only for delivery orders)
fecha_creacionDATETIMENOT NULL, default utcnowTimestamp of order placement

detalle_pedido

Line items for an order. Uses a composite primary key of (num_ticket, id_plato).
ColumnTypeConstraintsDescription
num_ticketINTEGERPK, FK → pedido.num_ticketParent order reference
id_platoINTEGERPK, FK → plato.id_platoDish reference
cantidadINTEGERNOT NULLNumber of units ordered
subtotalNUMERIC(8,2)NOT NULLPre-calculated line total (precio × cantidad)

factura

Invoice generated automatically when a pedido is created. Each order has at most one invoice (one-to-one).
ColumnTypeConstraintsDescription
num_facturaINTEGERPK, autoincrementSurrogate invoice number
num_ticketINTEGERFK → pedido.num_ticket, UNIQUEParent order; uniqueness enforces the one-to-one relationship
fecha_emisionDATETIMENOT NULL, default utcnowTimestamp of invoice generation
subtotalNUMERIC(8,2)NOT NULLSum of all detalle_pedido.subtotal values
impuestoNUMERIC(8,2)NOT NULL, default 0Tax amount (16% IVA computed at order creation)
totalNUMERIC(8,2)NOT NULLsubtotal + impuesto
estado_pagoEstadoPagoEnumNOT NULL, default pendientePayment collection status
metodo_pagoVARCHAR(30)nullablePayment method description (e.g. "efectivo", "tarjeta")

Inventario Schema Tables (schema: "Inventario")

These tables live in the dedicated Inventario PostgreSQL schema and manage the supply chain independently from the POS tables.
The "Inventario" schema (with capital I, in quotes) is automatically created at application startup when the database dialect is PostgreSQL. All three tables are then created inside it via the same Base.metadata.create_all call.

Inventario."Insumos"

Tracks raw ingredients and consumable supplies.
ColumnTypeConstraintsDescription
ID_InsumosBIGINTPK, autoincrementSurrogate primary key
Nombre_InsumoVARCHAR(100)NOT NULL, UNIQUECanonical name of the supply item
Unidad_MedidaVARCHAR(20)NOT NULLUnit of measure (e.g. "Kg", "Litro", "Paquete")
Stock_ActualNUMERIC(12,4)NOT NULL, default 0Current quantity on hand
Stock_MinimoNUMERIC(12,4)NOT NULL, default 0Minimum acceptable stock before restocking is required
Punto_ReordenNUMERIC(12,4)NOT NULL, default 0Trigger threshold at which a purchase order should be raised
FK_IDCategoriaBIGINTFK → Inventario."Categoria".ID_Categoria, nullableOptional supply category

Inventario."Proveedores"

Vendor and supplier directory.
ColumnTypeConstraintsDescription
ID_ProveedorBIGINTPK, autoincrementSurrogate primary key
Nombre_EmpresaVARCHAR(150)NOT NULLLegal company name
Identificación_RIFVARCHAR(30)NOT NULL, UNIQUEVenezuelan tax identification number (RIF)
CiudadVARCHAR(100)NOT NULLCity where the supplier operates
Telefono_EmpresaVARCHAR(30)NOT NULLBusiness phone number
Email_EmpresaVARCHAR(100)NOT NULL, UNIQUEBusiness email address
DireccionVARCHAR(255)NOT NULLFull postal or street address
Nombre_EncargadoVARCHAR(100)NOT NULLName of the primary contact person
The physical PostgreSQL column name is Identificación_RIF (with tilde). The SQLAlchemy model maps it to the Python attribute Identificacion_RIF (without tilde) via the Column("Identificación_RIF", ...) constructor so that JSON serialization uses the ASCII-safe spelling.

Inventario."Categoria"

Lookup table for supply item categories.
ColumnTypeConstraintsDescription
ID_CategoriaBIGINTPK, autoincrementSurrogate primary key
Nombre_CategoriaVARCHAR(100)NOT NULL, UNIQUEHuman-readable category label

Pydantic Schemas

These schemas are defined in schemas.py and are used by FastAPI to validate request bodies and shape JSON responses. All Out schemas use model_config = ConfigDict(from_attributes=True) to allow direct construction from SQLAlchemy ORM instances.

PlatoIn / PlatoOut — Menu item payload

PlatoIn — request body for POST /api/platos
FieldTypeRequiredDescription
nombrestringDisplay name of the dish
descripcionstring | nullShort customer-facing description
preciofloatUnit price in base currency
categoriaCategoriaPlatoEnumMenu category (entrada, plato_principal, postre, bebida, acompañante)
PlatoOut — response shape for menu item endpoints; extends PlatoIn with the generated key:
Additional fieldTypeDescription
id_platointegerAuto-assigned surrogate primary key

DetallePedidoIn / DetallePedidoOut — Order line item

DetallePedidoIn — embedded in PedidoIn.detalles
FieldTypeRequiredDescription
id_platointegerFK reference to plato.id_plato
cantidadintegerNumber of units ordered
subtotalfloatPre-calculated line total (precio × cantidad)
DetallePedidoOut — response shape; extends DetallePedidoIn with the ticket reference and nested dish:
Additional fieldTypeDescription
num_ticketintegerParent order ticket number
platoPlatoOut | nullNested dish object (eager-loaded by the router)
The detalle_pedido table has no notas column, and the schema carries no per-line notes field. Do not pass a notas key — it will be silently ignored or raise a validation error depending on your Pydantic settings.

PedidoIn / PedidoOut — Order payload

PedidoIn — request body for POST /api/ordenes
FieldTypeRequiredDescription
tipo_pedidoTipoPedidoEnummesa, pickup, or delivery
estado_ordenEstadoOrdenEnumInitial lifecycle state; defaults to recibido
id_mesainteger | nullTable assignment (omit for pickup/delivery)
cedula_clientestringCustomer national ID; must match an existing cliente row or be created via the auxiliary fields below
cliente_nombrestring | nullAuxiliary. If the cedula_cliente does not yet exist, the router uses this value to auto-create the customer record
cliente_telefonostring | nullAuxiliary. Paired with cliente_nombre for on-the-fly customer creation
direccion_enviostring | nullDelivery address (required in practice for delivery orders)
detallesList[DetallePedidoIn]One or more line items; must not be empty
PedidoOut — response shape for order endpoints
FieldTypeDescription
num_ticketintegerAuto-assigned order number
tipo_pedidoTipoPedidoEnumOrder type
estado_ordenEstadoOrdenEnumCurrent lifecycle state
id_mesainteger | nullTable assignment
cedula_clientestringOwning customer ID
direccion_enviostring | nullDelivery address
fecha_creaciondatetimeUTC timestamp of order placement
clienteClienteOut | nullNested customer object (eager-loaded)
detallesList[DetallePedidoOut]Line items with nested dish objects

PedidoUpdateEstatus — Order status update

Request body for PUT /api/ordenes/{num_ticket}.
FieldTypeRequiredDescription
estado_ordenEstadoOrdenEnumNew lifecycle state to assign to the order

ResumenReporte — Dashboard KPI response

Response shape for GET /api/reportes/resumen.
FieldTypeDescription
total_pedidosintegerTotal number of orders in the last 30 days
ingresos_brutosfloatGross revenue (sum of invoice totals) in the last 30 days
tiempo_promedio_segfloatAverage order completion time in seconds
pct_cambio_pedidosfloatPeriod-over-period percentage change in order count
pct_cambio_ingresosfloatPeriod-over-period percentage change in gross revenue

ORM Relationships

The following relationships are declared on the SQLAlchemy models and drive eager-loading behaviour in the routers.
RelationshipCardinalityCascade
PedidoClienteMany-to-oneNone (client outlives orders)
PedidoDetallePedido (.detalles)One-to-manyall, delete-orphan
DetallePedidoPlatoMany-to-oneNone
PedidoFactura (.factura)One-to-one (uselist=False)None
ClientePedido (.pedidos)One-to-many (back-populate)None

Build docs developers (and LLMs) love