1d445f3980
Rework entity schema: rename Tracker→NotificationTracker, add CommandConfig/ CommandTracker/CommandTrackerListener entities for decoupled command handling. Commands now resolve through CommandTracker→CommandConfig instead of TelegramBot.commands_config. Smart ref-counted bot polling based on active listeners. Add chat_action to telegram targets. Full frontend CRUD pages for command configs and command trackers. Idempotent SQLite migrations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
4.1 KiB
4.1 KiB
Phase 2: Notification Tracker Rename (API)
Status: ⬜ Not Started Parent plan: PLAN.md Domain: backend
Objective
Rename all tracker-related API routes, service functions, and internal references to use "notification_tracker" naming. Add chat_action support to the targets API. Ensure the watcher, scheduler, and notifier services work with the renamed models.
Tasks
- Task 1: Rename
api/trackers.py→api/notification_trackers.py. Update all route paths from/api/trackersto/api/notification-trackers. Update function names (e.g.,list_trackers→list_notification_trackers). Update all model references to useNotificationTracker. - Task 2: Rename
api/tracker_targets.py→api/notification_tracker_targets.py. Update route paths from/api/tracker-targetsto/api/notification-tracker-targets. Update model references toNotificationTrackerTarget, field references tonotification_tracker_id. - Task 3: Update
api/targets.py— addchat_actionto create/update request schemas and response serialization for telegram-type targets. - Task 4: Update
services/watcher.py— replace allTrackerreferences withNotificationTracker,TrackerTargetwithNotificationTrackerTarget,TrackerStatewithNotificationTrackerState,tracker_idwithnotification_tracker_idwhere applicable. - Task 5: Update
services/scheduler.py— rename tracker job references, function parameters, and log messages to use notification_tracker naming. - Task 6: Update
services/notifier.py— update model references and any tracker-related parameter names. - Task 7: Update
main.py— change router imports and registration to use new module names and route prefixes. - Task 8: Update
api/status.py— rename any tracker count queries to use new model names. - Task 9: Update
commands/handler.py— update any tracker model references used for command context resolution. - Task 10: Update
commands/webhook.py— update any tracker model references. - Task 11: Update
services/telegram_poller.py— update any tracker model references. - Task 12: Remove backward-compatibility aliases from models.py (if added in Phase 1) — all consumers now use new names.
Files to Modify/Create
packages/server/src/notify_bridge_server/api/trackers.py→ rename tonotification_trackers.pypackages/server/src/notify_bridge_server/api/tracker_targets.py→ rename tonotification_tracker_targets.pypackages/server/src/notify_bridge_server/api/targets.py— add chat_actionpackages/server/src/notify_bridge_server/services/watcher.py— model name updatespackages/server/src/notify_bridge_server/services/scheduler.py— model name updatespackages/server/src/notify_bridge_server/services/notifier.py— model name updatespackages/server/src/notify_bridge_server/main.py— router registrationpackages/server/src/notify_bridge_server/api/status.py— model name updatespackages/server/src/notify_bridge_server/commands/handler.py— model referencespackages/server/src/notify_bridge_server/commands/webhook.py— model referencespackages/server/src/notify_bridge_server/services/telegram_poller.py— model references
Acceptance Criteria
- All API routes work under new
/api/notification-trackersand/api/notification-tracker-targetspaths - Old
/api/trackersroutes no longer exist - Telegram targets accept and return
chat_actionfield - Server starts and health check passes
- Watcher/scheduler/notifier services function correctly with renamed models
Notes
- This is a breaking API change — frontend will need updating in Phase 5.
- The watcher service is the most complex consumer of tracker models — test carefully.
- The EventLog model references notification_tracker_id (renamed in Phase 1).
Review Checklist
- All tasks completed
- Code follows project conventions
- No unintended side effects
- Build passes
- Tests pass (new + existing)