mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-26 00:31:12 -05:00
Add data quality metrics, growth trends visualization, entity comparison views, and automated health checks to the AdminDatabaseStats dashboard, including new TS types, hooks, UI components, and integrated tabbed layout.
22 lines
674 B
TypeScript
22 lines
674 B
TypeScript
import { useQuery } from '@tanstack/react-query';
|
|
import { supabase } from '@/integrations/supabase/client';
|
|
import { queryKeys } from '@/lib/queryKeys';
|
|
import type { EntityComparisons } from '@/types/database-analytics';
|
|
|
|
export function useEntityComparisons() {
|
|
return useQuery({
|
|
queryKey: queryKeys.analytics.entityComparisons(),
|
|
queryFn: async () => {
|
|
const { data, error } = await supabase.rpc('get_entity_comparisons');
|
|
|
|
if (error) {
|
|
throw error;
|
|
}
|
|
|
|
return data as unknown as EntityComparisons;
|
|
},
|
|
staleTime: 15 * 60 * 1000, // 15 minutes
|
|
refetchInterval: 10 * 60 * 1000, // Auto-refetch every 10 minutes
|
|
});
|
|
}
|