mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-21 17:31:12 -05:00
Fix photo submission entity information
This commit is contained in:
@@ -503,21 +503,21 @@ export const ModerationQueue = forwardRef<ModerationQueueRef>((props, ref) => {
|
||||
// Handle photo submissions - create photos records when approved
|
||||
if (action === 'approved' && item.type === 'content_submission' && item.submission_type === 'photo') {
|
||||
console.log('🖼️ [PHOTO APPROVAL] Starting photo submission approval');
|
||||
console.log('🖼️ [PHOTO APPROVAL] Full item content:', JSON.stringify(item.content, null, 2));
|
||||
console.log('🖼️ [PHOTO APPROVAL] Raw item:', item);
|
||||
console.log('🖼️ [PHOTO APPROVAL] Item content type:', typeof item.content);
|
||||
console.log('🖼️ [PHOTO APPROVAL] Item content keys:', Object.keys(item.content || {}));
|
||||
|
||||
try {
|
||||
// Extract photos array - handle both nested paths
|
||||
const photosArray = item.content?.photos || item.content?.content?.photos;
|
||||
const entityId = item.content?.entity_id || item.content?.park_id || item.content?.ride_id || item.content?.company_id;
|
||||
const entityType = item.content?.context || item.content?.entity_type ||
|
||||
(item.content?.park_id ? 'park' :
|
||||
item.content?.ride_id ? 'ride' :
|
||||
item.content?.company_id ? 'company' : null);
|
||||
// Photo submissions have a simple structure: content contains { context, entity_id, photos }
|
||||
const content = item.content;
|
||||
const photosArray = content.photos;
|
||||
const entityId = content.entity_id;
|
||||
const entityType = content.context;
|
||||
|
||||
console.log('🖼️ [PHOTO APPROVAL] Extracted data:', {
|
||||
photosArray: photosArray,
|
||||
entityId: entityId,
|
||||
entityType: entityType,
|
||||
photosArray,
|
||||
entityId,
|
||||
entityType,
|
||||
hasPhotosArray: !!photosArray,
|
||||
photosCount: photosArray?.length
|
||||
});
|
||||
@@ -528,7 +528,12 @@ export const ModerationQueue = forwardRef<ModerationQueueRef>((props, ref) => {
|
||||
}
|
||||
|
||||
if (!entityId || !entityType) {
|
||||
console.error('🖼️ [PHOTO APPROVAL] ERROR: Invalid entity information', { entityId, entityType });
|
||||
console.error('🖼️ [PHOTO APPROVAL] ERROR: Invalid entity information', {
|
||||
entityId,
|
||||
entityType,
|
||||
contentKeys: Object.keys(content),
|
||||
fullContent: content
|
||||
});
|
||||
throw new Error('Invalid entity information in photo submission');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user