Skip to content

Implement Time-Based Active Windows & Do-NotDisturb Mode #34

Description

@krishnasahoo11156

Rules currently fire 24/7. Users need control over WHEN rules are active (work hours only) and a global. Do-Not-Disturb mode that suppresses all notifications during sleep hours.

Acceptance Criteria
• Update Rule model: add activeWindow JSONB field (timezone, scheduleType, workHours, customCron, specificDates)
• Update UserSettings model: add doNotDisturb JSONB field (enabled, startTime, endTime, timezone, daysOfWeek)
• Create backend/src/services/rules/time-validator.service.ts
• Implement isRuleActive(rule, currentTime?) — supports always, work_hours, custom_cron,
specific_dates
• Implement isDNDActive(userId) — checks user settings
• Integrate into RulesEngineService.evaluate() — skip inactive rules
• Integrate into ALL output adapters — check DND before sending
• Add POST/GET /api/users/me/dnd endpoints
• Add DND toggle to frontend Settings page

Technical Notes
• Use date-fns-tz for timezone handling
• DST transitions must be handled correctly
• Holiday exclusions configurable (country code + custom dates)
• Time check must add <5ms to rule evaluation

Metadata

Metadata

Assignees

No one assigned

    Fields

    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions