The moderation panel provides administrators with a queue of student-flagged reviews that have been hidden from public view. Located atDocumentation 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.
admin/moderacion.html, it is powered by the iniciarModeracion() function in admin.js, which is called automatically when the admin router detects moderacion.html in the URL.
How a Review Gets Reported
Any logged-in user browsing the product detail page can flag a review by clicking the flag icon next to it. This triggers aPUT request to /api/resenas/:id/reportar, which sets the review’s estado field to 'reportada' in the Resenas table. Once reported, the review is immediately hidden from public product pages — only reviews with estado = 'activa' are returned by the public review endpoints.
Moderation Workflow
Student Flags a Review
A logged-in user clicks the flag icon on any review in the product detail page. The client sends
PUT /api/resenas/:id/reportar. The server sets estado = 'reportada' and the review disappears from public view immediately.Review Enters the Moderation Queue
The flagged review appears in the admin moderation panel. The panel loads all reviews with
estado = 'reportada' from GET /api/admin/resenas-reportadas.Admin Reviews the Content
The admin reads the review card, which includes the reviewer’s name, the product being reviewed, the star rating, the comment text, and the submission date.
Loading Reported Reviews
On page load,iniciarModeracion() calls GET /api/admin/resenas-reportadas. The server executes the following SQL query to return all flagged reviews with their associated user and product names:
fecha DESC so the most recently flagged reviews appear first.
Review Cards
Each flagged review is rendered as a card inside.moderation-grid. The card displays:
| Field | Source |
|---|---|
| Reviewer name | usuario_nombre |
| Product name | producto_nombre |
| Star rating | calificacion (rendered as star icons) |
| Comment text | comentario |
| Date | fecha |
Moderator Actions
Each card exposes two action buttons:Ignorar Reporte (Restore)
Clicking Ignorar Reporte callswindow.aprobarResena(id). The function first shows a confirm() dialog asking the admin to confirm the restoration. If confirmed, it sends:
estado = 'activa' for that review. It returns to public visibility on the product detail page immediately. After the request completes, the moderation queue reloads.
Eliminar (Delete)
Clicking Eliminar callswindow.eliminarResena(id). The function first shows a confirm() dialog asking the admin to confirm the permanent deletion. If confirmed, it sends:
Resenas table in SQLite. This action is irreversible. After the request completes, the moderation queue reloads.
Empty State
When there are no reviews withestado = 'reportada', the moderation grid renders a centered message with a checkmark icon:
¡Todo limpio! No hay reseñas pendientes de moderación.This state is reached both when all reports have been acted on and when no reviews have ever been flagged.