WORKING STEEL PROPER IMPLEMENTATION finally fixed

This commit is contained in:
filipriec
2025-03-11 18:52:58 +01:00
parent 2c4abb0bbc
commit 22564682c8
2 changed files with 6 additions and 12 deletions

View File

@@ -114,18 +114,17 @@ pub async fn post_table_data(
.await
.map_err(|e| Status::internal(format!("Failed to fetch scripts: {}", e)))?;
// TODO SCRIPT EXECUTION NEEDS REDESING
for script_record in scripts {
let target_column = script_record.target_column;
// Ensure target column exists in submitted data
let user_value = data.get(&target_column)
.ok_or_else(|| Status::invalid_argument(
format!("Script target column '{}' is required", target_column)
))?;
// Execute the script using your existing implementation
let script_result = execution::execute_script(&script_record.script, "STRING")
// Execute the script using the owned String
let script_result = execution::execute_script(script_record.script.clone(), "STRING") // Changed here
.map_err(|e| Status::invalid_argument(
format!("Script execution failed for '{}': {}", target_column, e)
))?;
@@ -137,7 +136,7 @@ pub async fn post_table_data(
"Validation failed for '{}'. Expected: '{}', Received: '{}'",
target_column, expected_value, user_value
)));
}
}
}
// Prepare SQL parameters