Refactor: Implement system activity log fixes

This commit is contained in:
gpt-engineer-app[bot]
2025-10-11 16:04:28 +00:00
parent f37b99a5f9
commit 120f68c926
3 changed files with 89 additions and 3 deletions

View File

@@ -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,