The Reviews API manages user-submitted ratings and comments for cafeteria products on the UniSierra Eats platform. Each review carries a star rating between 1 and 5, a text comment, a timestamp, and a state field (Documentation 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.
activa or reportada). Public read endpoints filter to estado = 'activa' only — reported reviews are hidden from students until an admin takes action.
GET /api/resenas/usuario/:usuario_id
Returns all active reviews written by a specific user, newest first. The response joins theProductos table to include the product name and image alongside each review.
Path Parameter
| Parameter | Type | Description |
|---|---|---|
usuario_id | integer | The id of the user whose reviews to fetch. |
Request Body
None required.Response — 200 OK
Returns a JSON array. Each element has the following fields:Unique identifier of the review.
Star rating given by the user (1–5).
Text body of the review.
Timestamp of when the review was created, as stored by SQLite (e.g.
"2024-11-15 10:32:00").Name of the reviewed product, joined from the
Productos table.Image URL or path of the reviewed product, joined from the
Productos table.Response — 500 Internal Server Error
Example
GET /api/resenas/producto/:producto_id
Returns all active reviews for a specific product, newest first. The response joins theUsuarios table to include the reviewer’s display name.
Path Parameter
| Parameter | Type | Description |
|---|---|---|
producto_id | integer | The id_producto of the product whose reviews to fetch. |
Request Body
None required.Response — 200 OK
Returns a JSON array. Each element has the following fields:Unique identifier of the review.
Star rating given by the reviewer (1–5).
Text body of the review.
Timestamp of when the review was created.
Display name of the reviewer, joined from the
Usuarios table.Response — 500 Internal Server Error
Example
POST /api/resenas
Creates a new review linking a user to a product. Thecalificacion field is subject to a database-level CHECK constraint that restricts values to the range 1–5; values outside this range will trigger a 500 error.
Request Body
The
id of the user submitting the review.The
id_producto of the product being reviewed.Star rating. Must be an integer between
1 and 5 inclusive.Text body of the review.
Response — 200 OK
Confirmation message:
"Reseña guardada con éxito".The
lastID of the newly created review row.Response — 500 Internal Server Error
A
calificacion value outside the 1–5 range will be rejected by the SQLite CHECK constraint and surface as a 500 error with the constraint violation message.Example
PUT /api/resenas/:id
Updates the star rating and comment text of an existing review identified by itsid.
Path Parameter
| Parameter | Type | Description |
|---|---|---|
id | integer | The id of the review to update. |
Request Body
Updated star rating (1–5).
Updated text body of the review.
Response — 200 OK
Confirmation message:
"Reseña actualizada".Response — 500 Internal Server Error
Example
DELETE /api/resenas/:id
Permanently deletes a review from the database by itsid. This action is irreversible. For admin-driven moderation deletion, see DELETE /api/admin/resenas/:id.
Path Parameter
| Parameter | Type | Description |
|---|---|---|
id | integer | The id of the review to delete. |
Request Body
None required.Response — 200 OK
Confirmation message:
"Reseña eliminada".Response — 500 Internal Server Error
Example
PUT /api/resenas/:id/reportar
Flags a review as reported by setting itsestado to 'reportada'. Once flagged, the review no longer appears in the public GET /api/resenas/usuario/:usuario_id or GET /api/resenas/producto/:producto_id responses, and it becomes visible only through the admin moderation endpoint.
Path Parameter
| Parameter | Type | Description |
|---|---|---|
id | integer | The id of the review to flag. |
Request Body
None required.Response — 200 OK
Confirmation message:
"Reseña reportada.".