Skip to content

Comments

SaiKrishna Actual Cost Breakdown Donut Chart Back End#1895

Merged
one-community merged 2 commits intodevelopmentfrom
saikrishna_DonutChartForActualCostBreakdown_Backend
Feb 20, 2026
Merged

SaiKrishna Actual Cost Breakdown Donut Chart Back End#1895
one-community merged 2 commits intodevelopmentfrom
saikrishna_DonutChartForActualCostBreakdown_Backend

Conversation

@saikrishnaraoyadagiri
Copy link
Contributor

Description

Backend Requirements
API Endpoint:

GET /api/projects/:id/planned-cost-breakdown

Data Structure:
{
plumbing: 5500,
electrical: 4800,
structural: 7600,
mechanical: 6300
}

Database Schema:
{
projectId: ObjectId,
category: String, // Plumbing / Electrical / Structural / Mechanical
plannedCost: Number
}
Data Retrieval Logic:

Query by projectId.
Group planned costs by category.
Sum up planned costs per category.
Return structured breakdown.

Dependencies:

express for API routing.
mongoose for database interaction.

Related PRS (if any):

To test this backend PR you need to checkout the #4373 frontend PR.

Main changes explained:

Updated routes.js — Added actualCostRouter registration
Created actualCost.js — Mongoose model for Actual Cost with projectId, date, category, cost, and timestamps
Created actualCostController.js -Controller with getActualCostBreakdown for cost breakdown by category and percentage changes
Created actualCostRouter.js — Router for GET /api/projects/:id/actual-cost-breakdown endpoint

How to test:

  1. check into current branch
  2. do npm install and ... to run this PR locally
  3. Clear site data/cache
  4. log as admin user
  5. Go to http://localhost:4500/api/projects/:ProjectId/actual-cost-breakdown (replace the project id with the actual project id). I have set up the data for this project id 68747d37c71d9f67ac207eef
    http://localhost:4500/api/projects/663fe67571353a40c423d777/actual-cost-breakdown(this is just an example if data is not found for this project, setup the data for any project and check)
  6. You can setup the data for other project ids and can test. you need to setup the data in this collection " actualcosts"
  7. Each type can have multiple entries with different costs in the same project and when we hit the api we should get the combined costs

Screenshots or videos of changes:

image

@one-community one-community added the High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible label Feb 18, 2026
@one-community one-community changed the title SaiKrishna_ActualCostBreakdownDonutChartBackEnd SaiKrishna - Actual Cost Breakdown Donut Chart Back End Feb 19, 2026
Copy link

@Anusha-Gali Anusha-Gali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Sai Krishna,

I have reviewed your PR locally and the API response is as per requirement.

Image Image Screenshot 2026-02-18 at 11 54 28 PM

Copy link

@HemanthNidamanuru HemanthNidamanuru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Sai Krishna,

Tested the backend APIs for Actual Cost Breakdown and verified correct data retrieval, date handling logic, and responses.

Image Image Image Image

@saikrishnaraoyadagiri saikrishnaraoyadagiri changed the title SaiKrishna - Actual Cost Breakdown Donut Chart Back End SaiKrishna Actual Cost Breakdown Donut Chart Back End Feb 20, 2026
@one-community
Copy link
Member

Thank you all, merging!

@one-community one-community merged commit 3029168 into development Feb 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants