@smbcloud / cli / commits / ef76672

Make project repository field optional and handle None cases

Seto Elkahfi committed Jul 27, 2025 at 13:10 UTC ef76672e3cfee0137a4661590f04a53f9244ea47
3 files changed +10 -5
crates/cli/src/deploy/mod.rs
+7 -2
@@ -83,7 +83,12 @@ pub async fn process_deploy(env: Environment) -> Result<CommandResult> {
83
84 let main_branch = head;
85
86 - let mut origin = remote_deployment_setup(&runner, &repo, &config.project.repository).await?;
86 + let repository = match &config.project.repository {
87 + Some(repo) => repo,
88 + None => return Err(anyhow!(fail_message("Repository not found."))),
89 + };
90 +
91 + let mut origin = remote_deployment_setup(&runner, &repo, &repository).await?;
92
93 let commit_hash = match main_branch.resolve() {
94 Ok(result) => match result.target() {
@@ -120,7 +125,7 @@ pub async fn process_deploy(env: Environment) -> Result<CommandResult> {
125 if line.contains(&build_next_app()) {
126 println!("Building the app {}", succeed_symbol());
127 }
123 - if line.contains(&start_server(&config.project.repository)) {
128 + if line.contains(&start_server(&repository)) {
129 println!("App restart {}", succeed_symbol());
130 }
131 }
crates/cli/src/project/crud_read.rs
+2 -2
@@ -112,7 +112,7 @@ pub(crate) fn show_projects(projects: Vec<Project>) {
112 .map(|p| ProjectRow {
113 id: p.id,
114 name: p.name,
115 - repository: p.repository,
115 + repository: p.repository.unwrap_or("-".to_string()),
116 description: p.description.unwrap_or("-".to_owned()),
117 })
118 .collect();
@@ -124,7 +124,7 @@ pub(crate) fn show_project_detail(project: &Project) {
124 let row = ProjectDetailRow {
125 id: project.id,
126 name: project.name.clone(),
127 - repository: project.repository.clone(),
127 + repository: project.repository.clone().unwrap_or("-".to_owned()),
128 description: project.description.clone().unwrap_or("-".to_owned()),
129 created_at: project.created_at.date_naive().to_string(),
130 updated_at: project.updated_at.date_naive().to_string(),
crates/smbcloud-model/src/project.rs
+1 -1
@@ -15,7 +15,7 @@ pub struct Config {
15 pub struct Project {
16 pub id: i32,
17 pub name: String,
18 - pub repository: String,
18 + pub repository: Option<String>,
19 pub description: Option<String>,
20 pub created_at: DateTime<Utc>,
21 pub updated_at: DateTime<Utc>,