Merged
Conversation
…l cost trends, and historical metric queries
…hments before sending email refactor(emailController): enhance email handling and subscription logic; improve error handling and HTML formatting feat(emailController): enhance email sending logic to support multiple recipients with BCC; improve response messages feat(routes): add email template router to API for enhanced email management feat(emailTemplateController): enhance getAllEmailTemplates with pagination, sorting, and field selection; add updated_by field to model feat(emailController, emailTemplateController): implement email batch processing for sending and managing emails feat(emailBatch): add retry functionality for failed batch items and update routes
…nce email batch auditing features - Added email announcement job processor to server initialization. - Introduced new audit trail endpoints in emailBatchController for tracking email and batch actions. - Updated email batch item status logic to reflect QUEUED state instead of PENDING. - Removed deprecated emailBatchDashboardController and related routes. - Enhanced email batch model to support comprehensive auditing and recipient management.
- Added EmailBatch and Email models for managing email batches and their recipients. - Introduced EmailBatchService and EmailService for handling batch creation, status updates, and email sending. - Implemented EmailProcessor for processing email batches with retry logic and status tracking. - Enhanced email announcement job processor to handle batch processing at scheduled intervals. - Updated email validation utilities for improved recipient handling and HTML content validation. - Added new endpoints in emailBatchController for managing email records and batch operations.
- Added permission checks for viewing emails, email details, and email audits in emailBatchController. - Implemented permission validation for sending emails, resending, and managing email subscriptions in emailController. - Updated emailTemplateController to enforce permission checks for creating, updating, and deleting email templates. - Refactored routes to replace deprecated sendEmailToAll with sendEmailToSubscribers. - Enhanced test cases to ensure proper handling of permission-related responses.
…zation - Removed redundant cron job initialization and logging from EmailAnnouncementJobProcessor. - Updated EmailProcessor to include additional final email status check for PROCESSED, enhancing email state validation.
…ions - Deleted the announcementEmailJob and associated configurations from emailJobConfig. - Removed emailBatchController and its routes, streamlining email processing logic. - Updated email models and services to reflect changes in email status management. - Refactored emailController to utilize new email processing methods and improved error handling. - Enhanced email validation utilities for better recipient management and HTML content checks.
…ling - Added functionality to process pending and stuck emails on server startup after database connection. - Updated email configuration to increase maximum recipients per request and refined batch processing settings. - Refactored email processing to queue emails for non-blocking, sequential handling instead of immediate processing. - Introduced new methods for managing stuck emails and batches, ensuring robust error handling and status updates. - Enhanced email validation utilities for better normalization of email fields.
…ervice - Updated emailController and emailTemplateController to utilize EmailTemplateService for template rendering and variable validation. - Introduced TEMPLATE_VARIABLE_TYPES in emailConfig for better management of variable types. - Removed the deprecated TemplateRenderingService, streamlining the email template handling process.
… management - Removed deprecated templateId from Email model to simplify email structure. - Updated email subscription list schema to enforce lowercase and trim email entries for consistency. - Introduced new methods for retrying failed emails and processing pending emails, improving error handling and user experience. - Enhanced email validation and normalization processes across controllers to ensure consistent data handling. - Refactored routes to improve clarity and organization of email-related endpoints.
- Enhanced validation for email subscriptions, including checks for missing or invalid email fields. - Improved error handling for subscription confirmation and removal processes, ensuring appropriate status codes are returned. - Updated positive test cases to reflect changes in subscription management and email normalization. - Removed deprecated sendEmailToAll functionality, streamlining email operations.
…ice and standardize error messages
…to the transaction for atomicity.
Change collection name from 'dashboardMetrics' to 'summaryDashboardMetrics' to ensure the NEW summary dashboard system has its own independent MongoDB collection, preventing data conflicts with the OLD dashboard system.
- Add imports for BuildingProject, BuildingMaterial, and logger - Create generateInitialSnapshot() function that calculates metrics from source collections (same logic as OLD system) - Modify getAllMetrics() to auto-generate if no data exists - Modify getMaterialCostTrends() to handle empty collection gracefully - Add date validation and error handling to getHistory() - Replace console logging with proper logger integration This ensures the NEW summary dashboard system works independently and generates data on first request if the collection is empty.
…controller - Add logger import for proper error tracking - Replace console.error with logger.logException for all error cases - Add comprehensive validation for getHistory endpoint: - Validate required parameters (startDate, endDate, metric) - Validate metric name against allowed values - Validate date format (ISO 8601) - Validate date range (startDate <= endDate) - Standardize error response format with error, message, details, and trackingId - Add tracking IDs for 500 errors to enable debugging
…roller - Add logger import for proper error tracking with Sentry - Replace console.log/error with logger.logInfo/logException: - generateDashboardMetrics: log exceptions on failure - storeMetricsSnapshot: log info on success, exceptions on failure - Improve error responses with standardized format: - getMaterialCostTrends: add trackingId and descriptive message - getAllMetrics: add trackingId and descriptive message - refreshMetrics: add trackingId and descriptive message - Enhance getHistoricalMetrics validation: - Add date format validation (ISO 8601) - Add date range validation (startDate <= endDate) - Improve error response with details object - Add trackingId for 500 errors
… service Add 3 spec files (104 tests) for fix/summary-dashboard-button-backend: - summaryDashboard.controller.spec.js (27): getMetrics, getMaterialCosts, getHistory; logger integration, error handling with tracking IDs, validation (12 metrics, date format/range). - summaryDashboard.service.spec.js (34): generateInitialSnapshot, getAllMetrics, getMaterialCostTrends, getHistory; auto-generation when collection empty, date validation, edge cases. - bmDashboardPrototypeController.spec.js (43): changed-code-only coverage for generateDashboardMetrics, storeMetricsSnapshot, getMaterialCostTrends, getAllMetrics, getHistoricalMetrics, refreshMetrics; logger, standardized error responses, date/metric validation. Achieve 90%+ coverage on target files. Update .gitignore: add /scripts.
Removed duplicate require statements for mongoose, moment, and lodash.
Refactor notifyInfringements function to be async and remove console logs for cleaner output.
…d-button-backend Aditya-fix: Phase 2 Summary Dashboard backend – resolve 404 on metrics endpoints
…ormat batch recipients as objects.
…ring and object inputs.
…env variable fallback and adding a test for missing headers.
…eekly_summary_replace_issue Venkataramanan 🔥 weekly summaries report replace functionality
…ilization-ratio-chart Sudheesh material utilization ratio chart
…replacement Chaitanya - Mailchimp Replacement - Email Announcement System
Sundar 🔥 empty response from leaderboard data api
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: Venkataramanan 🔥 weekly summaries report replace functionality #2046, Sudheesh material utilization ratio chart 4401
+#1904, Aditya-fix: Phase 2 Summary Dashboard backend – resolve 404 on metrics endpoints #2028, Sundar 🔥 empty response from leaderboard data api #2049, "