Skip to content

Commit

Permalink
add publication name
Browse files Browse the repository at this point in the history
  • Loading branch information
imor committed Aug 29, 2024
1 parent bca76ee commit 63767c8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions api/src/db/publications.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
}

Expand Down
2 changes: 2 additions & 0 deletions api/tests/api/publications.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()],
}
}
Expand Down
1 change: 1 addition & 0 deletions cli/src/api_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ impl Display for BatchConfig {

#[derive(Debug, serde::Serialize, serde::Deserialize)]
pub struct PublicationConfig {
pub name: String,
pub table_names: Vec<String>,
}

Expand Down
3 changes: 2 additions & 1 deletion cli/src/publications.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,13 @@ pub async fn list_publications(
}

fn get_publication_config(editor: &mut DefaultEditor) -> Result<PublicationConfig, CliError> {
let name = get_string(editor, "enter publication name: ")?;
let table_names = get_string(editor, "enter comma separated table names: ")?;
let table_names: Vec<String> = 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<i64, CliError> {
Expand Down

0 comments on commit 63767c8

Please sign in to comment.