Get dashboard statistics
GET/company/dashboard/
Returns auction and delivery statistics for the Cargoffer business dashboard.
Provides aggregated metrics of operational and financial activity for auctions and deliveries for a company's dashboard, enabling performance analysis and activity tracking within a specific date range.
Objective
Enable companies to visualize the performance of their logistics operations through key performance indicators (KPIs) based on auctions and deliveries completed.
Use Cases
- Main dashboard: visualization of KPIs for the last year (default values)
- Quarterly reports: GET /?minDate=2024-01-01&maxDate=2024-03-31
- Monthly analysis: GET /?minDate=2024-05-01&maxDate=2024-05-31
- Annual analysis: GET /?minDate=2023-01-01&maxDate=2023-12-31
Auction Metrics
For each auction group, the following aggregated data is returned:
- total_sale: Total sales amount calculated based on bid logic
- total_auctions: Number of auctions in the group
- total_savings: Total savings vs. initial price (total_start_price - total_sale)
- sumBidWinner: Sum of winning bid amounts
- total_start_price: Sum of initial prices of all auctions
Calculation of total_sale per auction:
- If there is a winning bid (bidWinner): use the amount of that bid
- If not, but there is an assigned bid (bidAsigned): use the amount of that bid
- If it has no bids: use the initial price (start_price)
Auction groups:
- auctions: All auctions (statuses: planned, published, awarded, approved)
- publishedAuctions: Published auctions (status: published)
- awardedAuctions: Awarded auctions (status: awarded)
- approvedAuctions: Approved auctions (status: approved)
- plannedAuctions: Planned auctions (status: planned)
Delivery Metrics
For each delivery group, the following aggregated data is returned:
- total_sale: Total delivery amount (based on winning or assigned bids)
- total_deliveries: Number of deliveries in the group
- sumBidWinner: Sum of winning bid amounts
Delivery groups:
- plannedDeliveries: Planned deliveries (status:
Request
Responses
- 200
- 401
- 404
- 500
Statistics retrieved successfully. Contains the following data groups:
Auction Groups (AuctionStats):
- auctions: All auctions (planned, published, awarded, approved)
- publishedAuctions: Published auctions
- awardedAuctions: Awarded auctions
- approvedAuctions: Approved auctions
- plannedAuctions: Planned auctions
Delivery Groups (DeliveryStats):
- plannedDeliveries: Planned deliveries
- collectedDeliveries: Collected deliveries
- deliveredDeliveries: Completed deliveries
Each auction group includes: total_sale, total_auctions, total_savings, sumBidWinner, total_start_price Each delivery group includes: total_sale, total_deliveries, sumBidWinner
Response Headers
Unauthorized. The JWT token is invalid, has expired, or does not have permission to access these statistics.
Solutions:
- Verify that the token is valid and has not expired
- Ensure the user has an 'empresa' (company) role
- Request a new authentication token
Response Headers
User or company not found. This occurs when:
- The company ID associated with the user does not exist
- The user has no company assigned
- The company has been deactivated
Solutions:
- Verify that the user has a valid company assigned
- Contact the administrator if the company appears as deactivated
Response Headers
Internal server error