get profile details with scripts and tables columns is now working
This commit is contained in:
@@ -18,6 +18,10 @@ service TableDefinition {
|
||||
// This provides a tree-like overview of table relationships.
|
||||
rpc GetProfileTree(komp_ac.common.Empty) returns (ProfileTreeResponse);
|
||||
|
||||
// Fetches all tables with their columns and scripts for a specific profile.
|
||||
// Pure data retrieval - no business logic.
|
||||
rpc GetProfileDetails(GetProfileDetailsRequest) returns (GetProfileDetailsResponse);
|
||||
|
||||
// Drops a table and its metadata, then deletes the profile if it becomes empty.
|
||||
rpc DeleteTable(DeleteTableRequest) returns (DeleteTableResponse);
|
||||
}
|
||||
@@ -119,6 +123,35 @@ message ProfileTreeResponse {
|
||||
repeated Profile profiles = 1;
|
||||
}
|
||||
|
||||
// Request to fetch all tables, columns and scripts for a profile.
|
||||
message GetProfileDetailsRequest {
|
||||
// Profile (schema) name to fetch details for.
|
||||
string profile_name = 1;
|
||||
}
|
||||
|
||||
// Response with all tables, columns and scripts for a profile.
|
||||
message GetProfileDetailsResponse {
|
||||
string profile_name = 1;
|
||||
repeated TableDetail tables = 2;
|
||||
}
|
||||
|
||||
// Describes a table with its columns and associated scripts.
|
||||
message TableDetail {
|
||||
string name = 1;
|
||||
int64 id = 2;
|
||||
repeated ColumnDefinition columns = 3;
|
||||
repeated ScriptInfo scripts = 4;
|
||||
}
|
||||
|
||||
// A script that targets a specific column in a table.
|
||||
message ScriptInfo {
|
||||
int64 script_id = 1;
|
||||
string target_column = 2;
|
||||
string target_column_type = 3;
|
||||
string script = 4;
|
||||
string description = 5;
|
||||
}
|
||||
|
||||
// Request to delete one table definition entirely.
|
||||
message DeleteTableRequest {
|
||||
// Profile (schema) name owning the table (must exist).
|
||||
|
||||
Binary file not shown.
@@ -110,6 +110,47 @@ pub mod profile_tree_response {
|
||||
pub tables: ::prost::alloc::vec::Vec<Table>,
|
||||
}
|
||||
}
|
||||
/// Request to fetch all tables, columns and scripts for a profile.
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct GetProfileDetailsRequest {
|
||||
/// Profile (schema) name to fetch details for.
|
||||
#[prost(string, tag = "1")]
|
||||
pub profile_name: ::prost::alloc::string::String,
|
||||
}
|
||||
/// Response with all tables, columns and scripts for a profile.
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct GetProfileDetailsResponse {
|
||||
#[prost(string, tag = "1")]
|
||||
pub profile_name: ::prost::alloc::string::String,
|
||||
#[prost(message, repeated, tag = "2")]
|
||||
pub tables: ::prost::alloc::vec::Vec<TableDetail>,
|
||||
}
|
||||
/// Describes a table with its columns and associated scripts.
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct TableDetail {
|
||||
#[prost(string, tag = "1")]
|
||||
pub name: ::prost::alloc::string::String,
|
||||
#[prost(int64, tag = "2")]
|
||||
pub id: i64,
|
||||
#[prost(message, repeated, tag = "3")]
|
||||
pub columns: ::prost::alloc::vec::Vec<ColumnDefinition>,
|
||||
#[prost(message, repeated, tag = "4")]
|
||||
pub scripts: ::prost::alloc::vec::Vec<ScriptInfo>,
|
||||
}
|
||||
/// A script that targets a specific column in a table.
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct ScriptInfo {
|
||||
#[prost(int64, tag = "1")]
|
||||
pub script_id: i64,
|
||||
#[prost(string, tag = "2")]
|
||||
pub target_column: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "3")]
|
||||
pub target_column_type: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "4")]
|
||||
pub script: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "5")]
|
||||
pub description: ::prost::alloc::string::String,
|
||||
}
|
||||
/// Request to delete one table definition entirely.
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct DeleteTableRequest {
|
||||
@@ -289,6 +330,37 @@ pub mod table_definition_client {
|
||||
);
|
||||
self.inner.unary(req, path, codec).await
|
||||
}
|
||||
/// Fetches all tables with their columns and scripts for a specific profile.
|
||||
/// Pure data retrieval - no business logic.
|
||||
pub async fn get_profile_details(
|
||||
&mut self,
|
||||
request: impl tonic::IntoRequest<super::GetProfileDetailsRequest>,
|
||||
) -> std::result::Result<
|
||||
tonic::Response<super::GetProfileDetailsResponse>,
|
||||
tonic::Status,
|
||||
> {
|
||||
self.inner
|
||||
.ready()
|
||||
.await
|
||||
.map_err(|e| {
|
||||
tonic::Status::unknown(
|
||||
format!("Service was not ready: {}", e.into()),
|
||||
)
|
||||
})?;
|
||||
let codec = tonic::codec::ProstCodec::default();
|
||||
let path = http::uri::PathAndQuery::from_static(
|
||||
"/komp_ac.table_definition.TableDefinition/GetProfileDetails",
|
||||
);
|
||||
let mut req = request.into_request();
|
||||
req.extensions_mut()
|
||||
.insert(
|
||||
GrpcMethod::new(
|
||||
"komp_ac.table_definition.TableDefinition",
|
||||
"GetProfileDetails",
|
||||
),
|
||||
);
|
||||
self.inner.unary(req, path, codec).await
|
||||
}
|
||||
/// Drops a table and its metadata, then deletes the profile if it becomes empty.
|
||||
pub async fn delete_table(
|
||||
&mut self,
|
||||
@@ -353,6 +425,15 @@ pub mod table_definition_server {
|
||||
tonic::Response<super::ProfileTreeResponse>,
|
||||
tonic::Status,
|
||||
>;
|
||||
/// Fetches all tables with their columns and scripts for a specific profile.
|
||||
/// Pure data retrieval - no business logic.
|
||||
async fn get_profile_details(
|
||||
&self,
|
||||
request: tonic::Request<super::GetProfileDetailsRequest>,
|
||||
) -> std::result::Result<
|
||||
tonic::Response<super::GetProfileDetailsResponse>,
|
||||
tonic::Status,
|
||||
>;
|
||||
/// Drops a table and its metadata, then deletes the profile if it becomes empty.
|
||||
async fn delete_table(
|
||||
&self,
|
||||
@@ -537,6 +618,52 @@ pub mod table_definition_server {
|
||||
};
|
||||
Box::pin(fut)
|
||||
}
|
||||
"/komp_ac.table_definition.TableDefinition/GetProfileDetails" => {
|
||||
#[allow(non_camel_case_types)]
|
||||
struct GetProfileDetailsSvc<T: TableDefinition>(pub Arc<T>);
|
||||
impl<
|
||||
T: TableDefinition,
|
||||
> tonic::server::UnaryService<super::GetProfileDetailsRequest>
|
||||
for GetProfileDetailsSvc<T> {
|
||||
type Response = super::GetProfileDetailsResponse;
|
||||
type Future = BoxFuture<
|
||||
tonic::Response<Self::Response>,
|
||||
tonic::Status,
|
||||
>;
|
||||
fn call(
|
||||
&mut self,
|
||||
request: tonic::Request<super::GetProfileDetailsRequest>,
|
||||
) -> Self::Future {
|
||||
let inner = Arc::clone(&self.0);
|
||||
let fut = async move {
|
||||
<T as TableDefinition>::get_profile_details(&inner, request)
|
||||
.await
|
||||
};
|
||||
Box::pin(fut)
|
||||
}
|
||||
}
|
||||
let accept_compression_encodings = self.accept_compression_encodings;
|
||||
let send_compression_encodings = self.send_compression_encodings;
|
||||
let max_decoding_message_size = self.max_decoding_message_size;
|
||||
let max_encoding_message_size = self.max_encoding_message_size;
|
||||
let inner = self.inner.clone();
|
||||
let fut = async move {
|
||||
let method = GetProfileDetailsSvc(inner);
|
||||
let codec = tonic::codec::ProstCodec::default();
|
||||
let mut grpc = tonic::server::Grpc::new(codec)
|
||||
.apply_compression_config(
|
||||
accept_compression_encodings,
|
||||
send_compression_encodings,
|
||||
)
|
||||
.apply_max_message_size_config(
|
||||
max_decoding_message_size,
|
||||
max_encoding_message_size,
|
||||
);
|
||||
let res = grpc.unary(method, req).await;
|
||||
Ok(res)
|
||||
};
|
||||
Box::pin(fut)
|
||||
}
|
||||
"/komp_ac.table_definition.TableDefinition/DeleteTable" => {
|
||||
#[allow(non_camel_case_types)]
|
||||
struct DeleteTableSvc<T: TableDefinition>(pub Arc<T>);
|
||||
|
||||
Reference in New Issue
Block a user