fixing post with links
This commit is contained in:
@@ -9,6 +9,7 @@ anyhow = "1.0.98"
|
||||
async-trait = "0.1.88"
|
||||
common = { path = "../common" }
|
||||
|
||||
prost-types = { workspace = true }
|
||||
crossterm = "0.28.1"
|
||||
dirs = "6.0.0"
|
||||
dotenvy = "0.15.7"
|
||||
|
||||
@@ -23,8 +23,9 @@ use common::proto::multieko2::tables_data::{
|
||||
use common::proto::multieko2::search::{
|
||||
searcher_client::SearcherClient, SearchRequest, SearchResponse,
|
||||
};
|
||||
use anyhow::{Context, Result}; // Added Context
|
||||
use std::collections::HashMap; // NEW
|
||||
use anyhow::{Context, Result};
|
||||
use std::collections::HashMap;
|
||||
use prost_types::Value;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct GrpcClient {
|
||||
@@ -48,7 +49,6 @@ impl GrpcClient {
|
||||
TableDefinitionClient::new(channel.clone());
|
||||
let table_script_client = TableScriptClient::new(channel.clone());
|
||||
let tables_data_client = TablesDataClient::new(channel.clone());
|
||||
// NEW: Instantiate the search client
|
||||
let search_client = SearcherClient::new(channel.clone());
|
||||
|
||||
Ok(Self {
|
||||
@@ -56,7 +56,7 @@ impl GrpcClient {
|
||||
table_definition_client,
|
||||
table_script_client,
|
||||
tables_data_client,
|
||||
search_client, // NEW
|
||||
search_client,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ impl GrpcClient {
|
||||
Ok(response.into_inner().count as u64)
|
||||
}
|
||||
|
||||
pub async fn get_table_data_by_position(
|
||||
pub async fn get_table_data_by_position(
|
||||
&mut self,
|
||||
profile_name: String,
|
||||
table_name: String,
|
||||
@@ -155,16 +155,22 @@ impl GrpcClient {
|
||||
Ok(response.into_inner())
|
||||
}
|
||||
|
||||
pub async fn post_table_data(
|
||||
pub async fn post_table_data(
|
||||
&mut self,
|
||||
profile_name: String,
|
||||
table_name: String,
|
||||
data: HashMap<String, String>,
|
||||
) -> Result<PostTableDataResponse> {
|
||||
// 2. CONVERT THE HASHMAP
|
||||
let data: HashMap<String, Value> = data
|
||||
.into_iter()
|
||||
.map(|(k, v)| (k, Value::from(v)))
|
||||
.collect();
|
||||
|
||||
let grpc_request = PostTableDataRequest {
|
||||
profile_name,
|
||||
table_name,
|
||||
data,
|
||||
data, // This is now the correct type
|
||||
};
|
||||
let request = tonic::Request::new(grpc_request);
|
||||
let response = self
|
||||
@@ -182,11 +188,17 @@ impl GrpcClient {
|
||||
id: i64,
|
||||
data: HashMap<String, String>,
|
||||
) -> Result<PutTableDataResponse> {
|
||||
// 2. CONVERT THE HASHMAP
|
||||
let data: HashMap<String, Value> = data
|
||||
.into_iter()
|
||||
.map(|(k, v)| (k, Value::from(v)))
|
||||
.collect();
|
||||
|
||||
let grpc_request = PutTableDataRequest {
|
||||
profile_name,
|
||||
table_name,
|
||||
id,
|
||||
data,
|
||||
data, // This is now the correct type
|
||||
};
|
||||
let request = tonic::Request::new(grpc_request);
|
||||
let response = self
|
||||
|
||||
Reference in New Issue
Block a user