Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Carlos-Gnd/FERRED-Inventario-y-Ventas/llms.txt

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

Categories organize products into logical groups. Every product can belong to one category, and the categories API supports filtering products by category in the products endpoint. The list endpoint includes a product count per category and falls back to the local SQLite replica when the cloud database is unreachable. Base URL: https://server-production-3252.up.railway.app

GET /api/categorias

Returns all active categories, ordered alphabetically by name. Each entry includes the number of products assigned to it. Required role: Any authenticated user (ADMIN, CAJERO, BODEGA)

Response

Array of category objects.
id
number
Unique category ID.
nombre
string
Category name (unique across the catalog).
descripcion
string | null
Optional description of the category.
nProductos
number
Number of active products assigned to this category.
list categories
curl --request GET \
  --url https://server-production-3252.up.railway.app/api/categorias \
  --header 'Authorization: Bearer <token>'

POST /api/categorias

Creates a new category. Category names must be unique — attempting to create a duplicate name returns 400. Required role: ADMIN or BODEGA

Request body

nombre
string
required
Category name. Minimum 2 characters. Must be unique.
descripcion
string
Optional description for the category.

Response

mensaje
string
Confirmation message: "Categoría creada".
categoria
object
The newly created category.

Error responses

StatusCondition
400Validation failed (name too short) or a category with that name already exists.
401Missing or invalid Bearer token.
403Authenticated user’s role is not ADMIN or BODEGA.
create category
curl --request POST \
  --url https://server-production-3252.up.railway.app/api/categorias \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
    "nombre": "Herramientas eléctricas",
    "descripcion": "Taladros, sierras, lijadoras y accesorios"
  }'

PUT /api/categorias/:id

Updates an existing category. All fields are optional (partial update). Required role: ADMIN or BODEGA

Path parameters

id
number
required
ID of the category to update.

Request body

nombre
string
New category name. Minimum 2 characters.
descripcion
string
New description.

Response

mensaje
string
Confirmation: "Categoría actualizada".
categoria
object
The updated category object (same shape as create response).

DELETE /api/categorias/:id

Soft-deletes a category by setting activo = false. The category is hidden from the list endpoint but its data is preserved so that existing product foreign key references remain valid. Products previously assigned to this category retain their categoriaId and are unaffected. Required role: ADMIN only

Path parameters

id
number
required
ID of the category to deactivate. Must be a positive integer.

Response

mensaje
string
Confirmation: "Categoría desactivada".

Error responses

StatusCondition
400id is not a valid positive integer.
403Authenticated user’s role is not ADMIN.
404No category found with the given ID (Prisma record not found).

Build docs developers (and LLMs) love