From c0405d391256ea6060a63901c7d1c0c4d87db273 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Mon, 29 Sep 2025 19:43:51 +0000 Subject: [PATCH] Fix moderation queue display --- src/components/upload/EntityPhotoGallery.tsx | 10 +++++++--- src/components/upload/UppyPhotoSubmissionUpload.tsx | 4 ++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/components/upload/EntityPhotoGallery.tsx b/src/components/upload/EntityPhotoGallery.tsx index 39aff500..2ce16260 100644 --- a/src/components/upload/EntityPhotoGallery.tsx +++ b/src/components/upload/EntityPhotoGallery.tsx @@ -36,16 +36,20 @@ export function EntityPhotoGallery({ const fetchPhotos = async () => { try { // Fetch approved photo submissions for this entity - // Support both new (entity_id) and legacy (park_id/ride_id) formats - const { data: submissions, error } = await supabase + // Use separate queries for each legacy field to avoid JSONB UUID parsing issues + let query = supabase .from('content_submissions') .select('id, content, created_at, user_id') .eq('status', 'approved') .eq('submission_type', 'photo') - .or(`content->entity_id.eq.${entityId},content->park_id.eq.${entityId},content->ride_id.eq.${entityId},content->company_id.eq.${entityId}`) .order('created_at', { ascending: false }) .limit(50); + // Apply entity-specific filters using proper JSONB text casting + const { data: submissions, error } = await query.or( + `content->>entity_id.eq.${entityId},content->>park_id.eq.${entityId},content->>ride_id.eq.${entityId},content->>company_id.eq.${entityId}` + ); + if (error) throw error; // Extract photos from submissions diff --git a/src/components/upload/UppyPhotoSubmissionUpload.tsx b/src/components/upload/UppyPhotoSubmissionUpload.tsx index e61dc9a9..49d7f031 100644 --- a/src/components/upload/UppyPhotoSubmissionUpload.tsx +++ b/src/components/upload/UppyPhotoSubmissionUpload.tsx @@ -195,6 +195,10 @@ export function UppyPhotoSubmissionUpload({ title: photo.title?.trim(), date: photo.date?.toISOString(), order: index, + // Include file metadata for moderation queue + filename: photo.file?.name, + size: photo.file?.size, + type: photo.file?.type, })), // NEW STRUCTURE: Generic entity references context: finalEntityType,