Files
thrilltrack-explorer/migration/PHASE_09_TIMELINE_HISTORY.md

2.2 KiB

PHASE 9: Timeline & History

Status: Not Started
Estimated Time: 6-8 hours
Priority: MEDIUM
Depends On: Phase 1 (Foundation)
Blocks: Phase 12 (Pages Migration)


🎯 Goal

Migrate timeline events and entity history/versioning from Supabase to Django's pghistory system.


📋 Tasks

Task 9.1: Timeline Service (2 hours)

class TimelineService extends BaseService {
  // GET /timeline/entity/{type}/{id}/
  async getEntityTimeline(entityType: string, entityId: string): Promise<TimelineEvent[]>
  
  // POST /timeline/entity/{type}/{id}/
  async createTimelineEvent(entityType: string, entityId: string, data: TimelineEventData): Promise<TimelineEvent>
}
  • Create src/services/timeline/timelineService.ts
  • Update src/components/timeline/EntityTimelineManager.tsx

Task 9.2: History Service (2 hours)

class HistoryService extends BaseService {
  // GET /history/{entity_type}/{entity_id}/
  async getEntityHistory(entityType: string, entityId: string): Promise<HistoryEntry[]>
  
  // GET /history/{entity_type}/{entity_id}/diff/?version1={v1}&version2={v2}
  async getVersionDiff(entityType: string, entityId: string, v1: string, v2: string): Promise<VersionDiff>
  
  // GET /history/recent/
  async getRecentChanges(limit?: number): Promise<HistoryEntry[]>
}
  • Create src/services/history/historyService.ts
  • Replace supabase.rpc('get_version_diff')
  • Replace supabase.rpc('get_recent_changes')

Task 9.3: Update Components (2-3 hours)

  • Update version comparison components
  • Update history display components
  • Update recent changes widget
  • Remove all Supabase RPC calls

Task 9.4: Homepage Integration (1 hour)

  • Update src/hooks/homepage/useHomepageRecentChanges.ts
  • Replace supabase.rpc('get_recent_changes')
  • Test recent changes display

🎯 Success Criteria

  • Timeline events display correctly
  • Entity history works
  • Version diffs work
  • Recent changes widget works
  • Zero supabase.rpc() calls for history
  • Homepage shows recent changes

⏭️ Next Phase

Phase 10: Users & Profiles