mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-21 04:31:16 -05:00
Refactor: Implement system activity log fixes
This commit is contained in:
@@ -104,9 +104,11 @@ export async function fetchSystemActivities(
|
||||
const activities: SystemActivity[] = [];
|
||||
|
||||
// Fetch entity versions (entity changes)
|
||||
// Use simplified query without foreign key join - we'll fetch profiles separately
|
||||
const { data: versions, error: versionsError } = await supabase
|
||||
.from('entity_versions')
|
||||
.select('id, entity_type, entity_id, version_number, version_data, changed_by, changed_at, change_type, change_reason')
|
||||
.eq('is_current', true)
|
||||
.order('changed_at', { ascending: false })
|
||||
.limit(limit * 2); // Fetch more to account for filtering
|
||||
|
||||
@@ -117,7 +119,7 @@ export async function fetchSystemActivities(
|
||||
id: version.id,
|
||||
type: 'entity_change',
|
||||
timestamp: version.changed_at,
|
||||
actor_id: version.changed_by,
|
||||
actor_id: version.changed_by || null,
|
||||
action: `${version.change_type} ${version.entity_type}`,
|
||||
details: {
|
||||
entity_type: version.entity_type,
|
||||
|
||||
Reference in New Issue
Block a user