Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
26 changes: 13 additions & 13 deletions src/db_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<BeamlineConfiguration, ConfigurationError<'bl>> {
beamline: &str,
) -> Result<BeamlineConfiguration, ConfigurationError> {
query_as!(
DbBeamlineConfig,
"SELECT * FROM beamline WHERE name = ?",
Expand All @@ -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<u32>,
) -> Result<BeamlineConfiguration, ConfigurationError<'bl>> {
) -> Result<BeamlineConfiguration, ConfigurationError> {
let exp = current_high.unwrap_or(0);
query_as!(
DbBeamlineConfig,
Expand All @@ -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)]
Expand Down Expand Up @@ -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) => {
Expand All @@ -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,
Expand All @@ -377,7 +377,7 @@ mod error {
}
}

impl From<sqlx::Error> for ConfigurationError<'_> {
impl From<sqlx::Error> for ConfigurationError {
fn from(value: sqlx::Error) -> Self {
Self::Db(value)
}
Expand Down
1 change: 1 addition & 0 deletions src/graphql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Loading