Skip to content

Backend Release to Main [2.87]#2050

Merged
one-community merged 54 commits intomainfrom
development
Feb 17, 2026
Merged

Backend Release to Main [2.87]#2050
one-community merged 54 commits intomainfrom
development

Conversation

@one-community
Copy link
Member

"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, "

Saicharan1505 and others added 30 commits September 18, 2025 20:07
…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.
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.
Aditya-gam and others added 24 commits January 22, 2026 19:00
…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
…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
@one-community one-community merged commit b2f3993 into main Feb 17, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants