From dc77f6a680949b09b089e2cc6ff2b723a996959e Mon Sep 17 00:00:00 2001 From: pac7 <47831526-pac7@users.noreply.replit.com> Date: Mon, 27 Oct 2025 23:17:47 +0000 Subject: [PATCH] Show all system activity history in admin logs Modify fetchSystemActivities to retrieve all versions from park, ride, company, and ride_model tables instead of only current versions, and adjust limit logic for better historical data display. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 14a3da17-c084-4611-919e-f0651a496ef3 Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7cdf4e95-3f41-4180-b8e3-8ef56d032c0e/14a3da17-c084-4611-919e-f0651a496ef3/cWpfk79 --- .replit | 4 ++++ src/lib/systemActivityService.ts | 13 +++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.replit b/.replit index 5586ae74..cb2755cf 100644 --- a/.replit +++ b/.replit @@ -45,3 +45,7 @@ externalPort = 3001 [[ports]] localPort = 37623 externalPort = 3002 + +[[ports]] +localPort = 44381 +externalPort = 3003 diff --git a/src/lib/systemActivityService.ts b/src/lib/systemActivityService.ts index 4ac8db00..50707a11 100644 --- a/src/lib/systemActivityService.ts +++ b/src/lib/systemActivityService.ts @@ -207,31 +207,28 @@ export async function fetchSystemActivities( // Fetch entity versions from relational version tables // Query all four version tables in parallel for better performance + // Fetch ALL versions (not just current) to show complete history const versionQueries = [ supabase .from('park_versions') .select('version_id, park_id, version_number, name, created_by, created_at, change_type, change_reason, is_current') - .eq('is_current', true) .order('created_at', { ascending: false }) - .limit(Math.ceil(limit / 2)), + .limit(limit), supabase .from('ride_versions') .select('version_id, ride_id, version_number, name, created_by, created_at, change_type, change_reason, is_current') - .eq('is_current', true) .order('created_at', { ascending: false }) - .limit(Math.ceil(limit / 2)), + .limit(limit), supabase .from('company_versions') .select('version_id, company_id, version_number, name, created_by, created_at, change_type, change_reason, is_current') - .eq('is_current', true) .order('created_at', { ascending: false }) - .limit(Math.ceil(limit / 4)), + .limit(Math.ceil(limit / 2)), supabase .from('ride_model_versions') .select('version_id, ride_model_id, version_number, name, created_by, created_at, change_type, change_reason, is_current') - .eq('is_current', true) .order('created_at', { ascending: false }) - .limit(Math.ceil(limit / 4)), + .limit(Math.ceil(limit / 2)), ]; const [parkVersions, rideVersions, companyVersions, modelVersions] = await Promise.all(versionQueries);