diff --git a/common/proto/table_definition.proto b/common/proto/table_definition.proto index d9ffc0c..fb2b369 100644 --- a/common/proto/table_definition.proto +++ b/common/proto/table_definition.proto @@ -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 { diff --git a/common/src/proto/descriptor.bin b/common/src/proto/descriptor.bin index ba93218..2bc3df3 100644 Binary files a/common/src/proto/descriptor.bin and b/common/src/proto/descriptor.bin differ diff --git a/common/src/proto/multieko2.table_definition.rs b/common/src/proto/multieko2.table_definition.rs index 629ab48..85be25e 100644 --- a/common/src/proto/multieko2.table_definition.rs +++ b/common/src/proto/multieko2.table_definition.rs @@ -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)] diff --git a/server/src/table_definition/handlers/get_profile_tree.rs b/server/src/table_definition/handlers/get_profile_tree.rs index 3d879e7..3e68be3 100644 --- a/server/src/table_definition/handlers/get_profile_tree.rs +++ b/server/src/table_definition/handlers/get_profile_tree.rs @@ -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()