-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat/alert configs for monitors (#93)
* feat: Add `Error` for alert configuration errors * feat: Add list of monitor IDs to `AlertConfig` and functionality to assocciate `Monitor`s with `AlertConfig`s * feat: Support monitor IDs in `AlertConfig` data models * chore: Add missing `check_for_backend(Pg)` to alert config data models * feat: Retrieve `monitor_alert_config` data and populate `AlertConfig` models in `.get` and `.all` * feat: Include `monitor_alert_config` rows in `.save` * test: Add seed data for `monitor_alert_config` * chore: Add TODO comment * chore: Fix instances of `monitor` in `AlertConfigRepository` integration tests * test: Cover `AlertConfig.monitor_ids` in `AlertConfigRepository` integration tests * feat: Add trait and method for retrieving `AlertConfig`s by monitors that use them * test: Add coverage for `get_by_monitors` * fix: Need to use `distinct` to avoid duplicates * refactor: Remove duplication between `get_by_monitors` and `all`
- Loading branch information
Showing
4 changed files
with
127 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
use async_trait::async_trait; | ||
use uuid::Uuid; | ||
|
||
#[cfg(test)] | ||
use mockall::automock; | ||
|
||
use crate::domain::models::alert_config::AlertConfig; | ||
use crate::errors::Error; | ||
|
||
#[cfg_attr(test, automock)] | ||
#[async_trait] | ||
pub trait GetByMonitors { | ||
async fn get_by_monitors( | ||
&mut self, | ||
monitor_ids: &[Uuid], | ||
tenant: &str, | ||
) -> Result<Vec<AlertConfig>, Error>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
pub mod alert_config_repo; | ||
pub mod alert_configs; | ||
pub mod api_key_repo; | ||
pub mod api_keys; | ||
pub mod monitor; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters