36 lines
991 B
TypeScript
36 lines
991 B
TypeScript
|
|
import { createClient } from '@supabase/supabase-js'
|
|
import dotenv from 'dotenv'
|
|
dotenv.config({ path: '.env.local' })
|
|
|
|
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL!
|
|
const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!
|
|
|
|
const supabase = createClient(supabaseUrl, supabaseAnonKey)
|
|
|
|
async function debugQuery() {
|
|
console.log('Testing query...')
|
|
const { data, error } = await supabase
|
|
.from('detail_posyandu')
|
|
.select(`
|
|
*,
|
|
petugas:petugas_posyandu_lokal(*),
|
|
reviews:posyandu_reviews(
|
|
rating,
|
|
comment,
|
|
created_at,
|
|
user:akun_balita(nama_orang_tua)
|
|
)
|
|
`)
|
|
.limit(1)
|
|
|
|
if (error) {
|
|
console.error('Full Error Object:', error)
|
|
console.error('Error JSON:', JSON.stringify(error, null, 2))
|
|
} else {
|
|
console.log('Data fetched successfully:', JSON.stringify(data, null, 2))
|
|
}
|
|
}
|
|
|
|
debugQuery()
|