mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 09:31:13 -05:00
Fix ride model technical specs
Implement plan to fix ride model technical specifications pipeline. This includes creating a new migration for the `ride_model_submission_technical_specifications` table, updating `entitySubmissionHelpers.ts` to handle insertion of technical specifications, and modifying the edge function `process-selective-approval/index.ts` to fetch these specifications. This ensures no data loss for ride model technical specifications.
This commit is contained in:
@@ -1954,7 +1954,30 @@ async function createRideModel(supabase: any, data: any): Promise<string> {
|
||||
let rideModelId: string;
|
||||
|
||||
// Extract relational data before transformation
|
||||
const technicalSpecifications = data._technical_specifications || [];
|
||||
let technicalSpecifications = data._technical_specifications || [];
|
||||
|
||||
// If no inline specs provided, fetch from submission table
|
||||
if (technicalSpecifications.length === 0 && data.submission_id) {
|
||||
const { data: submissionData } = await supabase
|
||||
.from('ride_model_submissions')
|
||||
.select('id')
|
||||
.eq('submission_id', data.submission_id)
|
||||
.single();
|
||||
|
||||
if (submissionData) {
|
||||
const { data: submissionSpecs } = await supabase
|
||||
.from('ride_model_submission_technical_specifications')
|
||||
.select('*')
|
||||
.eq('ride_model_submission_id', submissionData.id);
|
||||
|
||||
if (submissionSpecs && submissionSpecs.length > 0) {
|
||||
edgeLogger.info('Fetched technical specs from submission table', {
|
||||
count: submissionSpecs.length
|
||||
});
|
||||
technicalSpecifications = submissionSpecs;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove internal fields
|
||||
delete data._technical_specifications;
|
||||
|
||||
Reference in New Issue
Block a user