initialize analytics
This commit is contained in:
parent
004def8fbb
commit
2665a6d25f
3 changed files with 22 additions and 1 deletions
20
services/api/src/analytics.rs
Normal file
20
services/api/src/analytics.rs
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
use async_graphql::Object;
|
||||||
|
|
||||||
|
pub struct Analytics {}
|
||||||
|
|
||||||
|
#[Object]
|
||||||
|
impl Analytics {
|
||||||
|
async fn population(&self) -> i32 {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
|
pub struct AnalyticsQuery;
|
||||||
|
|
||||||
|
#[Object]
|
||||||
|
impl AnalyticsQuery {
|
||||||
|
async fn analytics(&self) -> Analytics {
|
||||||
|
Analytics {}
|
||||||
|
}
|
||||||
|
}
|
|
@ -74,7 +74,7 @@ impl Health {
|
||||||
let last_event: DateTime<Utc> = row.get(0);
|
let last_event: DateTime<Utc> = row.get(0);
|
||||||
|
|
||||||
if last_event < Utc::now() - chrono::Duration::minutes(5) {
|
if last_event < Utc::now() - chrono::Duration::minutes(5) {
|
||||||
return (UpDown::Down, None);
|
return (UpDown::Down, Some(last_event));
|
||||||
} else {
|
} else {
|
||||||
return (UpDown::Up, Some(last_event));
|
return (UpDown::Up, Some(last_event));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
mod analytics;
|
||||||
mod classes;
|
mod classes;
|
||||||
mod health;
|
mod health;
|
||||||
mod population;
|
mod population;
|
||||||
|
|
Loading…
Add table
Reference in a new issue