fix: disambiguate profiles FK in Supabase queries (creator vs likes)
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 27s

This commit is contained in:
ordinarthur 2026-04-12 13:40:04 +02:00
parent f80131804e
commit 234c6dff54
5 changed files with 6 additions and 6 deletions

View File

@ -33,7 +33,7 @@ export function Explore() {
const [podcastsRes, tagsRes] = await Promise.all([
supabase
.from('podcasts')
.select('*, creator:profiles(*), tags:podcast_tags(tag:tags(*))')
.select('*, creator:profiles!podcasts_creator_id_fkey(*), tags:podcast_tags(tag:tags(*))')
.order(sortBy === 'trending' ? 'plays_count' : sortBy === 'duration' ? 'duration_seconds' : 'created_at', { ascending: false })
.limit(50),
supabase.from('tags').select('*').order('name'),

View File

@ -15,7 +15,7 @@ export function Favorites() {
async function load() {
const { data } = await supabase
.from('likes')
.select('podcast:podcasts(*, creator:profiles(*), tags:podcast_tags(tag:tags(*)))')
.select('podcast:podcasts(*, creator:profiles!podcasts_creator_id_fkey(*), tags:podcast_tags(tag:tags(*)))')
.eq('user_id', user!.id)
.order('created_at', { ascending: false })

View File

@ -17,12 +17,12 @@ export function Home() {
const [trendingRes, recentRes] = await Promise.all([
supabase
.from('podcasts')
.select('*, creator:profiles(*), tags:podcast_tags(tag:tags(*))')
.select('*, creator:profiles!podcasts_creator_id_fkey(*), tags:podcast_tags(tag:tags(*))')
.order('plays_count', { ascending: false })
.limit(8),
supabase
.from('podcasts')
.select('*, creator:profiles(*), tags:podcast_tags(tag:tags(*))')
.select('*, creator:profiles!podcasts_creator_id_fkey(*), tags:podcast_tags(tag:tags(*))')
.order('created_at', { ascending: false })
.limit(8),
])

View File

@ -28,7 +28,7 @@ export function PodcastDetail() {
async function load() {
const { data: p } = await supabase
.from('podcasts')
.select('*, creator:profiles(*), tags:podcast_tags(tag:tags(*))')
.select('*, creator:profiles!podcasts_creator_id_fkey(*), tags:podcast_tags(tag:tags(*))')
.eq('id', id)
.single()

View File

@ -35,7 +35,7 @@ export function Profile() {
const [podcastsRes, followersRes, followingRes] = await Promise.all([
supabase
.from('podcasts')
.select('*, creator:profiles(*), tags:podcast_tags(tag:tags(*))')
.select('*, creator:profiles!podcasts_creator_id_fkey(*), tags:podcast_tags(tag:tags(*))')
.eq('creator_id', profileData.id)
.order('created_at', { ascending: false }),
supabase.from('follows').select('*', { count: 'exact', head: true }).eq('following_id', profileData.id),