mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 23:31:12 -05:00
Fix moderation queue display
This commit is contained in:
@@ -36,16 +36,20 @@ export function EntityPhotoGallery({
|
|||||||
const fetchPhotos = async () => {
|
const fetchPhotos = async () => {
|
||||||
try {
|
try {
|
||||||
// Fetch approved photo submissions for this entity
|
// Fetch approved photo submissions for this entity
|
||||||
// Support both new (entity_id) and legacy (park_id/ride_id) formats
|
// Use separate queries for each legacy field to avoid JSONB UUID parsing issues
|
||||||
const { data: submissions, error } = await supabase
|
let query = supabase
|
||||||
.from('content_submissions')
|
.from('content_submissions')
|
||||||
.select('id, content, created_at, user_id')
|
.select('id, content, created_at, user_id')
|
||||||
.eq('status', 'approved')
|
.eq('status', 'approved')
|
||||||
.eq('submission_type', 'photo')
|
.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 })
|
.order('created_at', { ascending: false })
|
||||||
.limit(50);
|
.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;
|
if (error) throw error;
|
||||||
|
|
||||||
// Extract photos from submissions
|
// Extract photos from submissions
|
||||||
|
|||||||
@@ -195,6 +195,10 @@ export function UppyPhotoSubmissionUpload({
|
|||||||
title: photo.title?.trim(),
|
title: photo.title?.trim(),
|
||||||
date: photo.date?.toISOString(),
|
date: photo.date?.toISOString(),
|
||||||
order: index,
|
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
|
// NEW STRUCTURE: Generic entity references
|
||||||
context: finalEntityType,
|
context: finalEntityType,
|
||||||
|
|||||||
Reference in New Issue
Block a user