Phase 3 Step 2: Implement ScheduleService with cron support

Implement comprehensive schedule management service for automated scans:

New Files:
- web/services/schedule_service.py (470 lines)
  * Complete CRUD operations for schedules
  * Cron expression validation using croniter
  * Next run time calculation
  * Execution history tracking
  * Human-readable relative time formatting

- tests/test_schedule_service.py (671 lines, 40+ tests)
  * Create/get/list/update/delete schedule tests
  * Cron validation and next run calculation tests
  * Pagination and filtering tests
  * Schedule history and serialization tests

Changes:
- requirements-web.txt: Add croniter==2.0.1 dependency
- docs/ai/PHASE3.md: Mark Step 1 complete, Step 2 next

Key Features:
- Validates cron expressions before saving
- Automatically calculates next execution time
- Preserves historical scans when schedules deleted
- Supports pagination and filtering by enabled status
- Provides relative time display (e.g., "in 2 hours")
This commit is contained in:
2025-11-14 13:41:49 -06:00
parent cbc3ff0f51
commit 7969068c36
4 changed files with 1144 additions and 2 deletions

View File

@@ -7,8 +7,8 @@
## Progress Summary
- 📋 **Step 1: Fix Styling Issues & CSS Refactor** (Day 1) - NEXT
- 📋 **Step 2: ScheduleService Implementation** (Days 2-3)
- **Step 1: Fix Styling Issues & CSS Refactor** (Day 1) - COMPLETE
- 📋 **Step 2: ScheduleService Implementation** (Days 2-3) - NEXT
- 📋 **Step 3: Schedules API Endpoints** (Days 4-5)
- 📋 **Step 4: Schedule Management UI** (Days 6-7)
- 📋 **Step 5: Enhanced Dashboard with Charts** (Days 8-9)