Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/JaiderT/CoffeePrice/llms.txt

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

The admin role is the superuser tier of CoffePrice. Admins have unrestricted read and write access across all data, can approve or reject buyer registrations, moderate platform content, and tune configuration settings that affect every user. Because the admin role carries significant privilege, there is no self-service registration path — admin accounts must be provisioned directly.
There is no public registration flow for admin accounts. An admin account must be created directly in the MongoDB database or promoted from an existing account by a current admin (via PUT /api/usuario/:id/actualizar with "rol": "admin").

Admin Dashboard

The admin dashboard at /admin/dashboard gives a real-time overview of platform activity, including:
  • Total registered users broken down by role and estado
  • Pending buyer approval requests
  • Recent news articles and their publication status
  • Platform configuration summary
  • Pending review moderation queue

User Management

Admins have full CRUD control over every user account on the platform.
GET /api/usuario
Authorization: Bearer <admin_token>
Returns an array of all user documents. Sensitive fields (password, codigoRecuperacion, codigoVerificacion, etc.) are stripped from the response.
[
  {
    "_id": "664a1f...",
    "nombre": "Carlos",
    "apellido": "Muñoz",
    "email": "carlos@example.com",
    "rol": "productor",
    "estado": "activo",
    "ultimaConexion": "2025-05-10T08:23:00.000Z"
  }
]

Buyer Approval

Buyer approval is the most time-sensitive admin task. When a new comprador completes their profile, all active admins receive an email notification. The approval workflow is managed through the comprador API.
1

Review pending buyers

GET /api/comprador
Authorization: Bearer <admin_token>
Returns all buyer profiles regardless of estadoRevision, including those in enRevision. Each document is populated with the linked user’s nombre, apellido, email, and estado.
2

Approve or reject via user state

Use PUT /api/usuario/:id/estado (see User Management above) with estado: "activo" to approve or estado: "rechazado" to reject. This is the canonical approval path because it updates both the user record and the buyer’s estadoRevision atomically and triggers the decision email.
3

Update buyer profile directly

PUT /api/comprador/:id
Authorization: Bearer <admin_token>
Content-Type: application/json

{
  "estadoRevision": "aprobado",
  "municipio": "Pitalito",
  "descripcion": "Updated by admin after review."
}
Admins can edit any field on a buyer profile, including estadoRevision, without going through the user state endpoint. Use this for corrections or re-approvals.

News Management

CoffePrice surfaces coffee industry news to all users. Admins control the full lifecycle of news articles.
EndpointMethodDescription
/api/noticiasPOSTCreate a new news article manually
/api/noticias/:idPUTUpdate an existing article
/api/noticias/:idDELETERemove an article from the platform
/api/noticias/generar-automaticasPOSTTrigger the AI pipeline to generate news articles automatically
/api/noticias/limpiar-danadasPOSTRemove or repair malformed/broken articles from the database

Creating an Article Manually

POST /api/noticias
Authorization: Bearer <admin_token>
Content-Type: application/json

{
  "titulo": "Precio del café sube por tercer día consecutivo",
  "contenido": "El precio de referencia FNC alcanzó...",
  "imagen": "https://cdn.coffeprice.co/noticias/imagen.jpg",
  "fuente": "FNC",
  "categoria": "precios"
}

AI-Generated News

POST /api/noticias/generar-automaticas
Authorization: Bearer <admin_token>
Triggers the automatic news generation pipeline. The system fetches recent market data and produces summaries that are saved as draft articles for admin review before publication.

Platform Configuration

Global platform settings (such as price update intervals, alert thresholds, feature flags, and notification preferences) are stored in a single configuration document.
GET /api/configuracion
Authorization: Bearer <admin_token>
PUT /api/configuracion
Authorization: Bearer <admin_token>
Content-Type: application/json

{
  "intervaloActualizacionPrecios": 30,
  "alertasHabilitadas": true,
  "mantenimiento": false
}
GET /api/configuracion and PUT /api/configuracion are restricted to the admin role. Non-admin users receive a 403 response.

Review Moderation

Users can submit platform reviews. Admins moderate the queue before reviews become publicly visible.
EndpointMethodDescription
/api/resenas-plataforma/todasGETList all submitted reviews (including pending ones)
/api/resenas-plataforma/:id/aprobarPUTApprove a review and make it publicly visible
/api/resenas-plataforma/:idDELETERemove a review permanently

Approving a Review

PUT /api/resenas-plataforma/:id/aprobar
Authorization: Bearer <admin_token>
A 200 response confirms the review has been approved. Approved reviews appear in the public-facing section of the platform landing page.

Admin Frontend Routes

RouteComponentDescription
/admin/dashboardDashboardAdminPlatform activity overview
/admin/perfilPerfilAdminAdmin’s own profile and account settings
/configuracionConfiguracionPlatform configuration editor
/historialHistorialFull price history (accessible to admins and producers)
/prediccionesPrediccionesPrice prediction view
/mapaMapaCompradoresRegional buyer map (rendered in LayoutComprador)

Permission Summary

ActionEndpointAdminCompradorProductor
List all usersGET /api/usuario
Change user estadoPUT /api/usuario/:id/estado
List all buyersGET /api/comprador
Update any buyerPUT /api/comprador/:idOwner only
Create newsPOST /api/noticias
Platform configPUT /api/configuracion
Moderate reviewsPUT /api/resenas-plataforma/:id/aprobar
View pricesGET /api/precios
View predictionsGET /api/predicciones✅ (public)✅ (public)✅ (public)

Build docs developers (and LLMs) love