Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/AndrewwCO/Panahashi-Backend/llms.txt

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

The Cart API manages a per-user shopping cart stored in Firestore. Each cart is tied to a single bakery — adding an item from a different bakery automatically clears the existing cart first. The cart is automatically cleared when a successful order is placed.

Cart object

userId
string
Firebase UID of the cart owner.
bakeryId
string
ID of the bakery this cart is for.
bakeryName
string
Name of the bakery.
items
CartItem[]
List of items in the cart.
updatedAt
integer
Last updated epoch ms.

GET /api/v1/cart

Returns the authenticated customer’s current cart. Auth required: Yes — CUSTOMER
curl -H "Authorization: Bearer <token>" \
  http://localhost:8080/api/v1/cart
Response:
{
  "success": true,
  "data": {
    "userId": "uid123",
    "bakeryId": "bak001",
    "bakeryName": "Panadería El Trigal",
    "items": [
      { "productId": "prod001", "name": "Croissant", "price": 3.5, "emoji": "🥐", "qty": 2 }
    ]
  }
}

POST /api/v1/cart/items

Adds an item to the cart or increments its quantity if already present. Auth required: Yes — CUSTOMER
bakeryId
string
required
Bakery the product belongs to.
productId
string
required
Product ID to add.
qty
integer
required
Quantity to add.
curl -X POST \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"bakeryId":"bak001","productId":"prod001","qty":2}' \
  http://localhost:8080/api/v1/cart/items
If the bakeryId differs from the current cart’s bakery, the cart is cleared before the new item is added.

PATCH /api/v1/cart/items

Updates the quantity of an existing cart item. Set qty to 0 to remove the item. Auth required: Yes — CUSTOMER
productId
string
required
Product ID to update.
qty
integer
required
New quantity. Use 0 to remove the item from the cart.
curl -X PATCH \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"productId":"prod001","qty":3}' \
  http://localhost:8080/api/v1/cart/items

DELETE /api/v1/cart

Clears all items from the cart. Auth required: Yes — CUSTOMER
curl -X DELETE \
  -H "Authorization: Bearer <token>" \
  http://localhost:8080/api/v1/cart
The cart is automatically cleared when you place an order via POST /api/v1/orders.

Build docs developers (and LLMs) love