mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 01:31:12 -05:00
feat: Implement dynamic join solution
This commit is contained in:
@@ -55,42 +55,10 @@ export function buildSubmissionQuery(
|
||||
) {
|
||||
const { entityFilter, statusFilter, tab, userId, isAdmin, isSuperuser } = config;
|
||||
|
||||
// Build base query with all needed data + user profiles (eliminate N+1 query)
|
||||
// Use optimized view with pre-joined profiles and entity data
|
||||
let query = supabase
|
||||
.from('content_submissions')
|
||||
.select(`
|
||||
id,
|
||||
submission_type,
|
||||
status,
|
||||
content,
|
||||
created_at,
|
||||
submitted_at,
|
||||
user_id,
|
||||
reviewed_at,
|
||||
reviewer_id,
|
||||
reviewer_notes,
|
||||
escalated,
|
||||
assigned_to,
|
||||
locked_until,
|
||||
submitter:profiles!content_submissions_user_id_fkey (
|
||||
user_id,
|
||||
username,
|
||||
display_name,
|
||||
avatar_url
|
||||
),
|
||||
reviewer:profiles!content_submissions_reviewer_id_fkey (
|
||||
user_id,
|
||||
username,
|
||||
display_name,
|
||||
avatar_url
|
||||
),
|
||||
submission_items (
|
||||
id,
|
||||
item_type,
|
||||
item_data,
|
||||
status
|
||||
)
|
||||
`);
|
||||
.from('moderation_queue_with_entities')
|
||||
.select('*');
|
||||
|
||||
// CRITICAL: Multi-level ordering
|
||||
// Level 1: Always sort by escalated first (descending) - escalated items always appear at top
|
||||
|
||||
Reference in New Issue
Block a user