Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/fredy-rizo/tukit/llms.txt

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

TuKit provides two distinct listing endpoints depending on which side of the transaction you are viewing. The buyer endpoint (list-my-buy) returns all carts where the authenticated user placed the order, querying on user._id. The seller endpoint (list-my-shopping) returns all carts that contain at least one product owned by the authenticated user, querying on products.user._id. Both endpoints share the same pagination middleware (Paginate), which computes skippag and limit from the optional path parameters pag and perpage, and sort results newest-first ({ _id: -1 }).

Buyer’s orders

Method and path

POST /api/shopping-cart/list-my-buy/:pag?/:perpage?
Returns all shopping cart orders where user._id matches the authenticated buyer.

Seller’s sales

Method and path

POST /api/shopping-cart/list-my-shopping/:pag?/:perpage?
Returns all shopping cart orders where at least one entry in products[].user._id matches the authenticated seller.

Authentication

Both endpoints require a valid JWT in the token-access header.
HeaderRequiredDescription
token-access✅ YesJWT issued at login
Requests that omit the token-access header receive 403 Sin token. An expired or invalid token returns 401 Token inexistente.

Path parameters

Both endpoints accept the same optional path parameters.
pag
number
Page number to retrieve. Defaults to 1 (first page). The Paginate middleware sets skippag = (pag - 1) * perpage when pag > 1, otherwise skippag = 0.
perpage
number
Number of results per page. Defaults to 10 when omitted.
Pagination is handled entirely by the Paginate middleware before the route handler runs. The computed skippag and limit values are written onto req.body and used directly in the Mongoose .skip() and .limit() calls.

Query differences

EndpointMongoDB filterWho uses it
list-my-buy{ "user._id": userId }The buyer who placed the orders
list-my-shopping{ "products.user._id": userId }The seller whose products appear in the carts

Responses

Both endpoints return the same response shape on success.

200 — Orders loaded

msj
string
  • "Cargando mis compras" for list-my-buy
  • "Cargando mis ventas" for list-my-shopping
status
boolean
true
data
array
Paginated array of ShoppingCart documents, sorted newest-first.
pagination
object
Pagination metadata.

Error responses

StatusmsjCause
403"Sin token"token-access header is missing
401"Token inexistente"JWT is invalid or expired
203"Error al cargar mis compras"Mongoose query failed in list-my-buy
203"Error al cargar mis ventas"Mongoose query failed in list-my-shopping
500(error object)Unexpected server error

Examples

List buyer’s purchases — page 1, 10 per page (defaults)

curl -X POST https://api.tukit.app/api/shopping-cart/list-my-buy \
  -H "token-access: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

List buyer’s purchases — page 2, 5 per page

curl -X POST https://api.tukit.app/api/shopping-cart/list-my-buy/2/5 \
  -H "token-access: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."

List seller’s incoming sales — page 1, default page size

curl -X POST https://api.tukit.app/api/shopping-cart/list-my-shopping \
  -H "token-access: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
Response (shared shape for both endpoints)
{
  "msj": "Cargando mis compras",
  "status": true,
  "data": [
    {
      "_id": "65a0b1c2d3e4f5a6b7c8d9e0",
      "products": [
        {
          "user": {
            "_id": "63e1f2a3b4c5d6e7f8a9b0c1",
            "userName": "seller_studio",
            "email": "seller@studio.com",
            "roles": [{ "name": "Vendedor", "value": "seller" }],
            "activate": [{ "name": "Activo", "value": "active" }]
          },
          "_id": "64f1a2b3c4d5e6f7a8b9c0d1",
          "title": "Kit Uniforme Clásico",
          "category": "Uniforme",
          "price": 25,
          "format": "AI / PSD",
          "typeProduct": "Pago",
          "discount": "20% OFF",
          "discountPrice": "19.99",
          "subtotal": 19.99
        }
      ],
      "user": {
        "_id": "63a0b1c2d3e4f5a6b7c8d9e1",
        "userName": "carlos_mendez",
        "email": "carlos@email.com",
        "roles": [{ "name": "Comprador", "value": "buyer" }],
        "activate": [{ "name": "Activo", "value": "active" }]
      },
      "total": 19.99,
      "subtotal": 19.99,
      "cantBuy": 1,
      "first_name_client": "Carlos",
      "last_name_client": "Méndez",
      "confirmed_payment": { "key": 1, "name": "Pago" },
      "image_proof": [
        "https://storage.googleapis.com/tukit-bucket/image_proof/receipt_001.jpg"
      ],
      "image_proof_date": "2024_7_12",
      "date_payment": "2024-07-12T14:30:00.000Z",
      "createdAt": "2024-07-12T14:30:00.000Z",
      "updatedAt": "2024-07-12T15:10:00.000Z"
    }
  ],
  "pagination": {
    "pag": "1",
    "perpage": 10,
    "pags": 3
  }
}

Build docs developers (and LLMs) love