GetCoreInfo api

This commit is contained in:
mbecker20
2023-08-22 00:08:08 -04:00
parent 75b0d25d3e
commit d9864f31c1
4 changed files with 41 additions and 2 deletions

View File

@@ -16,6 +16,7 @@ use crate::{
state::{State, StateExtension},
};
mod alert;
mod alerter;
mod build;
mod builder;
@@ -26,7 +27,6 @@ mod server;
mod tag;
mod update;
mod user;
mod alert;
#[typeshare]
#[derive(Serialize, Deserialize, Debug, Clone, Resolver)]
@@ -37,6 +37,7 @@ enum ReadRequest {
GetVersion(GetVersion),
GetUser(GetUser),
GetUsername(GetUsername),
GetCoreInfo(GetCoreInfo),
// ==== SEARCH ====
FindResources(FindResources),
@@ -162,3 +163,17 @@ impl Resolve<GetVersion, RequestUser> for State {
})
}
}
#[async_trait]
impl Resolve<GetCoreInfo, RequestUser> for State {
async fn resolve(
&self,
GetCoreInfo {}: GetCoreInfo,
_: RequestUser,
) -> anyhow::Result<GetCoreInfoResponse> {
Ok(GetCoreInfoResponse {
title: self.config.title.clone(),
monitoring_interval: self.config.monitoring_interval,
})
}
}