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 Supply resource records individual product delivery events from suppliers to Ferreandina. Each supply document embeds a lightweight supplier reference and an array of products included in the shipment — each product item carrying its ID, name, and quantity received. The document also tracks the number of defective units found in the delivery and the entry date. All CRUD operations are available at /api/supplies. A special defective-report aggregation query (GET /api/supplies/defective-report) is documented in Advanced Queries.
The field defective_quanity contains a source-level typo — the letter t is missing from “quantity”. This spelling is present in SupplieModel.java and the MongoDB collection, and must be used exactly as-is when reading or writing this field.
The Java model class is SupplieModel (not SupplyModel) and its internal field for the supplier is named suplier (missing the second p). However, the wire-format JSON key in the database seed is "supplier". Use "supplier" in all API requests and responses.

Document Schema

_id
integer
required
Unique integer identifier for the supply record.
supplier
object
required
Embedded summary of the supplier who made the delivery.
products
array
required
Array of products included in this supply delivery.
defective_quanity
integer
required
Number of units found to be defective in this delivery.
Note the intentional source typo in the field name: defective_quanity (missing the t in “quantity”). Use this exact spelling in all requests and queries.
entry_date
string
required
Date the delivery was received, stored as a string (e.g., "12/08/2026").

Endpoints

GET /api/supplies

Returns an array of all supply records.
curl http://localhost:7070/api/supplies
[
  {
    "_id": 1,
    "supplier": { "_id": 1, "name": "Fierros La Central" },
    "products": [
      { "_id": 1, "name": "hammer", "quantity": 45 },
      { "_id": 2, "name": "power_drill", "quantity": 45 },
      { "_id": 7, "name": "safety_glasses", "quantity": 45 },
      { "_id": 6, "name": "copper_wire_12awg", "quantity": 45 }
    ],
    "defective_quanity": 12,
    "entry_date": "12/08/2026"
  }
]

GET /api/supplies/{id}

Returns a single supply record by its integer _id.
curl http://localhost:7070/api/supplies/1
{
  "_id": 1,
  "supplier": { "_id": 1, "name": "Fierros La Central" },
  "products": [
    { "_id": 1, "name": "hammer", "quantity": 45 },
    { "_id": 2, "name": "power_drill", "quantity": 45 },
    { "_id": 7, "name": "safety_glasses", "quantity": 45 },
    { "_id": 6, "name": "copper_wire_12awg", "quantity": 45 }
  ],
  "defective_quanity": 12,
  "entry_date": "12/08/2026"
}

POST /api/supplies

Creates a new supply record. Request Body
_id
integer
required
Unique integer ID for the new supply record.
supplier
object
required
Embedded supplier summary with _id (integer) and name (string).
products
array
required
Array of delivered products. Each item needs _id (integer), name (string), and quantity (integer).
defective_quanity
integer
required
Number of defective units received. (Note the typo — this is the exact field name.)
entry_date
string
required
Delivery date string (e.g., "15/09/2026").
curl -X POST http://localhost:7070/api/supplies \
  -H "Content-Type: application/json" \
  -d '{
    "_id": 2,
    "supplier": { "_id": 1, "name": "Fierros La Central" },
    "products": [
      { "_id": 10, "name": "drywall_screws", "quantity": 200 }
    ],
    "defective_quanity": 3,
    "entry_date": "01/10/2026"
  }'
{ "insertedId": 2 }

PATCH /api/supplies/{id}

Partially updates a supply record. Include only the fields to change. Request Body
supplier
object
Updated embedded supplier object.
products
array
Updated product delivery array.
defective_quanity
integer
Updated defective unit count.
entry_date
string
Updated entry date string.
curl -X PATCH http://localhost:7070/api/supplies/1 \
  -H "Content-Type: application/json" \
  -d '{ "defective_quanity": 8 }'
{ "modifiedCount": 1 }

DELETE /api/supplies/{id}

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

GET /api/supplies/defective-report

Returns an aggregated defective-items report across all supply records. See Advanced Queries for full details.
curl http://localhost:7070/api/supplies/defective-report

Example Document

{
  "_id": 1,
  "supplier": { "_id": 1, "name": "Fierros La Central" },
  "products": [
    { "_id": 1, "name": "hammer", "quantity": 45 },
    { "_id": 2, "name": "power_drill", "quantity": 45 },
    { "_id": 7, "name": "safety_glasses", "quantity": 45 },
    { "_id": 6, "name": "copper_wire_12awg", "quantity": 45 }
  ],
  "defective_quanity": 12,
  "entry_date": "12/08/2026"
}

Build docs developers (and LLMs) love