@smbcloud / cli / commits / 1de9c72

wip

Seto Elkahfi committed May 28, 2025 at 22:23 UTC 1de9c72c402394b5f660885ce542f630b13d56c7
4 files changed +35
crates/cli/src/deploy/mod.rs
+8
@@ -14,6 +14,7 @@ use git::remote_deployment_setup;
14 use git2::{PushOptions, RemoteCallbacks, Repository};
15 use remote_messages::{build_next_app, start_server};
16 use smbcloud_networking::environment::Environment;
17 +use smbcloud_networking_project::crud_deployment_create::Payload;
18 use spinners::Spinner;
19
20 pub async fn process_deploy(env: Environment) -> Result<CommandResult> {
@@ -78,6 +79,13 @@ pub async fn process_deploy(env: Environment) -> Result<CommandResult> {
79 spinners::Spinners::Hamburger,
80 succeed_message("Deploying > "),
81 );
82 +
83 + let payload = Payload {
84 + project_id: config.repository.id,
85 + commit_hash: todo!(),
86 + status: todo!()
87 + };
88 +
89 match origin.push(&["refs/heads/main:refs/heads/main"], Some(&mut push_opts)) {
90 Ok(_) => Ok(CommandResult {
91 spinner,
crates/smbcloud-model/src/project.rs
+14
@@ -24,6 +24,20 @@ pub struct ProjectCreate {
24 pub description: String,
25 }
26
27 +#[derive(Serialize, Debug)]
28 +pub struct Payload {
29 + pub project_id: i32,
30 + pub commit_hash: String,
31 + pub status: DeploymentStatus
32 +}
33 +
34 +#[derive(Serialize, Debug)]
35 +pub enum DeploymentStatus {
36 + Started,
37 + Failed,
38 + Done,
39 +}
40 +
41 #[cfg(test)]
42 mod tests {
43 use super::*;
crates/smbcloud-networking-project/src/crud_deployment_create.rs new
+11
@@ -0,0 +1,11 @@
1 +use smbcloud_networking::environment::Environment;
2 +
3 +pub struct Payload {
4 + pub project_id: i32,
5 + pub commit_hash: String,
6 + pub status: i8
7 +}
8 +
9 +pub async fn create(env: Environment, payload: Payload) {
10 + todo!()
11 +}
\ No newline at end of file
crates/smbcloud-networking-project/src/lib.rs
+2
@@ -1,3 +1,5 @@
1 +pub mod crud_deployment_create;
2 +
3 use anyhow::{anyhow, Result};
4 use log::debug;
5 use reqwest::{Client, StatusCode};