Sales Report
Get Sales Report

Get Sales Report

Fetch Sales Report to see perform of seller store

Endpoint

Base URL
http://localhost:8080
Method and Endpoint
GET /api/sellers/current/stores/{store_id}/report
Headers
Authorization: Bearer access_token

Route Param

store_id: string (required)

Responses

You will get responses like this:

200 (success)

Response Body
{
  "message": "Get Sales Report Successfully",
  "result": {
    "store_id": "ST123456",
    "email": "storeowner@example.com",
    "total_sales": 5000,
    "total_income": 125000.0,
    "products": [
      {
        "product_id": "WH123456",
        "total_sales": 2500,
        "stock": 150
      },
      {
        "product_id": "SW789012",
        "total_sales": 1800,
        "stock": 200
      },
      {
        "product_id": "LS345678",
        "total_sales": 700,
        "stock": 50
      }
    ]
  }
}

404 (not found)

Response Body
{
  "error": "this seller has no store"
}

401 (unauthorized)

Response Body
{
  "error": "Invalid authorization header"
}

401 (unauthorized - expire token)

Response Body
{
  "error": "token is expired: token is expired by 2m19s"
}

500 (server error)

Response Body
{
  "error": "Internal server error"
}

500 (server error - failed)

If query to database get troble while get the store data

Response Body
{
  "error": "failed to get store by email and id"
}

500 (server error - failed)

If query to database get troble while get the sales_report data

Response Body
{
  "error": "failed to get sales report"
}