Backend Release to Main [3.04]#2204
Merged
Merged
Conversation
…into development
branch 'development' of https://github.com/OneCommunityGlobal/HGNRest into development
Merge branch 'development' of https://github.com/OneCommunityGlobal/HGNRest into development i especially if it merges an updated upstream into a topic branch.
…GNRest into development updating local branch
…GNRest into development updating local branch :wq
…s after merge with development
…st controller - Import LaborCost model for database queries - Import logger utility for error tracking - Wrap controller function in try-catch block for error handling - Set up foundation for complete controller implementation
…troller - Extract projects, tasks, and date_range from query parameters - Add helper functions to parse arrays and date_range objects from query strings - Validate projects and tasks are arrays with string values - Validate date_range is object or null - Validate ISO 8601 date format for start_date and end_date - Validate date range logic (start_date <= end_date) - Return appropriate error responses (400, 422) for validation failures
- Build date filter with support for null date_range, partial ranges (only start or end), and full ranges - Use MongoDB operators $gte and $lte for date filtering with inclusive boundaries - Build project filter using $in operator when projects array has values - Build task filter using $in operator when tasks array has values - Combine all filters into single query object with AND logic - Convert date strings to Date objects and set appropriate time boundaries for inclusive filtering
- Execute MongoDB query using LaborCost.find() with combined filters
- Sort results chronologically by date using .sort({ date: 1 })
- Use .lean() for better query performance
- Return individual records without aggregation (frontend handles grouping)
- Database errors handled gracefully by existing try-catch block
- Map database fields to frontend structure (project_name → project) - Convert date objects to ISO 8601 string format - Ensure cost values are numbers (not strings) - Calculate totalCost as sum of all cost values - Return response with totalCost and data array structure - Handle empty results case (totalCost = 0)
- Explicitly construct response object with totalCost and data fields - Return 200 OK status code on successful response - Handle empty results case (totalCost: 0, data: []) - Ensure response is valid JSON using res.json() method - Add clear comments documenting response structure
- Distinguish between database errors and unexpected errors - Add error context logging with request parameters (query, method, URL) - Return user-friendly error messages without exposing internal details - Handle MongoDB/database connection errors with specific error code - Maintain existing validation error handling (400, 422 status codes) - Log errors with sufficient detail for debugging using logger utility
…resolve merge conflicts
…nd-re-engagement-strategies-follow-up-email Rithika taking over for Sheetal phase3 Re Engagement Strategies No Show Follow Up Email
…ss-LineChart Amalesh - Summary Dashboard: Create a line chart showing Weekly Progress
…n-backend Sai Teja - Add backend support for dedicated pause/resume permission
…-paid-labor-cost-controller Rithika taking over for Aditya-feat: Implement Paid Labor Cost API endpoint with comprehensive filtering and validation
…s-for-events Chirag - Fix: Add API to register for events
Diya 🔥 fix(bs): Fixed Blue Square Deletion Issue
|
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.



Includes: Amalesh - Summary Dashboard: Create a line chart showing Weekly Progress 4320+#1878, Rithika taking over for Aditya-feat: refactor chart with multi-select filters, dark mode, and improved API integration 4496+#1937, Chirag: Fixed user registration for activites 5138+#2152, Diya 🔥 fix(bs): Fixed Blue Square Deletion Issue #2200, Rithika taking over for Sheetal phase3 Re Engagement Strategies No Show Follow Up Email #1333,