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 Branch resource represents a physical Ferreandina hardware store location. Each branch document stores the branch name, city, street address, main-branch flag, and a cover image URL. Two embedded arrays are maintained directly inside the branch document: a products array capturing current inventory (product ID, name, quantity, and image) and a workers array listing staff assigned to that branch (worker ID, name, and image). All CRUD operations are available at /api/branches. Four additional aggregation-based queries (city lookups, inventory reports, and more) are also supported — see Advanced Queries .
Document Schema
Unique integer identifier for the branch.
Slug-style name for the branch (e.g., "ferreandina-manizales").
City where the branch is located (e.g., "manizales").
Street address of the branch (e.g., "Cra 3 #23-12").
Whether this is the main/headquarters branch.
URL of the branch cover image.
Embedded array of products currently stocked at this branch. Product identifier (references the Products collection).
Product name slug (e.g., "hammer").
Units in stock at this branch.
URL of the product image.
Embedded array of workers assigned to this branch. Worker identifier (references the Workers collection).
URL of the worker’s profile image.
Endpoints
GET /api/branches
Returns an array of all branch documents.
curl http://localhost:7070/api/branches
[
{
"_id" : 1 ,
"name" : "ferreandina-manizales" ,
"city" : "manizales" ,
"direction" : "Cra 3 #23-12" ,
"is_main" : false ,
"image" : "https://cdn.jsdelivr.net/gh/tutosrive/images-projects-srm-trg@main/others/ferreandina-nosql/branches/ferreandina-manizales.webp" ,
"products" : [ "..." ],
"workers" : [ "..." ]
}
]
GET /api/branches/{id}
Returns a single branch by its integer _id.
curl http://localhost:7070/api/branches/1
{
"_id" : 1 ,
"name" : "ferreandina-manizales" ,
"city" : "manizales" ,
"direction" : "Cra 3 #23-12" ,
"is_main" : false ,
"image" : "https://cdn.jsdelivr.net/gh/tutosrive/images-projects-srm-trg@main/others/ferreandina-nosql/branches/ferreandina-manizales.webp" ,
"products" : [
{
"_id" : 1 ,
"name" : "hammer" ,
"quantity" : 10 ,
"image" : "https://cdn.jsdelivr.net/gh/tutosrive/images-projects-srm-trg@main/others/ferreandina-nosql/products/hammer.webp"
}
],
"workers" : [
{
"_id" : 1 ,
"name" : "Eduardo Sánchez" ,
"image" : "https://cdn.jsdelivr.net/gh/tutosrive/images-projects-srm-trg@main/others/ferreandina-nosql/workers/1.jpg"
}
]
}
POST /api/branches
Creates a new branch. Send all required fields as a JSON body.
Request Body
Unique integer ID for the new branch.
Street address of the branch.
Set true if this is the headquarters branch.
URL for the branch cover image.
Initial embedded product inventory array.
Initial embedded worker array.
curl -X POST http://localhost:7070/api/branches \
-H "Content-Type: application/json" \
-d '{
"_id": 2,
"name": "ferreandina-bogota",
"city": "bogota",
"direction": "Calle 72 #10-34",
"is_main": true,
"image": "https://example.com/bogota.webp",
"products": [],
"workers": []
}'
PATCH /api/branches/{id}
Partially updates an existing branch. Only include the fields you want to change.
Request Body
Updated main-branch flag.
Replacement products array.
Replacement workers array.
curl -X PATCH http://localhost:7070/api/branches/1 \
-H "Content-Type: application/json" \
-d '{ "direction": "Cra 5 #45-20" }'
DELETE /api/branches/{id}
Deletes the branch with the given integer _id.
curl -X DELETE http://localhost:7070/api/branches/1
Special Endpoints
Four additional query endpoints exist for branches (city filtering, inventory aggregations, and more). See Advanced Queries for the full reference.
Example Document
{
"_id" : 1 ,
"name" : "ferreandina-manizales" ,
"city" : "manizales" ,
"direction" : "Cra 3 #23-12" ,
"is_main" : false ,
"image" : "https://cdn.jsdelivr.net/gh/tutosrive/images-projects-srm-trg@main/others/ferreandina-nosql/branches/ferreandina-manizales.webp" ,
"products" : [
{
"_id" : 1 ,
"name" : "hammer" ,
"quantity" : 10 ,
"image" : "https://cdn.jsdelivr.net/gh/tutosrive/images-projects-srm-trg@main/others/ferreandina-nosql/products/hammer.webp"
},
{
"_id" : 3 ,
"name" : "power_drill" ,
"quantity" : 4500 ,
"image" : "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQabipjJj6zlLRVhlf8dq6SNxXqeyfGTFRu20wY_kaSZfhmzl1CzisyBZNKrUUW"
},
{
"_id" : 4 ,
"name" : "drywall_screws" ,
"quantity" : 6500 ,
"image" : "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcQi8_UnoQjJPtKL3J0IGaWxtNTU9WCyoesNjaAf-Q4dbkwD1TCh7HKVUDvH2JL5"
},
{
"_id" : 5 ,
"name" : "copper_wire_12awg" ,
"quantity" : 2300 ,
"image" : "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcRSeOJ-CxlNs5ztlkT-_cOfG3Rpwu56JL_hR8Us67qji9uweafOVFqeaRCowpEU"
}
],
"workers" : [
{
"_id" : 1 ,
"name" : "Eduardo Sánchez" ,
"image" : "https://cdn.jsdelivr.net/gh/tutosrive/images-projects-srm-trg@main/others/ferreandina-nosql/workers/1.jpg"
},
{
"_id" : 2 ,
"name" : "Santiago Marin" ,
"image" : "https://cdn.jsdelivr.net/gh/tutosrive/images-projects-srm-trg@main/others/ferreandina-nosql/workers/2.jpg"
}
]
}