mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 20:11:12 -05:00
Fix moderation queue display
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user