Repository navigation
Shreevaths taking over for Vamsidhar - Create a Line Graph Chart for Cost Breakdown by Type of Expenditure #1357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ReinaT5678
wants to merge
31
commits into
development
Choose a base branch
from
reina-create-line-graph-chart-for-cost-breakdown-by-expenditure-backend
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
4815939
reina-create-line-graph-chart-for-cost-breakdown-by-expenditure
ReinaT5678 2dc6815
Merge branch 'development' into reina-create-line-graph-chart-for-cos…
ReinaT5678 5acce7b
Merge branch 'development' into reina-create-line-graph-chart-for-cos…
ReinaT5678 741bdad
Merge branch 'development' into reina-create-line-graph-chart-for-cos…
ReinaT5678 19e85c7
fix(routes): register bmExpenditureRouter
ReinaT5678 0ad7786
feat: Add cost breakdown API endpoints and models for expenditure tra…
vamsidharpanithi 70bc4d4
fix: resolve merge conflicts with development branch
vamsidharpanithi 2c5cbfc
fix: add .jsx extension to AttendanceMockData import to resolve modul…
vamsidharpanithi 340606b
fix: add Jest module resolution config to fix CI environment import i…
vamsidharpanithi 8d48a88
fix: enhance Jest module resolution with path mapping for CI environm…
vamsidharpanithi 86d53f1
fix: resolve all linting errors for successful commit
vamsidharpanithi 51c5e58
fix: expenditure chart
vamsidharpanithi 7155abf
fix: merge
vamsidharpanithi 2047317
feat: expenditure chart with resolved conflicts
vamsidharpanithi b76f031
fix: resolve eslint config, fix failing test, and complete expenditur…
vamsidharpanithi 4b650b5
fix: regenerate package-lock.json to resolve npm ci issues
vamsidharpanithi ac8718f
fix: update Node.js version to 18.x in all workflows to resolve @azur…
vamsidharpanithi 5c51d5e
fix: rename AttendanceMockData.jsx to .js to resolve build error
vamsidharpanithi ee77e07
fix: resolve merge conflicts with development branch
e274821
fix: resolve merge conflict in bmExpenditureRouter
79cf00f
fix: resolve SonarCloud issues in expenditure controller and model
e53b537
fix: resolve all merge conflicts with development branch
ce0b2b4
fix: resolve all merge conflicts with development branch
818750c
fix(merge): Merge branch 'development' into reina-create-line-graph-c…
shreevathsrao a032641
fix: Fix the test cases
shreevathsrao b96e48f
fix: Merge branch 'development' of into reina-create-line-graph-chart…
shreevathsrao 395fb1d
fix: Merge branch 'development' of into reina-create-line-graph-chart…
shreevathsrao b8a7522
fix: add test cases
shreevathsrao e766f7a
fix: The aggregation logic
shreevathsrao 2c4be5b
fix: Merge branch 'development' of into reina-create-line-graph-chart…
shreevathsrao d52811e
fix: Merge branch 'development' of into reina-create-line-graph-chart…
shreevathsrao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| const mongoose = require('mongoose'); | ||
| const Expenditures = require('../../models/bmdashboard/buildingExpenditure'); | ||
|
|
||
| const bmExpenditureController = { | ||
|
|
||
| // retrieve all expenditure datasr | ||
| getAllExpenditure: async (req, res) => { | ||
| try { | ||
| const expenditures = await Expenditures.find() | ||
| .select('projectId date category cost') | ||
| .lean() | ||
| .exec(); | ||
|
|
||
| // transform data | ||
| const transformedExpenditures = expenditures.map(expenditure => ({ | ||
| projectId: expenditure.projectId, | ||
| date: expenditure.date, | ||
| category: expenditure.category, | ||
| cost: expenditure.cost, | ||
| })); | ||
|
|
||
| res.status(200).json({ | ||
| success: true, | ||
| data: transformedExpenditures | ||
| }); | ||
| } catch (err) { | ||
| console.error("Error in getAllExpenditure:", err); | ||
| res.status(500).json({ | ||
| success: false, | ||
| error: 'Server error ' + err.message | ||
| }); | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| module.exports = bmExpenditureController; |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| const mongoose = require('mongoose'); | ||
|
|
||
| const ExpenditureSchema = new mongoose.Schema({ | ||
| projectId: { | ||
| type: String, | ||
| required: true, | ||
| unique: true | ||
| }, | ||
| date: { | ||
| type: Date, | ||
| required: true, | ||
| }, | ||
| category: { | ||
| type: String, | ||
| required: true, | ||
| }, | ||
| cost: { | ||
| type: Number, | ||
| required: true | ||
| } | ||
| }) | ||
|
|
||
| module.exports = mongoose.model('ExpenditureCost', ExpenditureSchema, 'expenditure'); |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| const express = require("express"); | ||
| const controller = require('../../controllers/bmdashboard/bmExpenditureController'); | ||
|
|
||
| const routes = function() { | ||
|
|
||
| const newExpenditureRouter = express.Router(); | ||
| newExpenditureRouter.route('/expenditure').get(controller.getAllExpenditure); | ||
| return newExpenditureRouter; | ||
| }; | ||
|
|
||
| module.exports = routes; |
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
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.
Uh oh!
There was an error while loading. Please reload this page.