server changes for the ID in the tree
This commit is contained in:
@@ -35,8 +35,9 @@ message TableDefinitionResponse {
|
||||
|
||||
message ProfileTreeResponse {
|
||||
message Table {
|
||||
string name = 1;
|
||||
repeated string depends_on = 2;
|
||||
int64 id = 1;
|
||||
string name = 2;
|
||||
repeated string depends_on = 3;
|
||||
}
|
||||
|
||||
message Profile {
|
||||
|
||||
Binary file not shown.
@@ -42,9 +42,11 @@ pub struct ProfileTreeResponse {
|
||||
pub mod profile_tree_response {
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct Table {
|
||||
#[prost(string, tag = "1")]
|
||||
#[prost(int64, tag = "1")]
|
||||
pub id: i64,
|
||||
#[prost(string, tag = "2")]
|
||||
pub name: ::prost::alloc::string::String,
|
||||
#[prost(string, repeated, tag = "2")]
|
||||
#[prost(string, repeated, tag = "3")]
|
||||
pub depends_on: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
|
||||
}
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
|
||||
@@ -26,6 +26,7 @@ pub async fn get_profile_tree(
|
||||
let tables = sqlx::query!(
|
||||
r#"
|
||||
SELECT
|
||||
td.id as table_id,
|
||||
td.table_name,
|
||||
COALESCE(
|
||||
json_agg(
|
||||
@@ -40,7 +41,7 @@ pub async fn get_profile_tree(
|
||||
LEFT JOIN table_definition_links tdl ON td.id = tdl.source_table_id
|
||||
LEFT JOIN table_definitions ltd ON tdl.linked_table_id = ltd.id
|
||||
WHERE td.profile_id = $1
|
||||
GROUP BY td.table_name
|
||||
GROUP BY td.id, td.table_name
|
||||
"#,
|
||||
profile.id
|
||||
)
|
||||
@@ -59,6 +60,7 @@ pub async fn get_profile_tree(
|
||||
.unwrap_or_default();
|
||||
|
||||
Table {
|
||||
id: record.table_id,
|
||||
name: record.table_name,
|
||||
depends_on: dependencies
|
||||
.into_iter()
|
||||
|
||||
Reference in New Issue
Block a user