03c5c66eed
- Show entity icons on all cards with fallback defaults (providers, trackers, targets, bots)
- Enrich EventLog with provider_name, tracker_name, assets_count; add DB migration
- Dashboard events: filtering (type, provider, search), sorting, pagination, dynamic page size
- Friendly chat names on telegram target cards (resolve from TelegramChat table)
- Test message button on bot chat items with locale-aware messages
- Album public link validation on tracker save with auto-create dialog
- Support albums without public links: conditional <a href> in templates
- Fetch shared links during poll, enrich events with public_url/protected_url
- Per-asset public_url in template context ({share_url}/photos/{asset_id})
- Common date/location detection: common_date + common_location context vars
- Dual date formats: date_format (datetime) + date_only_format (date only)
- Template clone button, HTML link rendering in template preview
- Fix Telegram asset download 401: pass x-api-key headers through client
- Fix provider external_url matching for API key scoping
- Fix event timestamp timezone (append Z suffix for UTC)
- Localize event filter controls, test messages (EN/RU)
- Template variable UI helpers updated with all new fields
- CLAUDE.md: template system sync rules documentation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
46 lines
2.4 KiB
Markdown
46 lines
2.4 KiB
Markdown
# Phase 2: Enrich Event Data
|
|
|
|
**Status:** ⬜ Not Started
|
|
**Parent plan:** [PLAN.md](./PLAN.md)
|
|
**Domain:** backend
|
|
|
|
## Objective
|
|
Enrich EventLog with provider name, tracker name, and asset counts so the dashboard can display richer event details. Update the status API to return these fields.
|
|
|
|
## Tasks
|
|
|
|
- [ ] Task 1: Add `provider_name`, `tracker_name`, `provider_id` columns to EventLog model (or store in details JSON to avoid migration complexity)
|
|
- [ ] Task 2: Update watcher.py event logging to populate provider_name, tracker_name, and assets_count when creating EventLog entries
|
|
- [ ] Task 3: Update status.py GET /api/status endpoint to return enriched event fields (provider_name, tracker_name, event_type, collection_name, assets_count, details)
|
|
- [ ] Task 4: Add pagination/limit support to the events endpoint (query param `limit`, default 20)
|
|
- [ ] Task 5: Add optional filtering query params: `event_type`, `provider_id`, `search` (name match)
|
|
- [ ] Task 6: Handle migration for existing EventLog rows (backfill from tracker/provider if possible, or leave empty for old rows)
|
|
|
|
## Files to Modify/Create
|
|
- `packages/server/src/notify_bridge_server/database/models.py` — EventLog model changes
|
|
- `packages/server/src/notify_bridge_server/services/watcher.py` — populate new fields on event creation
|
|
- `packages/server/src/notify_bridge_server/api/status.py` — enrich response, add filtering/pagination
|
|
- `packages/server/src/notify_bridge_server/database/migrations.py` — add columns if using real columns
|
|
|
|
## Acceptance Criteria
|
|
- EventLog entries created after this phase include provider_name, tracker_name, assets_count
|
|
- GET /api/status returns enriched event data
|
|
- Filtering by event_type, provider_id, and text search works
|
|
- Old events without new fields still render (graceful degradation)
|
|
- No breaking changes to existing API consumers
|
|
|
|
## Notes
|
|
- Storing provider_name/tracker_name as denormalized strings is intentional — the event log should be a historical record even if the tracker/provider is later deleted
|
|
- The `details` JSON field already exists and could hold extra data, but explicit columns are better for filtering
|
|
- EventLog.tracker_id already exists as FK — can join for backfill but also store name directly
|
|
|
|
## Review Checklist
|
|
- [ ] All tasks completed
|
|
- [ ] Code follows project conventions
|
|
- [ ] No unintended side effects
|
|
- [ ] Build passes
|
|
- [ ] Tests pass (new + existing)
|
|
|
|
## Handoff to Next Phase
|
|
<!-- Filled in after completion -->
|