Fix submission flow issues

This commit is contained in:
gpt-engineer-app[bot]
2025-11-02 20:21:10 +00:00
parent 4aa0c02769
commit 6a9df807fa
3 changed files with 83 additions and 37 deletions

View File

@@ -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