mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 14:51:12 -05:00
feat: Execute complete production readiness plan
This commit is contained in:
@@ -6,6 +6,8 @@ import type {
|
||||
RideModelSubmissionData
|
||||
} from '@/types/submission-data';
|
||||
import { supabase } from '@/integrations/supabase/client';
|
||||
import { logger } from './logger';
|
||||
import { getErrorMessage } from './errorHandler';
|
||||
|
||||
type SubmissionDataTypes =
|
||||
| ParkSubmissionData
|
||||
@@ -79,7 +81,12 @@ async function detectPhotoChanges(submissionId: string): Promise<PhotoChange[]>
|
||||
.eq('submission_id', submissionId);
|
||||
|
||||
if (photoError) {
|
||||
console.error('Error fetching photo submissions:', photoError);
|
||||
const errorMessage = getErrorMessage(photoError);
|
||||
logger.error('Photo submission fetch failed', {
|
||||
action: 'detect_photo_changes',
|
||||
submissionId,
|
||||
error: errorMessage
|
||||
});
|
||||
} else {
|
||||
const photoSubmission = photoSubmissions?.[0];
|
||||
if (photoSubmission?.items && photoSubmission.items.length > 0) {
|
||||
@@ -102,7 +109,12 @@ async function detectPhotoChanges(submissionId: string): Promise<PhotoChange[]>
|
||||
.in('item_type', ['photo_edit', 'photo_delete']);
|
||||
|
||||
if (itemsError) {
|
||||
console.error('Error fetching submission items for photos:', itemsError);
|
||||
const errorMessage = getErrorMessage(itemsError);
|
||||
logger.error('Submission items fetch failed', {
|
||||
action: 'detect_photo_changes',
|
||||
submissionId,
|
||||
error: errorMessage
|
||||
});
|
||||
} else if (submissionItems && submissionItems.length > 0) {
|
||||
for (const item of submissionItems) {
|
||||
const itemData = item.item_data as Record<string, any>;
|
||||
@@ -134,8 +146,13 @@ async function detectPhotoChanges(submissionId: string): Promise<PhotoChange[]>
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Error detecting photo changes:', err);
|
||||
} catch (err: unknown) {
|
||||
const errorMessage = getErrorMessage(err);
|
||||
logger.error('Photo change detection failed', {
|
||||
action: 'detect_photo_changes',
|
||||
submissionId,
|
||||
error: errorMessage
|
||||
});
|
||||
}
|
||||
|
||||
return changes;
|
||||
|
||||
Reference in New Issue
Block a user