diff --git a/.github/build-and-test/action.yml b/.github/build-and-test/action.yml index 37923a1..d450bf3 100644 --- a/.github/build-and-test/action.yml +++ b/.github/build-and-test/action.yml @@ -19,6 +19,10 @@ runs: with: toolchain: stable + - name: Install protoc compiler + shell: bash + run: sudo apt-get update && sudo apt-get install -y protobuf-compiler + - name: 🔨 Build uses: actions-rs/cargo@v1 with: diff --git a/Cargo.toml b/Cargo.toml index 0fab0d6..3c536e8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" [dependencies] base32 = "0.4.0" base64 = "0.21.5" -chrono = "0.4.31" +chrono = "0.4.35" dotenv = "0.15.0" fast_qr = "0.11.0" hyper = { version = "0.14.27", features = ["full"] } diff --git a/README.md b/README.md index 26b2927..a2bb902 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ The mobile app provides a user-friendly interface for configuring what events tr to run on linux, you should have the following packages installed 1. pkg-config: `sudo apt install pkg-config` 2. libssl-dev: `sudo apt install libssl-dev` +3. proto-compiler: `apt-get install protobuf-compiler` ## Setup 1. create a copy of the `.env.example` file in the root directory of the project, and name it `.env` diff --git a/build.rs b/build.rs index 5457e58..2c18f29 100644 --- a/build.rs +++ b/build.rs @@ -5,9 +5,9 @@ fn main() -> Result<(), Box> { tonic_build::configure() .file_descriptor_set_path(out_dir.join("remonproto_descriptor.bin")) - .compile(&[r".\proto\notification.proto"], &["proto"])?; + .compile(&["./proto/notification.proto"], &["proto"])?; - tonic_build::compile_protos(r".\proto\notification.proto")?; + tonic_build::compile_protos("./proto/notification.proto")?; Ok(()) } diff --git a/src/grpc/grpc_service.rs b/src/grpc/grpc_service.rs index d677d29..1fe11a1 100644 --- a/src/grpc/grpc_service.rs +++ b/src/grpc/grpc_service.rs @@ -39,11 +39,19 @@ impl NotificationServiceImpl for NotificationService { request.title, request.body ); + // TODO(@isaidsari): this part is not complete + // it needs to think more about it let configs = fetch_monitor_configs().await.unwrap_or_else(|e| { error!("failed to fetch monitor configs: {}", e); vec![] }); + if configs.is_empty() { + return Ok(Response::new(NotificationResponse { + message: "No monitor configs found".to_string(), + })); + }; + let res = notification_service::send_notification_to_single( &configs[0].device_id, &configs[0].fcm_token,