diff --git a/Cargo.toml b/Cargo.toml index 3875603..e30787b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,8 +8,8 @@ license = "Apache-2.0" unwrap_used = "deny" [dependencies] -async-graphql = { version = "=7.0.9", features = ["tracing"] } -async-graphql-axum = "=7.0.9" +async-graphql = { version = "7.0.11", features = ["tracing"] } +async-graphql-axum = "7.0.11" axum = "0.7.5" chrono = "0.4.38" clap = { version = "4.5.16", features = ["cargo", "derive", "env"] } diff --git a/src/db_service.rs b/src/db_service.rs index ff60c18..6e77590 100644 --- a/src/db_service.rs +++ b/src/db_service.rs @@ -288,10 +288,10 @@ impl SqliteScanPathService { Ok(Self { pool }) } - pub async fn current_configuration<'bl>( + pub async fn current_configuration( &self, - beamline: &'bl str, - ) -> Result> { + beamline: &str, + ) -> Result { query_as!( DbBeamlineConfig, "SELECT * FROM beamline WHERE name = ?", @@ -300,14 +300,14 @@ impl SqliteScanPathService { .fetch_optional(&self.pool) .await? .map(BeamlineConfiguration::from) - .ok_or(ConfigurationError::MissingBeamline(beamline)) + .ok_or(ConfigurationError::MissingBeamline(beamline.into())) } - pub async fn next_scan_configuration<'bl>( + pub async fn next_scan_configuration( &self, - beamline: &'bl str, + beamline: &str, current_high: Option, - ) -> Result> { + ) -> Result { let exp = current_high.unwrap_or(0); query_as!( DbBeamlineConfig, @@ -318,7 +318,7 @@ impl SqliteScanPathService { .fetch_optional(&self.pool) .await? .map(BeamlineConfiguration::from) - .ok_or(ConfigurationError::MissingBeamline(beamline)) + .ok_or(ConfigurationError::MissingBeamline(beamline.into())) } #[cfg(test)] @@ -352,12 +352,12 @@ mod error { use std::fmt::{self, Display}; #[derive(Debug)] - pub enum ConfigurationError<'bl> { - MissingBeamline(&'bl str), + pub enum ConfigurationError { + MissingBeamline(String), Db(sqlx::Error), } - impl Display for ConfigurationError<'_> { + impl Display for ConfigurationError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { ConfigurationError::MissingBeamline(bl) => { @@ -368,7 +368,7 @@ mod error { } } - impl Error for ConfigurationError<'_> { + impl Error for ConfigurationError { fn source(&self) -> Option<&(dyn Error + 'static)> { match self { ConfigurationError::MissingBeamline(_) => None, @@ -377,7 +377,7 @@ mod error { } } - impl From for ConfigurationError<'_> { + impl From for ConfigurationError { fn from(value: sqlx::Error) -> Self { Self::Db(value) } diff --git a/src/graphql.rs b/src/graphql.rs index 7867f52..0f858bc 100644 --- a/src/graphql.rs +++ b/src/graphql.rs @@ -52,6 +52,7 @@ pub async fn serve_graphql(db: &Path, opts: ServeOptions) { info!("Serving graphql endpoints on {:?}", opts.addr()); let schema = Schema::build(Query, Mutation, EmptySubscription) .extension(Tracing) + .limit_directives(32) .data(db) .finish(); let app = Router::new()