The UniSierra Eats product catalog is powered by aDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/JuseAR27/Unisierra-eats/llms.txt
Use this file to discover all available pages before exploring further.
Productos SQLite table and a single REST endpoint that computes live averages and review counts on every request. Students can browse the full catalog, filter by category, or navigate directly to an individual product detail page to read reviews and pricing information.
Data Model
Products are stored in theProductos table with the following fields:
| Field | Type | Description |
|---|---|---|
id_producto | INTEGER | Primary key |
nombre | TEXT | Display name of the product |
precio | REAL | Numeric price in Mexican pesos (MXN) |
precioNivel | TEXT | Price tier stored in the DB ($, $$, $$$); overridden by the frontend — see note below |
descripcion | TEXT | Short description shown in cards and search results |
imagen | TEXT | URL to the product image |
categoria | TEXT | Category slug: comidas, bebidas, snacks, sanas |
calificacion | REAL | Computed average rating (not stored; derived via JOIN) |
numResenas | INTEGER | Computed review count (not stored; derived via JOIN) |
Although
precioNivel is stored in the database and accepted by POST /api/productos, the frontend function obtenerProductosAPI() overwrites it at runtime using only two tiers: "$" for products under 40 MXN and "$$" for everything else. The $$$ value stored in the DB is therefore never displayed to students.Frontend Price Tiers
TheobtenerProductosAPI() function in app.js computes the displayed price tier from the numeric precio field:
| Symbol | Price Range |
|---|---|
$ | Under 40 MXN |
$$ | 40 MXN and above |
Categories
Comidas
Main dishes and hot meals served at the cafeteria — tortas, chilaquiles, and other cooked plates.
Bebidas
Hot and cold drinks including café americano, agua fresca, and other beverages.
Snacks
Quick bites and light snacks such as papas a la francesa and galletas con chispas.
Sanas
Healthy options including salads and fruit cocktails for health-conscious students.
API Endpoint
GET /api/productos
Returns the full list of products. Each product includes a live-computed average rating and total review count, calculated via aLEFT JOIN on the Resenas table so products with zero reviews still appear with calificacion: 0 and numResenas: 0.
Response (200 OK):
SQL Query
The server runs the following query on everyGET /api/productos request to compute averages in real time:
IFNULL ensures that products without any reviews return 0 rather than NULL for calificacion.
Frontend Integration
TheobtenerProductosAPI() function in app.js fetches all products from the API and normalizes the response for the frontend. It overwrites precioNivel using the two-tier formula above and applies a fallback image URL for products with no imagen value set:
Product Detail Page
Each product has a dedicated detail page accessible at:obtenerProductosAPI() by matching id_producto, then separately fetches that product’s active reviews from GET /api/resenas/producto/:producto_id. It displays:
- Product name, description, and image
- Star rating and total review count
- A progress-bar breakdown of ratings from 5 stars down to 1
- A chronological list of student review comments
- A Escribir Reseña button (requires an active session)
Seeded Sample Products
The database is pre-populated with the following products. Note thatprecioNivel shown in the UI is always computed by the frontend from precio, not read from the database.
| Name | Price (MXN) | Frontend Display | Category |
|---|---|---|---|
| Torta de Asada | $65 | $$ | comidas |
| Chilaquiles Rojos | $55 | $$ | comidas |
| Café Americano | $20 | $ | bebidas |
| Agua Fresca de Jamaica | $15 | $ | bebidas |
| Papas a la Francesa | $35 | $ | snacks |
| Galleta con Chispas | $15 | $ | snacks |
| Ensalada de Pollo | $75 | $$ | sanas |
| Coctel de Frutas | $40 | $$ | sanas |