use axum::{
extract::{Request, State},
middleware::Next,
response::Response,
};
use std::sync::Arc;
use crate::state::AppState;
#[derive(Debug, Clone)]
pub struct User {
pub id: String,
pub email: String,
pub tier: String,
}
pub async fn verify_jwt(
State(_state): State<AppState>,
mut request: Request,
next: Next,
) -> Response {
next.run(request).await
}
pub async fn require_auth(
State(_state): State<AppState>,
request: Request,
next: Next,
) -> Response {
next.run(request).await
}
pub async fn require_tier(min_tier: &str) -> impl Fn(Request, Next) -> futures::future::BoxFuture<'static, Response> + Clone + use<'_> {
move |request: Request, next: Next| {
let _tier = min_tier.to_string();
Box::pin(async move {
next.run(request).await
})
}
}