diff --git a/src/app/casos-activos/mapa/actions.tsx b/src/app/casos-activos/mapa/actions.tsx deleted file mode 100644 index b94ab38..0000000 --- a/src/app/casos-activos/mapa/actions.tsx +++ /dev/null @@ -1,32 +0,0 @@ -'use server'; - -import { createClient } from '../../../lib/supabase/server'; - -export type FiltroMapa = { - urgencia: string; - tipoAyuda: string; - pueblo: string; - acepta: string; -}; - -export async function getMapPoints(filter: FiltroMapa) { - const supabase = await createClient(); - const query = supabase.from('help_requests').select('*').eq('type', 'necesita'); - if (filter.tipoAyuda !== 'todas') { - query.contains('help_type', [filter.tipoAyuda]); - } - if (filter.urgencia !== 'todas') { - query.eq('urgency', filter.urgencia); - } - - query.neq('status', 'finished'); - - const { data, error } = await query.order('created_at', { ascending: false }); - - const pickupQuery = supabase.from('collection_points').select('*', { count: 'exact' }); - if (filter.acepta !== 'todos') { - query.contains('accepted_items', [filter.acepta]); - } - - return await pickupQuery.order('created_at', { ascending: false }); -} diff --git a/src/app/casos-activos/solicitudes/page.tsx b/src/app/casos-activos/solicitudes/page.tsx index f0c877e..5198aaa 100644 --- a/src/app/casos-activos/solicitudes/page.tsx +++ b/src/app/casos-activos/solicitudes/page.tsx @@ -24,7 +24,7 @@ function parseData(data: Database['public']['Tables']['help_requests']['Row'][]) const getData = async (supabase: SupabaseClient, filters: FiltersData) => { const query = supabase .from('help_requests_with_assignment_count') - .select(helpDataSelectFields as '*', { count: 'exact' }) + .select('*', { count: 'exact' }) .eq('type', 'necesita') .neq('status', 'finished'); @@ -34,6 +34,7 @@ const getData = async (supabase: SupabaseClient, filters: FiltersData) } const { data, error } = await query.order('created_at', { ascending: false }); + console.log('🚀 ~ getData ~ data:', data) if (error) { throw new Error('Error fetching solicita:', error);