mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 14:11:13 -05:00
Fix submission update functions
This commit is contained in:
@@ -75,10 +75,10 @@ export async function submitCompanyUpdate(
|
||||
data: CompanyFormData,
|
||||
userId: string
|
||||
) {
|
||||
// Fetch existing company to get its type
|
||||
// Fetch existing company data (all fields for original_data)
|
||||
const { data: existingCompany, error: fetchError } = await supabase
|
||||
.from('companies')
|
||||
.select('company_type')
|
||||
.select('*')
|
||||
.eq('id', companyId)
|
||||
.single();
|
||||
|
||||
@@ -112,7 +112,7 @@ export async function submitCompanyUpdate(
|
||||
|
||||
if (submissionError) throw submissionError;
|
||||
|
||||
// Create the submission item with actual company data
|
||||
// Create the submission item with actual company data AND original data
|
||||
const { error: itemError } = await supabase
|
||||
.from('submission_items')
|
||||
.insert({
|
||||
@@ -129,6 +129,7 @@ export async function submitCompanyUpdate(
|
||||
headquarters_location: data.headquarters_location,
|
||||
images: processedImages as any
|
||||
},
|
||||
original_data: existingCompany,
|
||||
status: 'pending',
|
||||
order_index: 0
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user