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:
gpt-engineer-app[bot]
2025-11-06 15:03:51 +00:00
parent de9a48951f
commit ed9d17bf10
4 changed files with 253 additions and 1 deletions

View File

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