post table data commented out execution of steel code
This commit is contained in:
@@ -4,7 +4,6 @@ use sqlx::{PgPool, Arguments};
|
||||
use sqlx::postgres::PgArguments;
|
||||
use chrono::{DateTime, Utc};
|
||||
use common::proto::multieko2::tables_data::{PostTableDataRequest, PostTableDataResponse};
|
||||
use crate::steel::server::execution::{self, ScriptOperation};
|
||||
use std::collections::HashMap;
|
||||
|
||||
pub async fn post_table_data(
|
||||
@@ -19,13 +18,13 @@ pub async fn post_table_data(
|
||||
for (key, value) in request.data {
|
||||
let trimmed = value.trim().to_string();
|
||||
|
||||
// Handle firma specially - it cannot be empty
|
||||
if key == "firma" && trimmed.is_empty() {
|
||||
// Handle specially - it cannot be empty
|
||||
if trimmed.is_empty() {
|
||||
return Err(Status::invalid_argument("Firma cannot be empty"));
|
||||
}
|
||||
|
||||
// Add trimmed non-empty values to data map
|
||||
if !trimmed.is_empty() || key == "firma" {
|
||||
if !trimmed.is_empty(){
|
||||
data.insert(key, trimmed);
|
||||
}
|
||||
}
|
||||
@@ -82,7 +81,7 @@ pub async fn post_table_data(
|
||||
.map_err(|e| Status::internal(format!("Link lookup error: {}", e)))?;
|
||||
|
||||
// Build required columns list
|
||||
let mut required_columns = vec!["firma".to_string()];
|
||||
let mut required_columns = vec![];
|
||||
for link in required_links {
|
||||
let base_name = link.table_name.split('_').last().unwrap_or(&link.table_name);
|
||||
required_columns.push(format!("{}_id", base_name));
|
||||
@@ -96,7 +95,7 @@ pub async fn post_table_data(
|
||||
}
|
||||
|
||||
// Validate all data columns
|
||||
let system_columns = ["firma", "deleted"];
|
||||
let system_columns = ["deleted"];
|
||||
let user_columns: Vec<&String> = columns.iter().map(|(name, _)| name).collect();
|
||||
for key in data.keys() {
|
||||
if !system_columns.contains(&key.as_str()) && !user_columns.contains(&key) {
|
||||
@@ -113,6 +112,8 @@ pub async fn post_table_data(
|
||||
.await
|
||||
.map_err(|e| Status::internal(format!("Failed to fetch scripts: {}", e)))?;
|
||||
|
||||
// TODO: Re-implement script validation logic
|
||||
/*
|
||||
for script_record in scripts {
|
||||
let target_column = script_record.target_column;
|
||||
|
||||
@@ -158,6 +159,7 @@ pub async fn post_table_data(
|
||||
));
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Prepare SQL parameters
|
||||
let mut params = PgArguments::default();
|
||||
@@ -168,7 +170,6 @@ pub async fn post_table_data(
|
||||
for (col, value) in data {
|
||||
let sql_type = if system_columns.contains(&col.as_str()) {
|
||||
match col.as_str() {
|
||||
"firma" => "TEXT",
|
||||
"deleted" => "BOOLEAN",
|
||||
_ => return Err(Status::invalid_argument("Invalid system column")),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user