From 63767c8285902d5cc505cbe2694e8f40bc309c41 Mon Sep 17 00:00:00 2001 From: Raminder Singh Date: Thu, 29 Aug 2024 15:58:18 +0530 Subject: [PATCH] add publication name --- api/src/db/publications.rs | 1 + api/tests/api/publications.rs | 2 ++ cli/src/api_client.rs | 1 + cli/src/publications.rs | 3 ++- 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/api/src/db/publications.rs b/api/src/db/publications.rs index 7510dca..c3af57d 100644 --- a/api/src/db/publications.rs +++ b/api/src/db/publications.rs @@ -2,6 +2,7 @@ use sqlx::PgPool; #[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq)] pub struct PublicationConfig { + pub name: String, pub table_names: Vec, } diff --git a/api/tests/api/publications.rs b/api/tests/api/publications.rs index da24888..c4b0bdd 100644 --- a/api/tests/api/publications.rs +++ b/api/tests/api/publications.rs @@ -13,12 +13,14 @@ use crate::{ fn new_publication_config() -> PublicationConfig { PublicationConfig { + name: "new_publication".to_string(), table_names: vec!["table1".to_string()], } } fn updated_publication_config() -> PublicationConfig { PublicationConfig { + name: "updated_publication".to_string(), table_names: vec!["table1".to_string(), "table2".to_string()], } } diff --git a/cli/src/api_client.rs b/cli/src/api_client.rs index aa6142e..1562394 100644 --- a/cli/src/api_client.rs +++ b/cli/src/api_client.rs @@ -105,6 +105,7 @@ impl Display for BatchConfig { #[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct PublicationConfig { + pub name: String, pub table_names: Vec, } diff --git a/cli/src/publications.rs b/cli/src/publications.rs index 639f1c8..5ebda82 100644 --- a/cli/src/publications.rs +++ b/cli/src/publications.rs @@ -81,12 +81,13 @@ pub async fn list_publications( } fn get_publication_config(editor: &mut DefaultEditor) -> Result { + let name = get_string(editor, "enter publication name: ")?; let table_names = get_string(editor, "enter comma separated table names: ")?; let table_names: Vec = table_names .split(',') .map(|table_name| table_name.trim().to_string()) .collect(); - Ok(PublicationConfig { table_names }) + Ok(PublicationConfig { name, table_names }) } pub fn get_publication_id(editor: &mut DefaultEditor) -> Result {