mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 12:31:26 -05:00
Fix submission flow issues
This commit is contained in:
@@ -1301,6 +1301,15 @@ async function createRideModel(supabase: any, data: any): Promise<string> {
|
||||
if (error) throw new Error(`Failed to update ride model: ${error.message}`);
|
||||
} else {
|
||||
console.log('Creating new ride model');
|
||||
|
||||
// Validate required fields
|
||||
if (!data.manufacturer_id) {
|
||||
throw new Error('Ride model must be associated with a manufacturer');
|
||||
}
|
||||
if (!data.name || !data.slug) {
|
||||
throw new Error('Ride model must have a name and slug');
|
||||
}
|
||||
|
||||
const sanitizedData = sanitizeDateFields(data);
|
||||
const filteredData = filterDatabaseFields(sanitizedData, RIDE_MODEL_FIELDS);
|
||||
const { data: model, error } = await supabase
|
||||
|
||||
Reference in New Issue
Block a user