mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 03:31:13 -05:00
Fix homepage ride queries
This commit is contained in:
@@ -38,7 +38,12 @@ export function useHomepageRecentlyClosedRides(enabled = true) {
|
||||
|
||||
const { data, error } = await supabase
|
||||
.from('rides')
|
||||
.select(`*, park:parks(*), location:locations(*)`)
|
||||
.select(`
|
||||
*,
|
||||
park:parks(*, location:locations(*)),
|
||||
manufacturer:companies!rides_manufacturer_id_fkey(*),
|
||||
designer:companies!rides_designer_id_fkey(*)
|
||||
`)
|
||||
.gte('closed_date', oneYearAgo.toISOString())
|
||||
.lte('closed_date', today.toISOString())
|
||||
.order('closed_date', { ascending: false })
|
||||
|
||||
@@ -38,7 +38,12 @@ export function useHomepageClosingSoonRides(enabled = true) {
|
||||
|
||||
const { data, error } = await supabase
|
||||
.from('rides')
|
||||
.select(`*, park:parks(*), location:locations(*)`)
|
||||
.select(`
|
||||
*,
|
||||
park:parks(*, location:locations(*)),
|
||||
manufacturer:companies!rides_manufacturer_id_fkey(*),
|
||||
designer:companies!rides_designer_id_fkey(*)
|
||||
`)
|
||||
.gte('closed_date', today.toISOString())
|
||||
.lte('closed_date', sixMonthsFromNow.toISOString())
|
||||
.order('closed_date', { ascending: true })
|
||||
|
||||
@@ -35,7 +35,12 @@ export function useHomepageRecentlyOpenedRides(enabled = true) {
|
||||
|
||||
const { data, error } = await supabase
|
||||
.from('rides')
|
||||
.select(`*, park:parks(*), location:locations(*)`)
|
||||
.select(`
|
||||
*,
|
||||
park:parks(*, location:locations(*)),
|
||||
manufacturer:companies!rides_manufacturer_id_fkey(*),
|
||||
designer:companies!rides_designer_id_fkey(*)
|
||||
`)
|
||||
.gte('opened_date', oneYearAgo.toISOString())
|
||||
.order('opened_date', { ascending: false })
|
||||
.limit(12);
|
||||
|
||||
@@ -38,7 +38,12 @@ export function useHomepageOpeningSoonRides(enabled = true) {
|
||||
|
||||
const { data, error } = await supabase
|
||||
.from('rides')
|
||||
.select(`*, park:parks(*), location:locations(*)`)
|
||||
.select(`
|
||||
*,
|
||||
park:parks(*, location:locations(*)),
|
||||
manufacturer:companies!rides_manufacturer_id_fkey(*),
|
||||
designer:companies!rides_designer_id_fkey(*)
|
||||
`)
|
||||
.gte('opened_date', today.toISOString())
|
||||
.lte('opened_date', sixMonthsFromNow.toISOString())
|
||||
.order('opened_date', { ascending: true })
|
||||
|
||||
@@ -29,7 +29,12 @@ export function useHomepageHighestRatedRides(enabled = true) {
|
||||
queryFn: async () => {
|
||||
const { data, error } = await supabase
|
||||
.from('rides')
|
||||
.select(`*, park:parks(*), location:locations(*)`)
|
||||
.select(`
|
||||
*,
|
||||
park:parks(*, location:locations(*)),
|
||||
manufacturer:companies!rides_manufacturer_id_fkey(*),
|
||||
designer:companies!rides_designer_id_fkey(*)
|
||||
`)
|
||||
.not('average_rating', 'is', null)
|
||||
.order('average_rating', { ascending: false })
|
||||
.limit(12);
|
||||
|
||||
@@ -28,7 +28,12 @@ export function useHomepageRecentRides(enabled = true) {
|
||||
queryFn: async () => {
|
||||
const { data, error } = await supabase
|
||||
.from('rides')
|
||||
.select(`*, park:parks(*), location:locations(*)`)
|
||||
.select(`
|
||||
*,
|
||||
park:parks(*, location:locations(*)),
|
||||
manufacturer:companies!rides_manufacturer_id_fkey(*),
|
||||
designer:companies!rides_designer_id_fkey(*)
|
||||
`)
|
||||
.order('created_at', { ascending: false })
|
||||
.limit(12);
|
||||
|
||||
|
||||
@@ -28,7 +28,12 @@ export function useHomepageTrendingRides(enabled = true) {
|
||||
queryFn: async () => {
|
||||
const { data, error } = await supabase
|
||||
.from('rides')
|
||||
.select(`*, park:parks(*), location:locations(*)`)
|
||||
.select(`
|
||||
*,
|
||||
park:parks(*, location:locations(*)),
|
||||
manufacturer:companies!rides_manufacturer_id_fkey(*),
|
||||
designer:companies!rides_designer_id_fkey(*)
|
||||
`)
|
||||
.order('view_count_30d', { ascending: false })
|
||||
.limit(12);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user