mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 15:31:12 -05:00
Fix JSON violations
This commit is contained in:
@@ -2,6 +2,52 @@ import { supabase } from '@/integrations/supabase/client';
|
||||
import { ImageAssignments } from '@/components/upload/EntityMultiImageUploader';
|
||||
import { uploadPendingImages } from './imageUploadHelper';
|
||||
|
||||
/**
|
||||
* ═══════════════════════════════════════════════════════════════════
|
||||
* SUBMISSION PATTERN STANDARD - CRITICAL PROJECT RULE
|
||||
* ═══════════════════════════════════════════════════════════════════
|
||||
*
|
||||
* ⚠️ NEVER STORE JSON IN SQL COLUMNS ⚠️
|
||||
*
|
||||
* content_submissions.content should ONLY contain:
|
||||
* ✅ action: 'create' | 'edit' | 'delete'
|
||||
* ✅ Minimal reference IDs (entity_id, parent_id, etc.) - MAX 3 fields
|
||||
* ❌ NO actual form data
|
||||
* ❌ NO submission content
|
||||
* ❌ NO large objects
|
||||
*
|
||||
* ALL actual data MUST go in:
|
||||
* ✅ submission_items.item_data (new data)
|
||||
* ✅ submission_items.original_data (for edits)
|
||||
* ✅ Specialized relational tables:
|
||||
* - photo_submissions + photo_submission_items
|
||||
* - park_submissions
|
||||
* - ride_submissions
|
||||
* - company_submissions
|
||||
* - ride_model_submissions
|
||||
*
|
||||
* If your data is relational, model it relationally.
|
||||
* JSON blobs destroy:
|
||||
* - Queryability (can't filter/join)
|
||||
* - Performance (slower, larger)
|
||||
* - Data integrity (no constraints)
|
||||
* - Maintainability (impossible to refactor)
|
||||
*
|
||||
* EXAMPLES:
|
||||
*
|
||||
* ✅ CORRECT:
|
||||
* content: { action: 'create' }
|
||||
* content: { action: 'edit', park_id: uuid }
|
||||
* content: { action: 'delete', photo_id: uuid }
|
||||
*
|
||||
* ❌ WRONG:
|
||||
* content: { name: '...', description: '...', ...formData }
|
||||
* content: { photos: [...], metadata: {...} }
|
||||
* content: data // entire object dump
|
||||
*
|
||||
* ═══════════════════════════════════════════════════════════════════
|
||||
*/
|
||||
|
||||
export interface ParkFormData {
|
||||
name: string;
|
||||
slug: string;
|
||||
|
||||
Reference in New Issue
Block a user