Repository navigation
Isha - feat: add rental cost chart endpoints - #2429
Open
Isha2303165 wants to merge 2 commits into
Open
Isha2303165 wants to merge 2 commits into
Isha2303165 wants to merge 2 commits into
Conversation
|
rahulrubugunday
approved these changes
Oct 30, 2026
rahulrubugunday
left a comment
There was a problem hiding this comment.
I have reviewed your PR locally (f79392a, frontend on #5704) and it works as per requirement.
- The rental cost and tool cost endpoints return data for both charts, and filtering by project and by start/end date returns matching results (Project 1 rented total equals the sum of its rental cost points).
- All 14 tests in bmRentalChartController.test.js pass, covering project and date filters, invalid project IDs, owned vs rented tool costs and the error responses.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Task:

Implement backend API support for the BM Dashboard rental cost charts.
The backend should provide aggregated rental cost data that can be consumed by the frontend for two visualizations:
Total Rentals Cost Over Time
How Much of Tools Costs Are Due to Rentals?
The APIs should integrate with the existing BM Dashboard data model and routes and remain compatible with the existing rental chart functionality.
Description
Implements the backend support for the rental cost dashboard charts.
This PR adds API endpoints required to display:
It also adds project and date filtering support and ensures rental data is grouped correctly even when
projectIdvalues are stored as either strings or MongoDB ObjectIds.Implements # (WBS)
Related PRS (if any):
Old: Backend PR #1607,
Old: Frontend PR #3813)
New: FrontEnd [PR 5704]OneCommunityGlobal/HighestGoodNetworkApp#5704
To fully test this backend PR, checkout the related frontend PR #XXX in
HighestGoodNetworkApp.Main changes explained:
bmRentalChartController.jsto add rental cost aggregation APIs.GET /api/bm/rentals/cost-over-time.GET /api/bm/tools/cost-breakdown.projectIdvalues during aggregation to avoid duplicate project entries when IDs are stored as different MongoDB types./api/bm/rentalChartAPI response for backward compatibility.bmRentalChartRouter.jswith the new routes./tools/cost-breakdownis evaluated before the dynamic/tools/:toolIdroute.How to test:
isha-rental-cost-chart-endpointsnpm installif dependencies are not already installed.npm run buildnpm startprojectIdis stored as either a string or ObjectId.Screenshots or videos of changes:
Note:
The backend currently uses the existing rental chart data model containing
rentalCostandtotalMaterialCost.For the stacked chart:
rentalCost.totalMaterialCost - rentalCost.The related frontend PR should be used when testing the complete functionality.