Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/tutosrive/ferreandina-nosql/llms.txt

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

The Product resource represents an individual item sold across Ferreandina store branches. Each product document holds a human-readable name, a description, a unit price, weight, current stock quantity, and a nullable sell-out date for perishable or seasonal items. Products reference a category via category_id and embed a lightweight supplier object (_id + name) so supplier information is immediately available without a join. Product documents are also embedded inside Branch records to represent per-branch inventory. All CRUD operations are available at /api/products. A special category-filter query (GET /api/products/category/{categoryId}) is documented in Advanced Queries.

Document Schema

_id
integer
required
Unique integer identifier for the product.
name
string
required
Slug-style product name (e.g., "hammer", "copper_wire_12awg").
description
string
required
Full plain-text description of the product.
price
number
required
Unit selling price (double precision).
category_id
integer
required
Integer ID referencing the product’s category in the Categories collection.
quantity
integer
required
Total units in stock across all branches.
unitary_weight
number
required
Weight per unit in kilograms (float).
sould_out_date
string | null
Date string indicating when this product is expected to sell out. null if not applicable.
The field name sould_out_date is a source-level typo for “sold out date”. It is preserved exactly as-is in ProductModel.java and the MongoDB collection for backward compatibility.
supplier
object
required
Embedded summary of the supplier that provides this product.
image
string
required
URL of the product image.

Endpoints

GET /api/products

Returns an array of all product documents.
curl http://localhost:7070/api/products
[
  {
    "_id": 1,
    "name": "hammer",
    "description": "Tools used for striking, driving nails, breaking materials and performing carpentry, construction and repair tasks",
    "price": 100,
    "category_id": 11,
    "quantity": 1000,
    "unitary_weight": 2.5,
    "sould_out_date": null,
    "supplier": { "_id": 1, "name": "Fierros La Central" },
    "image": "https://cdn.jsdelivr.net/gh/tutosrive/images-projects-srm-trg@main/others/ferreandina-nosql/products/hammer.webp"
  }
]

GET /api/products/{id}

Returns a single product by its integer _id.
curl http://localhost:7070/api/products/1
{
  "_id": 1,
  "name": "hammer",
  "description": "Tools used for striking, driving nails, breaking materials and performing carpentry, construction and repair tasks",
  "price": 100,
  "category_id": 11,
  "quantity": 1000,
  "unitary_weight": 2.5,
  "sould_out_date": null,
  "supplier": { "_id": 1, "name": "Fierros La Central" },
  "image": "https://cdn.jsdelivr.net/gh/tutosrive/images-projects-srm-trg@main/others/ferreandina-nosql/products/hammer.webp"
}

POST /api/products

Creates a new product document. Request Body
_id
integer
required
Unique integer ID for the new product.
name
string
required
Slug-style product name.
description
string
required
Full product description.
price
number
required
Unit price (double).
category_id
integer
required
ID of the product’s category.
quantity
integer
required
Units available in stock.
unitary_weight
number
required
Weight per unit in kg (float).
sould_out_date
string
Expected sell-out date string, or null.
supplier
object
required
Embedded supplier summary with _id (integer) and name (string).
image
string
URL of the product image.
curl -X POST http://localhost:7070/api/products \
  -H "Content-Type: application/json" \
  -d '{
    "_id": 11,
    "name": "measuring_tape",
    "description": "25-foot retractable steel measuring tape with a magnetic hook and belt clip.",
    "price": 12.99,
    "category_id": 11,
    "quantity": 500,
    "unitary_weight": 0.35,
    "sould_out_date": null,
    "supplier": { "_id": 1, "name": "Fierros La Central" },
    "image": "https://example.com/measuring_tape.webp"
  }'
{ "insertedId": 11 }

PATCH /api/products/{id}

Partially updates a product. Include only the fields to change. Request Body
name
string
Updated product name.
description
string
Updated description.
price
number
Updated unit price.
category_id
integer
Updated category reference.
quantity
integer
Updated stock quantity.
unitary_weight
number
Updated unit weight.
sould_out_date
string
Updated sell-out date or null.
supplier
object
Updated embedded supplier object.
image
string
Updated image URL.
curl -X PATCH http://localhost:7070/api/products/1 \
  -H "Content-Type: application/json" \
  -d '{ "price": 95.00, "quantity": 1200 }'
{ "modifiedCount": 1 }

DELETE /api/products/{id}

Deletes the product with the given integer _id.
curl -X DELETE http://localhost:7070/api/products/1
{ "deletedCount": 1 }

GET /api/products/category/{categoryId}

Returns all products belonging to a specific category. See Advanced Queries for full details.
curl http://localhost:7070/api/products/category/11

Example Document

{
  "_id": 1,
  "name": "hammer",
  "description": "Tools used for striking, driving nails, breaking materials and performing carpentry, construction and repair tasks",
  "price": 100,
  "category_id": 11,
  "quantity": 1000,
  "unitary_weight": 2.5,
  "sould_out_date": null,
  "supplier": { "_id": 1, "name": "Fierros La Central" },
  "image": "https://cdn.jsdelivr.net/gh/tutosrive/images-projects-srm-trg@main/others/ferreandina-nosql/products/hammer.webp"
}

Build docs developers (and LLMs) love