diff options
Diffstat (limited to 'src/channel/routes.rs')
| -rw-r--r-- | src/channel/routes.rs | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/channel/routes.rs b/src/channel/routes.rs index 014a57b..6e06cc9 100644 --- a/src/channel/routes.rs +++ b/src/channel/routes.rs @@ -4,12 +4,11 @@ use axum::{ routing::post, Router, }; -use sqlx::sqlite::SqlitePool; use super::repo::Provider as _; -use crate::{error::InternalError, login::repo::logins::Login}; +use crate::{app::App, error::InternalError, login::repo::logins::Login}; -pub fn router() -> Router<SqlitePool> { +pub fn router() -> Router<App> { Router::new().route("/create", post(on_create)) } @@ -19,11 +18,11 @@ struct CreateRequest { } async fn on_create( - State(db): State<SqlitePool>, + State(app): State<App>, _: Login, // requires auth, but doesn't actually care who you are Form(form): Form<CreateRequest>, ) -> Result<impl IntoResponse, InternalError> { - let mut tx = db.begin().await?; + let mut tx = app.db.begin().await?; tx.channels().create(&form.name).await?; tx.commit().await?; |
