Skip to content

Commit

Permalink
Merge branch 'grpc' of https://github.com/adnanjpg/remon-server into …
Browse files Browse the repository at this point in the history
…grpc
  • Loading branch information
isaidsari committed Mar 14, 2024
2 parents 1b4c7f5 + b325ce9 commit 30dec19
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 3 deletions.
4 changes: 4 additions & 0 deletions .github/build-and-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
4 changes: 2 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ fn main() -> Result<(), Box<dyn Error>> {

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(())
}
8 changes: 8 additions & 0 deletions src/grpc/grpc_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 30dec19

Please sign in to comment.