fix: use our own result types instead of tenors types

add user auth
This commit is contained in:
Zomatree
2025-08-08 03:10:30 +01:00
committed by Angelo Kontaxis
parent b5cd5e30ef
commit a92152d86d
5 changed files with 119 additions and 71 deletions

View File

@@ -15,11 +15,12 @@ use crate::tenor::Tenor;
mod api;
mod tenor;
mod types;
#[derive(Clone)]
struct AppState {
pub database: Database,
pub tenor: Tenor
pub tenor: Tenor,
}
impl FromRef<AppState> for Database {
@@ -45,11 +46,15 @@ async fn main() -> Result<(), std::io::Error> {
modifiers(&SecurityAddon),
paths(
api::root,
api::search,
),
components(
schemas(
revolt_result::Error,
revolt_result::ErrorType,
types::SearchResponse,
types::MediaObject,
types::MediaResult,
)
)
)]
@@ -70,8 +75,11 @@ async fn main() -> Result<(), std::io::Error> {
let config = config().await;
let state = AppState {
database: DatabaseInfo::Auto.connect().await.expect("Unable to connect to database"),
tenor: tenor::Tenor::new(&config.api.security.tenor_key)
database: DatabaseInfo::Auto
.connect()
.await
.expect("Unable to connect to database"),
tenor: tenor::Tenor::new(&config.api.security.tenor_key),
};
// Configure Axum and router