From ea74daca4809e4008dd8d01039db9fff3be659d9 Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Wed, 16 Oct 2024 20:14:33 -0400 Subject: Organizational pass on endpoints and routes. --- src/invite/app.rs | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'src/invite/app.rs') diff --git a/src/invite/app.rs b/src/invite/app.rs index 6800d72..4162470 100644 --- a/src/invite/app.rs +++ b/src/invite/app.rs @@ -31,13 +31,9 @@ impl<'a> Invites<'a> { Ok(invite) } - pub async fn get(&self, invite: &Id) -> Result { + pub async fn get(&self, invite: &Id) -> Result, sqlx::Error> { let mut tx = self.db.begin().await?; - let invite = tx - .invites() - .summary(invite) - .await - .not_found(|| Error::NotFound(invite.clone()))?; + let invite = tx.invites().summary(invite).await.optional()?; tx.commit().await?; Ok(invite) @@ -91,14 +87,6 @@ impl<'a> Invites<'a> { } } -#[derive(Debug, thiserror::Error)] -pub enum Error { - #[error("invite not found: {0}")] - NotFound(Id), - #[error(transparent)] - Database(#[from] sqlx::Error), -} - #[derive(Debug, thiserror::Error)] pub enum AcceptError { #[error("invite not found: {0}")] -- cgit v1.2.3