get method passing without any problem
This commit is contained in:
@@ -66,11 +66,11 @@ pub async fn get_table_data(
|
|||||||
.await
|
.await
|
||||||
.map_err(|e| Status::internal(format!("Foreign key lookup error: {}", e)))?;
|
.map_err(|e| Status::internal(format!("Foreign key lookup error: {}", e)))?;
|
||||||
|
|
||||||
// 2. Build the list of foreign key column names
|
// 2. Build the list of foreign key column names using full table names
|
||||||
let mut foreign_key_columns = Vec::new();
|
let mut foreign_key_columns = Vec::new();
|
||||||
for fk in fk_columns_query {
|
for fk in fk_columns_query {
|
||||||
let base_name = fk.table_name.split_once('_').map_or(fk.table_name.as_str(), |(_, rest)| rest);
|
// Use the full table name, not a stripped version
|
||||||
foreign_key_columns.push(format!("{}_id", base_name));
|
foreign_key_columns.push(format!("{}_id", fk.table_name));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Prepare a complete list of all columns to select
|
// 3. Prepare a complete list of all columns to select
|
||||||
|
|||||||
@@ -5,9 +5,24 @@ use common::proto::multieko2::tables_data::GetTableDataRequest;
|
|||||||
use crate::common::setup_test_db;
|
use crate::common::setup_test_db;
|
||||||
use sqlx::{PgPool, Row};
|
use sqlx::{PgPool, Row};
|
||||||
use tonic;
|
use tonic;
|
||||||
use chrono::Utc;
|
use chrono::{DateTime, Utc};
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
use futures::future::join_all;
|
||||||
|
use rand::distr::Alphanumeric;
|
||||||
|
use rand::Rng;
|
||||||
|
use rust_decimal::Decimal;
|
||||||
|
use rust_decimal_macros::dec;
|
||||||
|
use server::table_definition::handlers::post_table_definition;
|
||||||
|
use server::tables_data::handlers::post_table_data;
|
||||||
|
use common::proto::multieko2::table_definition::{
|
||||||
|
PostTableDefinitionRequest, ColumnDefinition as TableColumnDefinition, TableLink
|
||||||
|
};
|
||||||
|
use common::proto::multieko2::tables_data::PostTableDataRequest;
|
||||||
|
use prost_types::Value;
|
||||||
|
use prost_types::value::Kind;
|
||||||
|
use tokio::sync::mpsc;
|
||||||
|
use server::indexer::IndexCommand;
|
||||||
|
|
||||||
#[fixture]
|
#[fixture]
|
||||||
async fn pool() -> PgPool {
|
async fn pool() -> PgPool {
|
||||||
@@ -466,3 +481,5 @@ async fn test_get_invalid_column(
|
|||||||
|
|
||||||
cleanup_test_data(&pool, &schema_name, &table_name).await;
|
cleanup_test_data(&pool, &schema_name, &table_name).await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
include!("get_table_data_test2.rs");
|
||||||
|
|||||||
1112
server/tests/tables_data/handlers/get_table_data_test2.rs
Normal file
1112
server/tests/tables_data/handlers/get_table_data_test2.rs
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user