Saltar al contenido principal

IngredientCategories

Gestión de Categorías de Ingredientes

Los endpoints de categorías de ingredientes permiten organizar el inventario por tipos de ingredientes.

  • GET /ingredient-categories: Obtiene todas las categorías de ingredientes.

    • Authorization: Requiere access token válido (enviado automáticamente via cookies)
    • cURL Example:
    curl -X GET "http://127.0.0.1:9154/ingredient-categories" \
    -H 'Cookie: accessToken=your_access_token_here' \
    -H 'Cookie: refreshToken=your_refresh_token_here' \
    • Response Body (Éxito - 200 OK):
    [
    {
    "id": "6ff600de-0805-4880-b9d8-a07624b77dec",
    "name": "Cereales"
    },
    {
    "id": "34b3e62d-c150-4c4c-8984-a7a306b910ea",
    "name": "Carnes"
    },
    {
    "id": "58e3e20e-437d-4909-8ddc-4ebf3b7998e1",
    "name": "Aceites y Condimentos"
    }
    ]
    • Response Body (Sin contenido - 204 No Content):
    "No ingredient categories found"
  • GET /ingredient-categories/{id}: Obtiene una categoría específica por su ID.

    • Authorization: Requiere access token válido (enviado automáticamente via cookies)
    • Path Parameters:
      • id (string): ID de la categoría a obtener
    • cURL Example:
    curl -X GET "http://127.0.0.1:9154/ingredient-categories/bcccc9ef-5466-415a-adda-c2e62e154aaf" \
    -H 'Cookie: accessToken=your_access_token_here' \
    -H 'Cookie: refreshToken=your_refresh_token_here'
    • Response Body (Éxito - 200 OK):
    {
    "id": "bcccc9ef-5466-415a-adda-c2e62e154aaf",
    "name": "Cereales"
    }
    • Response Body (Error - 400 Bad Request):
    "Missing or malformed ID"
    • Response Body (Error - 404 Not Found):
    "Ingredient category not found"
  • POST /ingredient-categories: Crea una nueva categoría de ingredientes.

    • Authorization: Requiere access token válido (enviado automáticamente via cookies)
    • Request Body:
    {
    "name": "string"
    }
    • cURL Example:
    curl -X POST "http://127.0.0.1:9154/ingredient-categories" \
    -H 'Cookie: accessToken=your_access_token_here' \
    -H 'Cookie: refreshToken=your_refresh_token_here' \
    -H "Content-Type: application/json" \
    -d '{
    "name": "Lácteos"
    }'
    • Response Body (Éxito - 201 Created):
    {
    "id": "09a2aead-7eaa-4b4a-b5e4-aa8e18fe6028",
    "message": "Ingredient category added successfully"
    }
    • Response Body (Error - 400 Bad Request):
    "Failed to create ingredient category"
  • PUT /ingredient-categories/{id}: Actualiza una categoría existente.

    • Authorization: Requiere access token válido (enviado automáticamente via cookies)
    • Path Parameters:
      • id (string): ID de la categoría a actualizar
    • Request Body:
    {
    "name": "string"
    }
    • cURL Example:
    curl -X PUT "http://127.0.0.1:9154/ingredient-categories/5c339473-d10d-432f-9666-b79be0f1201a" \
    -H 'Cookie: accessToken=your_access_token_here' \
    -H 'Cookie: refreshToken=your_refresh_token_here' \
    -H "Content-Type: application/json" \
    -d '{
    "name": "Cereales y Granos"
    }'
    • Response Body (Éxito - 200 OK):
    "Ingredient category updated successfully"
    • Response Body (Error - 400 Bad Request):
    "Missing or malformed ID"
    • Response Body (Error - 404 Not Found):
    "Ingredient category not found or update failed"
  • DELETE /ingredient-categories/{id}: Elimina una categoría del sistema.

    • Authorization: Requiere access token válido (enviado automáticamente via cookies)
    • Path Parameters:
      • id (string): ID de la categoría a eliminar
    • cURL Example:
    curl -X DELETE "http://127.0.0.1:9154/ingredient-categories/1121cbb8-741b-4e63-9d38-cbbdf3099ea4" \
    -H 'Cookie: accessToken=your_access_token_here' \
    -H 'Cookie: refreshToken=your_refresh_token_here'
    • Response Body (Éxito - 204 No Content):
    "Ingredient category deleted successfully"
    • Response Body (Error - 400 Bad Request):
    "Missing or malformed ID"
    • Response Body (Error - 400 Bad Request):
    "Cannot delete ingredient category - it may be in use or not found"

Notas importantes:

  • Todos los endpoints de categorías de ingredientes requieren autenticación
  • Los IDs de categorías son UUID generados automáticamente
  • No se puede eliminar una categoría que tenga ingredientes asociados
  • Las categorías ayudan a organizar el inventario por tipos de ingredientes
  • Ejemplos de categorías: Cereales, Carnes, Verduras, Lácteos, Condimentos, etc.