Refactor api into different route files

This commit is contained in:
Jon Staab
2026-05-15 09:28:12 -07:00
parent 26f05e8b8f
commit 5590b14074
11 changed files with 1182 additions and 1109 deletions
+21
View File
@@ -0,0 +1,21 @@
use std::sync::Arc;
use axum::{extract::State, http::StatusCode, response::Response};
use serde::Serialize;
use crate::api::{Api, AuthedPubkey};
use crate::web::ok;
#[derive(Serialize)]
struct IdentityResponse {
pubkey: String,
is_admin: bool,
}
pub async fn get_identity(
State(api): State<Arc<Api>>,
AuthedPubkey(pubkey): AuthedPubkey,
) -> Response {
let is_admin = api.is_admin(&pubkey);
ok(StatusCode::OK, IdentityResponse { pubkey, is_admin })
}