mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 20:11:12 -05:00
Optimize select queries
This commit is contained in:
@@ -59,7 +59,7 @@ export const useModerationQueue = (config?: UseModerationQueueConfig) => {
|
||||
try {
|
||||
const { data: slaData } = await supabase
|
||||
.from('moderation_sla_metrics')
|
||||
.select('*');
|
||||
.select('pending_count, avg_wait_hours');
|
||||
|
||||
const { count: assignedCount } = await supabase
|
||||
.from('content_submissions')
|
||||
@@ -302,7 +302,7 @@ export const useModerationQueue = (config?: UseModerationQueueConfig) => {
|
||||
// Get submission details FIRST for better toast message
|
||||
const { data: submission } = await supabase
|
||||
.from('content_submissions')
|
||||
.select('submission_type')
|
||||
.select('id, submission_type')
|
||||
.eq('id', submissionId)
|
||||
.single();
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ export function useProfile(userId: string | undefined) {
|
||||
if (profileData.location_id) {
|
||||
const { data: location } = await supabase
|
||||
.from('locations')
|
||||
.select('*')
|
||||
.select('id, name, city, state_province, country, timezone')
|
||||
.eq('id', profileData.location_id)
|
||||
.single();
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ export function useSearch(options: UseSearchOptions = {}) {
|
||||
if (types.includes('company')) {
|
||||
const { data: companies } = await supabase
|
||||
.from('companies')
|
||||
.select('*')
|
||||
.select('id, name, slug, description, company_type, logo_url, average_rating, review_count')
|
||||
.or(`name.ilike.%${searchQuery}%,description.ilike.%${searchQuery}%`)
|
||||
.limit(Math.ceil(limit / types.length));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user