mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 13:11:14 -05:00
Remove debug console logs
This commit is contained in:
@@ -451,8 +451,6 @@ async function checkSlugUniqueness(
|
||||
const tableName = getTableNameFromEntityType(entityType);
|
||||
|
||||
try {
|
||||
console.log(`Checking slug uniqueness for "${slug}" in ${tableName}, excludeId: ${excludeId}`);
|
||||
|
||||
// Query with explicit table name - use simple approach to avoid type instantiation issues
|
||||
let result;
|
||||
|
||||
@@ -470,34 +468,28 @@ async function checkSlugUniqueness(
|
||||
result = await supabase.from('ride_models').select('id').eq('slug', slug).limit(1);
|
||||
break;
|
||||
default:
|
||||
console.error(`Invalid table name: ${tableName}`);
|
||||
return true; // Assume unique on invalid table
|
||||
}
|
||||
|
||||
const { data, error } = result;
|
||||
|
||||
if (error) {
|
||||
console.error(`Slug uniqueness check failed for ${entityType}:`, error);
|
||||
return true; // Assume unique on error to avoid blocking
|
||||
}
|
||||
|
||||
// If no data, slug is unique
|
||||
if (!data || data.length === 0) {
|
||||
console.log(`Slug "${slug}" is unique in ${tableName}`);
|
||||
return true;
|
||||
}
|
||||
|
||||
// If excludeId provided and matches, it's the same entity (editing)
|
||||
if (excludeId && data[0] && data[0].id === excludeId) {
|
||||
console.log(`Slug "${slug}" matches current entity (editing mode)`);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Slug is in use by a different entity
|
||||
console.log(`Slug "${slug}" already exists in ${tableName}`);
|
||||
return false;
|
||||
} catch (error) {
|
||||
console.error(`Exception during slug uniqueness check:`, error);
|
||||
return true; // Assume unique on error to avoid false positives
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
import type { SubmissionItemWithDeps } from './submissionItemsService';
|
||||
import { logger } from './logger';
|
||||
|
||||
// State definitions using discriminated unions
|
||||
export type ModerationState =
|
||||
@@ -63,7 +64,7 @@ export function moderationReducer(
|
||||
|
||||
case 'LOCK_EXPIRED':
|
||||
if (state.status !== 'locked' && state.status !== 'reviewing' && state.status !== 'loading_data') {
|
||||
console.warn(`Lock expired notification in unexpected state: ${state.status}`);
|
||||
logger.warn(`Lock expired notification in unexpected state: ${state.status}`);
|
||||
return state;
|
||||
}
|
||||
return {
|
||||
@@ -123,7 +124,7 @@ export function moderationReducer(
|
||||
case 'ERROR':
|
||||
// Error can happen from most states
|
||||
if (state.status === 'idle' || state.status === 'complete') {
|
||||
console.warn('Error action in terminal state');
|
||||
logger.warn('Error action in terminal state');
|
||||
return state;
|
||||
}
|
||||
return {
|
||||
@@ -135,7 +136,7 @@ export function moderationReducer(
|
||||
case 'RELEASE_LOCK':
|
||||
// Can release lock from locked, reviewing, or error states
|
||||
if (state.status !== 'locked' && state.status !== 'reviewing' && state.status !== 'error' && state.status !== 'lock_expired' && state.status !== 'loading_data') {
|
||||
console.warn(`Cannot release lock from state: ${state.status}`);
|
||||
logger.warn(`Cannot release lock from state: ${state.status}`);
|
||||
return state;
|
||||
}
|
||||
return { status: 'idle' };
|
||||
|
||||
@@ -379,7 +379,7 @@ export async function detectChanges(
|
||||
|
||||
// Add debugging warning if critical data is missing
|
||||
if (!itemData.entity_name && item.item_type === 'photo_delete') {
|
||||
console.warn(`[Photo Delete] Missing entity_name for photo_delete item`, {
|
||||
logger.warn('[Photo Delete] Missing entity_name for photo_delete item', {
|
||||
item_type: item.item_type,
|
||||
has_entity_type: !!itemData.entity_type,
|
||||
has_entity_id: !!itemData.entity_id,
|
||||
|
||||
@@ -1089,10 +1089,12 @@ export async function editSubmissionItem(
|
||||
currentItem.submission_id,
|
||||
true // isEdit = true
|
||||
);
|
||||
|
||||
console.log(`✅ Created version for manual edit of ${currentItem.item_type} ${currentItem.approved_entity_id}`);
|
||||
} catch (versionError) {
|
||||
console.error('Failed to create version for manual edit:', versionError);
|
||||
logger.error('Failed to create version for manual edit', {
|
||||
action: 'create_version_for_edit',
|
||||
itemType: currentItem.item_type,
|
||||
entityId: currentItem.approved_entity_id
|
||||
});
|
||||
// Don't fail the entire operation, just log the error
|
||||
// The edit itself is still saved, just without version history
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { supabase } from '@/integrations/supabase/client';
|
||||
import { logger } from './logger';
|
||||
|
||||
// Generate anonymous session hash (no PII)
|
||||
function getSessionHash(): string {
|
||||
@@ -38,10 +39,8 @@ export async function trackPageView(
|
||||
entity_id: entityId,
|
||||
session_hash: getSessionHash()
|
||||
});
|
||||
|
||||
console.log(`✅ Tracked view: ${entityType} ${entityId}`);
|
||||
} catch (error) {
|
||||
// Fail silently - don't break the page if tracking fails
|
||||
console.error('Failed to track page view:', error);
|
||||
logger.error('Failed to track page view', { entityType, entityId });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user