# Phase 2: Notification Tracker Rename (API) **Status:** ⬜ Not Started **Parent plan:** [PLAN.md](./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/trackers` to `/api/notification-trackers`. Update function names (e.g., `list_trackers` → `list_notification_trackers`). Update all model references to use `NotificationTracker`. - [ ] Task 2: Rename `api/tracker_targets.py` → `api/notification_tracker_targets.py`. Update route paths from `/api/tracker-targets` to `/api/notification-tracker-targets`. Update model references to `NotificationTrackerTarget`, field references to `notification_tracker_id`. - [ ] Task 3: Update `api/targets.py` — add `chat_action` to create/update request schemas and response serialization for telegram-type targets. - [ ] Task 4: Update `services/watcher.py` — replace all `Tracker` references with `NotificationTracker`, `TrackerTarget` with `NotificationTrackerTarget`, `TrackerState` with `NotificationTrackerState`, `tracker_id` with `notification_tracker_id` where 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 to `notification_trackers.py` - `packages/server/src/notify_bridge_server/api/tracker_targets.py` → rename to `notification_tracker_targets.py` - `packages/server/src/notify_bridge_server/api/targets.py` — add chat_action - `packages/server/src/notify_bridge_server/services/watcher.py` — model name updates - `packages/server/src/notify_bridge_server/services/scheduler.py` — model name updates - `packages/server/src/notify_bridge_server/services/notifier.py` — model name updates - `packages/server/src/notify_bridge_server/main.py` — router registration - `packages/server/src/notify_bridge_server/api/status.py` — model name updates - `packages/server/src/notify_bridge_server/commands/handler.py` — model references - `packages/server/src/notify_bridge_server/commands/webhook.py` — model references - `packages/server/src/notify_bridge_server/services/telegram_poller.py` — model references ## Acceptance Criteria - All API routes work under new `/api/notification-trackers` and `/api/notification-tracker-targets` paths - Old `/api/trackers` routes no longer exist - Telegram targets accept and return `chat_action` field - 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) ## Handoff to Next Phase