3 files changed
+12
-5
crates/cli/src/deploy/mod.rs
+1
-1
@@ -16,7 +16,7 @@ use remote_messages::{build_next_app, start_server};
16
use smbcloud_model::project::DeploymentPayload;
17
use smbcloud_model::project::DeploymentStatus;
18
use smbcloud_networking::environment::Environment;
19
-use smbcloud_networking_project::crud_project_deployment_create::{create, update};
19
+use smbcloud_networking_project::crud_project_deployment_create::create;
20
use spinners::Spinner;
21
22
pub async fn process_deploy(env: Environment) -> Result<CommandResult> {
crates/smbcloud-model/src/project.rs
+5
-2
@@ -1,6 +1,7 @@
1
use crate::{app_auth::AuthApp, ar_date_format};
2
use chrono::{DateTime, Utc};
3
use serde::{Deserialize, Serialize};
4
+use serde_repr::{Deserialize_repr, Serialize_repr};
5
6
#[derive(Deserialize, Debug, Serialize)]
7
pub struct Config {
@@ -27,6 +28,7 @@ pub struct ProjectCreate {
28
#[derive(Deserialize, Serialize, Debug)]
29
pub struct Deployment {
30
pub id: i32,
31
+ pub project_id: i32,
32
pub commit_hash: String,
33
pub status: DeploymentStatus,
34
#[serde(with = "ar_date_format")]
@@ -35,13 +37,14 @@ pub struct Deployment {
37
pub updated_at: DateTime<Utc>,
38
}
39
38
-#[derive(Serialize, Debug)]
40
+#[derive(Deserialize, Serialize, Debug)]
41
pub struct DeploymentPayload {
42
pub commit_hash: String,
43
pub status: DeploymentStatus,
44
}
45
44
-#[derive(Deserialize, Serialize, Debug)]
46
+#[derive(Deserialize_repr, Serialize_repr, Debug)]
47
+#[repr(u8)]
48
pub enum DeploymentStatus {
49
Started = 0,
50
Failed,
crates/smbcloud-networking-project/src/crud_project_deployment_create.rs
+6
-2
@@ -24,11 +24,15 @@ pub async fn create(
24
.await?;
25
26
match response.status() {
27
- reqwest::StatusCode::OK => {
27
+ reqwest::StatusCode::CREATED => {
28
let deployment: Deployment = response.json().await?;
29
Ok(deployment)
30
+ // After receiving the response
31
+ //let body = response.text().await?;
32
+ //println!("Response body: {}", body);
33
+ // todo!()
34
}
31
- _ => Err(anyhow!("Failed to fetch projects.")),
35
+ _ => Err(anyhow!("Something wrong.")),
36
}
37
}
38